-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CI release: activate windows builds (#45)
* ci release: activate windows builds * try fix openssl not found on windows * cache openssl build and fix vcpkg dir not found? * disable windows x86 arch * openssl install dir was not right yet * change openssl vcpkg triplet * change triplet again (release, dynamic library) * more log * wrong triplet * trying to understand how vcpkg works * debug prints * next try figuring out vcpkg dir tree * install s2geometry openssl abseil with vcpkg * Try forcing msvc toolchain on windows For some reason GNU (mingw) compilers are used to compile s2geography, and s2geography's cmake script only adds math defines for s2geometry transitive headers if msvc is used. * find s2geography library (cmake prefix path) * fix cmake prefix path * don't know why cmake doesn't find s2geography * typo * weird char escape * patch s2geography (add include dir for target) This hopefully fixes s2geography main header file not found when building spherely windows wheels. * patch files were actually not found * windows weird path char escape again? * right patch path this time? * repair wheel: missing path to vcpkg installed libs? * nit header comment * clean-up And test s2geography install cache on Windows.
- Loading branch information
Showing
4 changed files
with
160 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -49,12 +49,9 @@ 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: AMD64 | ||
msvc_arch: x64 | ||
- os: macos-13 | ||
arch: x86_64 | ||
cmake_osx_architectures: x86_64 | ||
|
@@ -82,6 +79,30 @@ jobs: | |
ls -all . | ||
shell: bash | ||
|
||
# for some reason mingw is selected by cmake within cibuildwheel before_all | ||
- name: Prepare compiler environment for Windows | ||
if: runner.os == 'Windows' | ||
uses: ilammy/msvc-dev-cmd@v1 | ||
with: | ||
arch: x64 | ||
|
||
- name: Cache vcpkg install directory (Windows) | ||
if: runner.os == 'Windows' | ||
uses: actions/cache@v4 | ||
with: | ||
path: "c:\\vcpkg\\installed" | ||
key: vcpkg-${{ runner.os }} | ||
|
||
- name: Install abseil openssl and s2geometry (Windows) | ||
if: runner.os == 'Windows' | ||
shell: bash | ||
run: | | ||
vcpkg install s2geometry:x64-windows --x-install-root=$VCPKG_INSTALLATION_ROOT/installed | ||
vcpkg list | ||
ls /c/vcpkg/installed | ||
ls /c/vcpkg/installed/x64-windows | ||
ls /c/vcpkg/installed/x64-windows/bin | ||
- name: Build wheels | ||
uses: pypa/[email protected] | ||
env: | ||
|
@@ -107,16 +128,18 @@ jobs: | |
CMAKE_OSX_ARCHITECTURES='${{ matrix.cmake_osx_architectures }}' | ||
CIBW_ENVIRONMENT_WINDOWS: | ||
DEPENDENCIES_DIR='${{ runner.temp }}\3rd-party' | ||
CMAKE_PREFIX_PATH='c:\vcpkg\installed\x64-windows;${{ runner.temp }}\3rd-party\dist' | ||
ABSL_VERSION=${{ env.ABSL_VERSION }} | ||
S2GEOMETRY_VERSION=${{ env.S2GEOMETRY_VERSION }} | ||
S2GEOGRAPHY_VERSION=${{ env.S2GEOGRAPHY_VERSION }} | ||
CXX_STANDARD=${{ env.CXX_STANDARD }} | ||
PROJECT_DIR='${{ runner.workspace }}\spherely' | ||
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 --add-path c:\vcpkg\installed\x64-windows\bin -w {dest_dir} {wheel}' | ||
CIBW_TEST_REQUIRES: pytest | ||
CIBW_TEST_COMMAND: pytest {project}/tests | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
:: Build and install absl, s2 and s2geography on Windows. | ||
:: | ||
:: 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% | ||
|
||
rem set ABSL_SRC_DIR=%DEPENDENCIES_DIR%\absl-src-%ABSL_VERSION% | ||
rem set S2GEOMETRY_SRC_DIR=%DEPENDENCIES_DIR%\s2geometry-src-%S2GEOMETRY_VERSION% | ||
set S2GEOGRAPHY_SRC_DIR=%DEPENDENCIES_DIR%\s2geography-src-%S2GEOGRAPHY_VERSION% | ||
|
||
rem set ABSL_BUILD_DIR=%BUILD_DIR%\absl-src-%ABSL_VERSION% | ||
rem set S2GEOMETRY_BUILD_DIR=%BUILD_DIR%\s2geometry-src-%S2GEOMETRY_VERSION% | ||
set S2GEOGRAPHY_BUILD_DIR=%BUILD_DIR%\s2geography-src-%S2GEOGRAPHY_VERSION% | ||
|
||
echo %CMAKE_PREFIX_PATH% | ||
|
||
echo "----- Installing cmake" | ||
pip install ninja cmake | ||
|
||
rem echo "----- Downloading, building and installing absl-%ABSL_VERSION%" | ||
|
||
rem cd %DEPENDENCIES_DIR% | ||
rem curl -o absl.tar.gz -L https://github.com/abseil/abseil-cpp/archive/refs/tags/%ABSL_VERSION%.tar.gz | ||
rem tar -xf absl.tar.gz -C %SRC_DIR% | ||
|
||
rem cmake -GNinja ^ | ||
rem -S %SRC_DIR%/abseil-cpp-%ABSL_VERSION% ^ | ||
rem -B %ABSL_BUILD_DIR% ^ | ||
rem -DCMAKE_INSTALL_PREFIX=%INSTALL_DIR% ^ | ||
rem -DCMAKE_POSITION_INDEPENDENT_CODE=ON ^ | ||
rem -DCMAKE_CXX_STANDARD=%CXX_STANDARD% ^ | ||
rem -DCMAKE_BUILD_TYPE=Release ^ | ||
rem -DABSL_ENABLE_INSTALL=ON | ||
|
||
rem IF %ERRORLEVEL% NEQ 0 exit /B 1 | ||
rem cmake --build %ABSL_BUILD_DIR% | ||
rem IF %ERRORLEVEL% NEQ 0 exit /B 2 | ||
rem cmake --install %ABSL_BUILD_DIR% | ||
|
||
rem echo "----- Downloading, building and installing s2geometry-%S2GEOMETRY_VERSION%" | ||
|
||
rem echo %OPENSSL_ROOT_DIR% | ||
|
||
rem cd %DEPENDENCIES_DIR% | ||
rem curl -o s2geometry.tar.gz -L https://github.com/google/s2geometry/archive/refs/tags/v%S2GEOMETRY_VERSION%.tar.gz | ||
rem tar -xf s2geometry.tar.gz -C %SRC_DIR% | ||
|
||
rem cmake -GNinja ^ | ||
rem -S %SRC_DIR%/s2geometry-%S2GEOMETRY_VERSION% ^ | ||
rem -B %S2GEOMETRY_BUILD_DIR% ^ | ||
rem -DCMAKE_INSTALL_PREFIX=%INSTALL_DIR% ^ | ||
rem -DOPENSSL_ROOT_DIR=%OPENSSL_ROOT_DIR% ^ | ||
rem -DBUILD_TESTS=OFF ^ | ||
rem -DBUILD_EXAMPLES=OFF ^ | ||
rem -UGOOGLETEST_ROOT ^ | ||
rem -DCMAKE_CXX_STANDARD=%CXX_STANDARD% ^ | ||
rem -DCMAKE_BUILD_TYPE=Release ^ | ||
rem -DCMAKE_WINDOWS_EXPORT_ALL_SYMBOLS=TRUE ^ | ||
rem -DBUILD_SHARED_LIBS=ON | ||
|
||
rem IF %ERRORLEVEL% NEQ 0 exit /B 3 | ||
rem cmake --build %S2GEOMETRY_BUILD_DIR% | ||
rem IF %ERRORLEVEL% NEQ 0 exit /B 4 | ||
rem 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% | ||
|
||
rem TODO: remove when fixed in s2geography | ||
cd %SRC_DIR%/s2geography-%S2GEOGRAPHY_VERSION% | ||
patch -i %PROJECT_DIR%\ci\s2geography-add-openssl-as-requirement.patch | ||
patch -i %PROJECT_DIR%\ci\s2geography-add-include-dir.patch | ||
|
||
cmake -GNinja ^ | ||
-S %SRC_DIR%/s2geography-%S2GEOGRAPHY_VERSION% ^ | ||
-B %S2GEOGRAPHY_BUILD_DIR% ^ | ||
-DCMAKE_INSTALL_PREFIX=%INSTALL_DIR% ^ | ||
-DOPENSSL_ROOT_DIR=%OPENSSL_ROOT_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% |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
diff --git a/CMakeLists.txt b/CMakeLists.txt | ||
index d0d5e56..a520a1f 100644 | ||
--- a/CMakeLists.txt | ||
+++ b/CMakeLists.txt | ||
@@ -212,6 +212,10 @@ add_library(s2geography | ||
set_target_properties(s2geography PROPERTIES | ||
POSITION_INDEPENDENT_CODE ${BUILD_SHARED_LIBS}) | ||
|
||
+target_include_directories(s2geography PUBLIC | ||
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src> | ||
+ $<INSTALL_INTERFACE:include>) | ||
+ | ||
target_compile_definitions( | ||
s2geography | ||
PUBLIC |