Skip to content

Commit

Permalink
Fix build wheel action (#191)
Browse files Browse the repository at this point in the history
* Add OS-specific package installation for Linux in CI script

This change ensures necessary tools (curl, zip, unzip, tar) are installed on Linux systems during the CI setup. It uses the OSTYPE variable to detect the operating system and installs the packages only when running on Linux.

* Remove unused 'environment' field from pyproject.toml

This field was likely a leftover and is no longer needed in the configuration. Its removal simplifies the setup and avoids potential confusion or misconfigurations.

* Remove unused BOOST_STACKTRACE definition for Apple builds

The conditional definition for BOOST_STACKTRACE_GNU_SOURCE_NOT_REQUIRED was removed from the build script. This cleanup ensures the codebase is more concise and avoids unnecessary platform-specific configurations.

* Simplify CMake command in GitHub Actions workflow

Removed the `-DROUGHPY_BUILD_PYMODULE_INPLACE=ON` flag from the CMake command in `tests.yml`. This change streamlines the configuration process while maintaining required build and test settings.

* Remove unused CMAKE_GENERATOR environment variable.

The `CMAKE_GENERATOR` variable was defined but not used in the workflow. This cleanup reduces unnecessary configuration and improves readability of the build script.

* Update build_wheels.yml

* Update build_wheels.yml

* Disable pkgconfig installation on Windows in CI

Commented out the step to install pkgconfig on Windows using Chocolatey. This change may simplify workflows if pkgconfig is not required or managed differently. Revisit if future dependencies demand it.

* Add MSBuild and dev command prompt setup for Windows builds

This update ensures proper configuration for building on Windows runners by setting up MSBuild and enabling the developer command prompt. These steps help streamline the build process and maintain cross-platform consistency.

* Set custom environment variables for Windows builds

Added SKBUILD_CMAKE_DEFINE to the Windows build configuration in pyproject.toml. This ensures compatibility with specific compiler settings during the build process.

* Refactor pyproject.toml environment configuration format.

Updated the 'environment' field in the Windows build configuration from a list to a table for improved clarity and consistency. This change aligns with standard TOML formatting guidelines.

* Set CMake generator to Ninja and remove unused Windows env var

Added `CMAKE_GENERATOR` as "Ninja" in the build workflow to optimize builds. Removed an unused `SKBUILD_CMAKE_DEFINE` environment variable from the Windows configuration in `pyproject.toml` for cleanup and consistency.

* Set CMake toolchain file in build workflow

Added the `CMAKE_TOOLCHAIN_FILE` environment variable to the GitHub Actions `build_wheels.yml` workflow to ensure proper configuration using vcpkg. This update facilitates dependency management and improves build consistency across environments.
  • Loading branch information
inakleinbottle authored Dec 18, 2024
1 parent e7fd8e8 commit 846dfb7
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 20 deletions.
11 changes: 1 addition & 10 deletions .github/workflows/build_wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,20 +93,10 @@ jobs:
if: runner.os == 'Windows'
uses: microsoft/setup-msbuild@v2

- name: Setup ninja on Windows
if: runner.os == 'Windows'
uses: ashutoshvarma/[email protected]

- name: Enable developer command prompt
if: runner.os == 'Windows'
uses: ilammy/msvc-dev-cmd@v1

- name: install pkgconfig on windows
if: runner.os == 'Windows'
shell: bash
run: |
choco install pkgconfiglite
- name: Install build deps on MacOs
if: runner.os == 'macOs'
run: brew install autoconf automake libtool m4 ninja
Expand All @@ -117,6 +107,7 @@ jobs:
MACOSX_DEPLOYMENT_TARGET: 11.0.0
GITHUB_TOK: "${{ secrets.GITHUB_TOKEN }}"
CMAKE_GENERATOR: "Ninja"
CMAKE_TOOLCHAIN_FILE: ${{ github.workspace }}/tools/vcpkg/scripts/buildsystems/vcpkg.cmake

- uses: actions/upload-artifact@v4
with:
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,11 @@ jobs:
if: runner.os == 'Windows'
uses: ilammy/msvc-dev-cmd@v1

- name: install pkgconfig on windows
if: runner.os == 'Windows'
shell: bash
run: |
choco install pkgconfiglite
# - name: install pkgconfig on windows
# if: runner.os == 'Windows'
# shell: bash
# run: |
# choco install pkgconfiglite

- name: install autoconf on macos
if: runner.os == 'macOs'
Expand All @@ -117,7 +117,7 @@ jobs:
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
run: |
cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DROUGHPY_BUILD_TESTS=ON -DROUGHPY_BUILD_PYMODULE_INPLACE=ON
cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DROUGHPY_BUILD_TESTS=ON
env:
CMAKE_TOOLCHAIN_FILE: ${{ github.workspace }}/tools/vcpkg/scripts/buildsystems/vcpkg.cmake
MACOSX_DEPLOYMENT_TARGET: 11.0.0
Expand Down
3 changes: 0 additions & 3 deletions platform/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,6 @@ target_link_libraries(RoughPy_Platform PUBLIC

set_target_properties(RoughPy_Platform PROPERTIES ROUGHPY_COMPONENT Platform)

if (APPLE)
target_compile_definitions(RoughPy_Platform PUBLIC BOOST_STACKTRACE_GNU_SOURCE_NOT_REQUIRED)
endif()


set_library_version_properties(RoughPy_Platform)
Expand Down
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,6 @@ test-command = [
"pytest {project}/tests"
]
before-all = "bash tools/ci/before-all-common.sh"
environment= "CMAKE_TOOLCHAIN_FILE=./vcpkg/scripts/buildsystems/vcpkg.cmake VCPKG_OVERLAY_TRIPLETS=./tools/ci/triplets"

[tool.cibuildwheel.windows]
before-build = "pip install delvewheel"
Expand Down
4 changes: 4 additions & 0 deletions tools/ci/before-all-common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@
# USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#

echo $OSTYPE
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
yum install -y curl zip unzip tar
fi


git clone https://github.com/Microsoft/vcpkg.git tools/vcpkg
Expand Down

0 comments on commit 846dfb7

Please sign in to comment.