From 692156bc4e0711452d90340f4c3d6ae797d64c37 Mon Sep 17 00:00:00 2001 From: Benoit Bovy Date: Tue, 3 Sep 2024 15:20:52 +0200 Subject: [PATCH] ci release: activate windows builds --- .github/workflows/release.yml | 16 +++--- ci/install_3rdparty.cmd | 105 ++++++++++++++++++++++++++++++++++ 2 files changed, 113 insertions(+), 8 deletions(-) create mode 100755 ci/install_3rdparty.cmd diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ca71dbf..c12e1e9 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -49,12 +49,12 @@ jobs: include: - os: ubuntu-latest arch: x86_64 - # - os: windows-2019 - # arch: x86 - # msvc_arch: x86 - # - os: windows-2019 - # arch: AMD64 - # msvc_arch: x64 + - os: windows-2019 + arch: x86 + msvc_arch: x86 + - os: windows-2019 + arch: AMD64 + msvc_arch: x64 - os: macos-13 arch: x86_64 cmake_osx_architectures: x86_64 @@ -113,10 +113,10 @@ jobs: CXX_STANDARD=${{ env.CXX_STANDARD }} CIBW_BEFORE_ALL: ./ci/install_3rdparty.sh CIBW_BEFORE_ALL_WINDOWS: ci\install_3rdparty.cmd - # CIBW_BEFORE_BUILD_WINDOWS: pip install delvewheel + CIBW_BEFORE_BUILD_WINDOWS: pip install delvewheel CIBW_REPAIR_WHEEL_COMMAND_LINUX: 'LD_LIBRARY_PATH=/host${{ runner.temp }}/3rd-party/dist/lib64 auditwheel repair -w {dest_dir} {wheel}' CIBW_REPAIR_WHEEL_COMMAND_MACOS: 'DYLD_LIBRARY_PATH=${{ runner.temp }}/3rd-party/dist/lib delocate-wheel --require-archs=${{ matrix.arch }} -w {dest_dir} -v {wheel}' - # CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: delvewheel repair --add-path ${{ runner.temp }}\geos-${{ env.GEOS_VERSION }}\bin -w {dest_dir} {wheel} + CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: 'delvewheel repair --add-path ${{ runner.temp }}\3rd-party\dist\bin -w {dest_dir} {wheel}' CIBW_TEST_REQUIRES: pytest CIBW_TEST_COMMAND: pytest {project}/tests diff --git a/ci/install_3rdparty.cmd b/ci/install_3rdparty.cmd new file mode 100755 index 0000000..cda1041 --- /dev/null +++ b/ci/install_3rdparty.cmd @@ -0,0 +1,105 @@ +:: Build and install absl, s2 and s2geography on posix systems. +:: +:: This script requires environment variables to be set +:: - DEPENDENCIES_DIR=/path/to/cached/prefix -- to build or use as cache +:: - ABSL_VERSION +:: - S2GEOMETRY_VERSION +:: - S2GEOGRAPHY_VERSION +:: - CXX_STANDARD +:: +:: This script assumes that library sources have been downloaded or copied in +:: DEPENDENCIES_DIR (e.g., %DEPENDENCIES_DIR%/absl-src-%ABSL_VERSION%). + +set SRC_DIR=%DEPENDENCIES_DIR%\src +set BUILD_DIR=%DEPENDENCIES_DIR%\build +set INSTALL_DIR=%DEPENDENCIES_DIR%\dist + +if exist %INSTALL_DIR%\include\s2geography ( + echo Using cached install directory %INSTALL_DIR% + exit /B 0 +) + +mkdir %SRC_DIR% +mkdir %BUILD_DIR% +mkdir %INSTALL_DIR% + +set ABSL_SRC_DIR=%DEPENDENCIES_DIR%\absl-src-%ABSL_VERSION% +set S2GEOMETRY_SRC_DIR=%DEPENDENCIES_DIR%\s2geometry-src-%S2GEOMETRY_VERSION% +set S2GEOGRAPHY_SRC_DIR=%DEPENDENCIES_DIR%\s2geography-src-%S2GEOGRAPHY_VERSION% + +set ABSL_BUILD_DIR=%BUILD_DIR%\absl-src-%ABSL_VERSION% +set S2GEOMETRY_BUILD_DIR=%BUILD_DIR%\s2geometry-src-%S2GEOMETRY_VERSION% +set S2GEOGRAPHY_BUILD_DIR=%BUILD_DIR%\s2geography-src-%S2GEOGRAPHY_VERSION% + +echo "----- Installing cmake" +pip install ninja cmake + +echo "----- Downloading, building and installing absl-%ABSL_VERSION%" + +cd %DEPENDENCIES_DIR% +curl -o absl.tar.gz -L https://github.com/abseil/abseil-cpp/archive/refs/tags/%ABSL_VERSION%.tar.gz +tar -xf absl.tar.gz -C %SRC_DIR% + +cmake -GNinja ^ + -S %SRC_DIR%/abseil-cpp-%ABSL_VERSION% ^ + -B %ABSL_BUILD_DIR% ^ + -DCMAKE_INSTALL_PREFIX=%INSTALL_DIR% ^ + -DCMAKE_POSITION_INDEPENDENT_CODE=ON ^ + -DCMAKE_CXX_STANDARD=%CXX_STANDARD% ^ + -DCMAKE_BUILD_TYPE=Release ^ + -DABSL_ENABLE_INSTALL=ON + +IF %ERRORLEVEL% NEQ 0 exit /B 1 +cmake --build %ABSL_BUILD_DIR% +IF %ERRORLEVEL% NEQ 0 exit /B 2 +cmake --install %ABSL_BUILD_DIR% + +echo "----- Downloading, building and installing s2geometry-%S2GEOMETRY_VERSION%" + +cd %DEPENDENCIES_DIR% +curl -o s2geometry.tar.gz -L https://github.com/google/s2geometry/archive/refs/tags/v%S2GEOMETRY_VERSION%.tar.gz +tar -xf s2geometry.tar.gz -C %SRC_DIR% + +cmake -GNinja ^ + -S %SRC_DIR%/s2geometry-%S2GEOMETRY_VERSION% ^ + -B %S2GEOMETRY_BUILD_DIR% ^ + -DCMAKE_INSTALL_PREFIX=%INSTALL_DIR% ^ + -DBUILD_TESTS=OFF ^ + -DBUILD_EXAMPLES=OFF ^ + -UGOOGLETEST_ROOT ^ + -DCMAKE_CXX_STANDARD=%CXX_STANDARD% ^ + -DCMAKE_BUILD_TYPE=Release ^ + -DCMAKE_WINDOWS_EXPORT_ALL_SYMBOLS=TRUE ^ + -DBUILD_SHARED_LIBS=ON + +IF %ERRORLEVEL% NEQ 0 exit /B 3 +cmake --build %S2GEOMETRY_BUILD_DIR% +IF %ERRORLEVEL% NEQ 0 exit /B 4 +cmake --install %S2GEOMETRY_BUILD_DIR% + +echo "----- Downloading, building and installing s2geography-%S2GEOGRAPHY_VERSION%" + +cd %DEPENDENCIES_DIR% +curl -o s2geography.tar.gz -L https://github.com/paleolimbot/s2geography/archive/refs/tags/%S2GEOGRAPHY_VERSION%.tar.gz +tar -xf s2geography.tar.gz -C %SRC_DIR% + +# TODO: remove when fixed in s2geography +cd %SRC_DIR%/s2geography-%S2GEOGRAPHY_VERSION% +patch -p1 < %PROJECT_DIR%\ci\s2geography-add-openssl-as-requirement.patch + +cmake -GNinja ^ + -S %SRC_DIR%/s2geography-%S2GEOGRAPHY_VERSION% ^ + -B %S2GEOGRAPHY_BUILD_DIR% ^ + -DCMAKE_INSTALL_PREFIX=%INSTALL_DIR% ^ + -DS2GEOGRAPHY_BUILD_TESTS=OFF ^ + -DS2GEOGRAPHY_S2_SOURCE=AUTO ^ + -DS2GEOGRAPHY_BUILD_EXAMPLES=OFF ^ + -DCMAKE_CXX_STANDARD=%CXX_STANDARD% ^ + -DCMAKE_BUILD_TYPE=Release ^ + -DCMAKE_WINDOWS_EXPORT_ALL_SYMBOLS=TRUE ^ + -DBUILD_SHARED_LIBS=ON + +IF %ERRORLEVEL% NEQ 0 exit /B 5 +cmake --build %S2GEOGRAPHY_BUILD_DIR% +IF %ERRORLEVEL% NEQ 0 exit /B 6 +cmake --install %S2GEOGRAPHY_BUILD_DIR%