From 846dfb73b66001b91ec94eac3bf2ce0bcbd61700 Mon Sep 17 00:00:00 2001 From: Sam Morley <41870650+inakleinbottle@users.noreply.github.com> Date: Wed, 18 Dec 2024 13:01:55 +0000 Subject: [PATCH] Fix build wheel action (#191) * 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. --- .github/workflows/build_wheels.yml | 11 +---------- .github/workflows/tests.yml | 12 ++++++------ platform/CMakeLists.txt | 3 --- pyproject.toml | 1 - tools/ci/before-all-common.sh | 4 ++++ 5 files changed, 11 insertions(+), 20 deletions(-) diff --git a/.github/workflows/build_wheels.yml b/.github/workflows/build_wheels.yml index 0b587263c..8dd6229ce 100644 --- a/.github/workflows/build_wheels.yml +++ b/.github/workflows/build_wheels.yml @@ -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/setup-ninja@v1.1 - - 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 @@ -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: diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 7c4156415..77660a45f 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -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' @@ -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 diff --git a/platform/CMakeLists.txt b/platform/CMakeLists.txt index bf1fbb8b9..05e95c354 100644 --- a/platform/CMakeLists.txt +++ b/platform/CMakeLists.txt @@ -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) diff --git a/pyproject.toml b/pyproject.toml index 841e01f92..caca2b3ef 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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" diff --git a/tools/ci/before-all-common.sh b/tools/ci/before-all-common.sh index e49acdd92..23a383033 100644 --- a/tools/ci/before-all-common.sh +++ b/tools/ci/before-all-common.sh @@ -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