diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index a88a1d89..5d2e2a8f 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -122,23 +122,28 @@ jobs: uses: ilammy/msvc-dev-cmd@v1 - name: Install cibuildwheel - run: python -m pip install cibuildwheel==2.16.2 setuptools + run: python -m pip install cibuildwheel==2.16.2 setuptools toml - name: Get package name and version (Linux / Mac) if: ${{ ! startsWith(matrix.os, 'windows-') }} run: | - echo PACKAGE_NAME=$( python setup.py --name ) >> $GITHUB_ENV - echo PACKAGE_VERSION=$( python setup.py --version ) >> $GITHUB_ENV + echo "PACKAGE_NAME=$( python -c "import toml; print(toml.load('pyproject.toml')['project']['name'])" )" >> $GITHUB_ENV + echo "PACKAGE_VERSION=$( python -c "import toml; print(toml.load('pyproject.toml')['project']['version'])" )" >> $GITHUB_ENV # Some shells require "-Encoding utf8" to append to GITHUB_ENV # https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions?tool=powershell#environment-files - name: Get package name and version (Windows) if: startsWith(matrix.os, 'windows-') run: | - echo "PACKAGE_NAME=$( python setup.py --name )" | Out-File -FilePath $env:GITHUB_ENV ` - -Append - echo "PACKAGE_VERSION=$( python setup.py --version )" | Out-File -FilePath $env:GITHUB_ENV ` - -Append + echo "PACKAGE_NAME=$( python -c "import toml; print(toml.load('pyproject.toml')['project']['name'])" )" | Out-File -FilePath $env:GITHUB_ENV ` -Append + echo "PACKAGE_VERSION=$( python -c "import toml; print(toml.load('pyproject.toml')['project']['version'])" )" | Out-File -FilePath $env:GITHUB_ENV ` -Append + + - name: Determine macOS version + if: startsWith(matrix.os, 'macos-') + run: | + macos_version=$(sw_vers -productVersion | awk -F '.' '{print $1".0"}') + echo "MACOSX_DEPLOYMENT_TARGET=${macos_version}" >> $GITHUB_ENV + - name: Build wheels env: CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014 @@ -158,6 +163,10 @@ jobs: python -m pip install cmake ninja setuptools CIBW_ARCHS_MACOS: ${{ matrix.arch }} + + CIBW_ENVIRONMENT_MACOS: | + CMAKE_OSX_ARCHITECTURES=${{ matrix.arch }} CMAKE_PREFIX_PATH=/usr/local + CIBW_BEFORE_ALL_MACOS: | python -m pip install cmake ninja setuptools brew update @@ -165,9 +174,6 @@ jobs: HOMEBREW_NO_AUTO_UPDATE=1 brew install libpng fi - CIBW_ENVIRONMENT_MACOS: | - CMAKE_OSX_ARCHITECTURES=${{ matrix.arch }} CMAKE_PREFIX_PATH=/usr/local - run: python -m cibuildwheel --output-dir wheelhouse/cp${{ matrix.cibw_python }}-${{matrix.platform_id }} - name: Install and test (Linux / Mac) diff --git a/CMakeLists.txt b/CMakeLists.txt index bb126617..6fe09822 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,8 +6,7 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) # Try to import all Python components potentially needed by nanobind find_package(Python 3.8 - REQUIRED COMPONENTS Interpreter Development.Module - OPTIONAL_COMPONENTS Development.SABIModule) + REQUIRED COMPONENTS Interpreter Development.Module) # Import nanobind through CMake's find_package mechanism find_package(nanobind CONFIG REQUIRED) @@ -43,7 +42,6 @@ target_link_libraries(imageMathUtilities ${ITK_LIBRARIES}) nanobind_add_module( lib - STABLE_ABI NB_STATIC src/main.cpp src/antscore/antsAffineInitializer.cxx diff --git a/pyproject.toml b/pyproject.toml index ca46341a..87498864 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -54,9 +54,3 @@ build-verbosity = 1 test-command = "pytest {project}/tests" test-requires = "pytest" -# Don't test Python 3.8 wheels on macOS/arm64 -test-skip="cp38-macosx_*:arm64" - -# Needed for full C++17 support -[tool.cibuildwheel.macos.environment] -MACOSX_DEPLOYMENT_TARGET = "10.14"