Skip to content

Commit

Permalink
ci release: activate windows builds
Browse files Browse the repository at this point in the history
  • Loading branch information
benbovy committed Sep 3, 2024
1 parent 64d14e0 commit 692156b
Show file tree
Hide file tree
Showing 2 changed files with 113 additions and 8 deletions.
16 changes: 8 additions & 8 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down
105 changes: 105 additions & 0 deletions ci/install_3rdparty.cmd
Original file line number Diff line number Diff line change
@@ -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%

0 comments on commit 692156b

Please sign in to comment.