-
Notifications
You must be signed in to change notification settings - Fork 312
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
attempt to use cibuildwheel to build library port
- Loading branch information
1 parent
0c173d8
commit 0d9a024
Showing
3 changed files
with
99 additions
and
39 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 |
---|---|---|
|
@@ -39,3 +39,19 @@ jobs: | |
working-directory: build/ | ||
- run: sudo cmake --build . --parallel --target=install | ||
working-directory: build/ | ||
cibuildwheel: | ||
strategy: | ||
matrix: | ||
# macos-13 is an intel runner, macos-14 is apple silicon | ||
os: | ||
- ubuntu-latest | ||
- macos-13 | ||
- macos-latest | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | ||
- uses: pypa/[email protected] | ||
- uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0 | ||
with: | ||
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }} | ||
path: ./wheelhouse/*.whl |
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 |
---|---|---|
|
@@ -2,25 +2,23 @@ | |
name = "s2geometry" | ||
description = "Computational geometry and spatial indexing on the sphere" | ||
authors = [ | ||
{ name = "Dan Larkin-York", email = "[email protected]" }, | ||
{ name = "Eric Veach", email = "[email protected]" }, | ||
{ name = "Jesse Rosenstock", email = "[email protected]" }, | ||
{ name = "Julien Basch", email = "[email protected]" }, | ||
{ name = "Mike Playle", email = "[email protected]" }, | ||
{ name = "Phil Elson", email = "[email protected]" }, | ||
{ name = "Robert Coup", email = "[email protected]" }, | ||
{ name = "Tiago Brito", email = "[email protected]" }, | ||
{ name = "Zachary Burnett", email = "[email protected]" }, | ||
{ name = "Dan Larkin-York", email = "[email protected]" }, | ||
{ name = "Eric Veach", email = "[email protected]" }, | ||
{ name = "Jesse Rosenstock", email = "[email protected]" }, | ||
{ name = "Julien Basch", email = "[email protected]" }, | ||
{ name = "Mike Playle", email = "[email protected]" }, | ||
{ name = "Phil Elson", email = "[email protected]" }, | ||
{ name = "Robert Coup", email = "[email protected]" }, | ||
{ name = "Tiago Brito", email = "[email protected]" }, | ||
{ name = "Zachary Burnett", email = "[email protected]" }, | ||
] | ||
requires-python = ">=3.7" | ||
classifiers = [ | ||
"Programming Language :: Python :: 3", | ||
"Operating System :: POSIX", | ||
"License :: OSI Approved :: Apache Software License", | ||
] | ||
dynamic = [ | ||
"version", | ||
"Programming Language :: Python :: 3", | ||
"Operating System :: POSIX", | ||
"License :: OSI Approved :: Apache Software License", | ||
] | ||
dynamic = ["version"] | ||
|
||
[project.license] | ||
file = "LICENSE" | ||
|
@@ -30,16 +28,15 @@ content-type = "text/plain" | |
Source = "https://github.com/google/s2geometry" | ||
|
||
[project.optional-dependencies] | ||
test = [ | ||
"pytest", | ||
] | ||
test = ["pytest"] | ||
|
||
[build-system] | ||
requires = [ | ||
"wheel", | ||
"setuptools", | ||
"setuptools_scm[toml]", | ||
"cmake_build_extension", | ||
"wheel", | ||
"setuptools", | ||
"setuptools_scm[toml]", | ||
"cmake_build_extension", | ||
"swig", | ||
] | ||
build-backend = "setuptools.build_meta" | ||
|
||
|
@@ -48,11 +45,53 @@ zip-safe = false | |
include-package-data = false | ||
|
||
[tool.setuptools.packages.find] | ||
where = [ | ||
"src", | ||
] | ||
where = ["src"] | ||
namespaces = false | ||
|
||
[tool.setuptools.package-dir] | ||
"" = "src" | ||
|
||
[tool.cibuildwheel] | ||
# manylinux-x86_64-image = "quay.io/pypa/manylinux2014_x86_64" | ||
build-frontend = "build[uv]" | ||
build = "cp3*-manylinux_x86_64 cp3*-macosx_x86_64 cp3*-macosx_arm64" | ||
# test-requires = "pytest" | ||
# test-command = "pytest {project}/src/python/" | ||
|
||
[tool.cibuildwheel.environment] | ||
MACOSX_DEPLOYMENT_TARGET = 14.0 | ||
|
||
[tool.cibuildwheel.linux] | ||
# repair-wheel-command = "" | ||
# the EPEL9 package `abseil-cpp` is out of date, so we have to build `abseil-cpp` from source | ||
before-all = """ | ||
yum install -y gflags-devel glog-devel gtest-devel openssl-devel | ||
git clone https://github.com/abseil/abseil-cpp.git && cd ./abseil-cpp | ||
git checkout 20240116.2 | ||
mkdir ./build && cd ./build | ||
cmake -DCMAKE_CXX_STANDARD=17 -DABSL_PROPAGATE_CXX_STD=ON -DABSL_ENABLE_INSTALL=ON -DBUILD_TESTING=off .. | ||
cmake --build . --parallel --target=install | ||
""" | ||
|
||
[tool.cibuildwheel.macos] | ||
before-all = """ | ||
git clone https://github.com/gflags/gflags.git && cd ./gflags | ||
mkdir ./build && cd ./build | ||
cmake .. -DBUILD_SHARED_LIBS=OFF -DBUILD_TESTING=OFF | ||
cmake --build . --parallel --target install | ||
cd ../../ | ||
git clone https://github.com/google/glog.git && cd ./glog | ||
cmake -S . -B ./build && cd ./build | ||
cmake --build . --parallel --target install | ||
cd ../../ | ||
git clone https://github.com/openssl/openssl.git && cd ./openssl | ||
mkdir ./build && cd ./build | ||
../Configure install | ||
cmake --build . --parallel --target install | ||
cd ../../ | ||
git clone https://github.com/abseil/abseil-cpp.git && cd ./abseil-cpp | ||
git checkout 20240116.2 | ||
mkdir ./build && cd ./build | ||
cmake -DCMAKE_CXX_STANDARD=17 -DABSL_PROPAGATE_CXX_STD=ON -DABSL_ENABLE_INSTALL=ON -DBUILD_TESTING=off .. | ||
cmake --build . --parallel --target=install | ||
""" |
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 |
---|---|---|
@@ -1,33 +1,38 @@ | ||
import os | ||
import sys | ||
from pathlib import Path | ||
|
||
import cmake_build_extension | ||
import setuptools | ||
|
||
# Extra options passed to the CI/CD pipeline that uses cibuildwheel | ||
CIBW_CMAKE_OPTIONS = [] | ||
if "CIBUILDWHEEL" in os.environ and os.environ["CIBUILDWHEEL"] == "1": | ||
# The manylinux variant runs in Debian Stretch and it uses lib64 folder | ||
if sys.platform == "linux": | ||
CIBW_CMAKE_OPTIONS += ["-DCMAKE_INSTALL_LIBDIR=lib"] | ||
|
||
setuptools.setup( | ||
ext_modules=[ | ||
cmake_build_extension.CMakeExtension( | ||
# This could be anything you like, it is used to create build folders | ||
name="SwigBindings", | ||
# Name of the resulting package name (import s2geometry) | ||
name="s2geometry", | ||
install_prefix="s2geometry", | ||
# Selects the folder where the main CMakeLists.txt is stored | ||
# (it could be a subfolder) | ||
source_dir=str(Path(__file__).parent.absolute()), | ||
cmake_configure_options=[ | ||
# This option points CMake to the right Python interpreter, and helps | ||
# the logic of FindPython3.cmake to find the active version | ||
f"-DPython3_ROOT_DIR={Path(sys.prefix)}", | ||
'-DCALL_FROM_SETUP_PY:BOOL=ON', | ||
'-DBUILD_SHARED_LIBS:BOOL=OFF', | ||
'-DCMAKE_POSITION_INDEPENDENT_CODE=ON', | ||
'-DWITH_PYTHON=ON' | ||
] | ||
# This option points CMake to the right Python interpreter, and helps | ||
# the logic of FindPython3.cmake to find the active version | ||
# f"-DPython3_ROOT_DIR={Path(sys.prefix)}", | ||
"-DCALL_FROM_SETUP_PY:BOOL=ON", | ||
"-DBUILD_SHARED_LIBS:BOOL=OFF", | ||
"-DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=ON", | ||
"-DWITH_PYTHON:BOOL=ON", | ||
"-DBUILD_TESTS:BOOL=OFF", | ||
] | ||
+ CIBW_CMAKE_OPTIONS, | ||
) | ||
], | ||
cmdclass=dict( | ||
# Enable the CMakeExtension entries defined above | ||
build_ext=cmake_build_extension.BuildExtension, | ||
sdist=cmake_build_extension.GitSdistFolder, | ||
), | ||
) |