diff --git a/.github/workflows/wheels_faster.yml b/.github/workflows/wheels_faster.yml index 779a2fac..dc807f33 100644 --- a/.github/workflows/wheels_faster.yml +++ b/.github/workflows/wheels_faster.yml @@ -16,27 +16,27 @@ jobs: # Windows 64-bit - os: windows-latest - python: '3.11' - cibw_python: 311 + python: '3.12' + cibw_python: 312 platform_id: win_amd64 # Linux 64-bit - os: ubuntu-latest - python: '3.11' - cibw_python: 311 + python: '3.12' + cibw_python: 312 platform_id: manylinux_x86_64 # macOS on Intel 64-bit - os: macos-13 - python: '3.11' - cibw_python: 311 + python: '3.12' + cibw_python: 312 arch: x86_64 platform_id: macosx_x86_64 # macOS on Apple M1 64-bit, supported for Python 3.10 and later - os: macos-14 - python: '3.11' - cibw_python: 311 + python: '3.12' + cibw_python: 312 arch: arm64 platform_id: macosx_arm64 @@ -77,6 +77,14 @@ jobs: run: | macos_version=$(sw_vers -productVersion | awk -F '.' '{print $1".0"}') echo "MACOSX_DEPLOYMENT_TARGET=${macos_version}" >> $GITHUB_ENV + echo -n "clang version : " + clang --version + echo -n "xcode version : " + xcode-select -p + echo -n "cmake version : " + cmake --version + echo -n "env : " + env - name: Build wheels env: diff --git a/CMakeLists.txt b/CMakeLists.txt index 0ba0e0f1..a12dda6f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,6 +2,17 @@ cmake_minimum_required(VERSION 3.16.3...3.26) project(ants LANGUAGES CXX) +# Set the macOS SDK root +if (CMAKE_SYSTEM_NAME STREQUAL "Darwin") + execute_process( + COMMAND xcrun --show-sdk-path + OUTPUT_VARIABLE SDK_PATH + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + set(CMAKE_OSX_SYSROOT ${SDK_PATH}) + message(STATUS "Using macOS SDK: ${CMAKE_OSX_SYSROOT}") +endif() + set(CMAKE_POSITION_INDEPENDENT_CODE ON) # Try to import all Python components potentially needed by nanobind @@ -25,12 +36,6 @@ set(ITK_DIR "./itkbuild") find_package(ITK REQUIRED) include(${ITK_USE_FILE}) -if (CMAKE_SYSTEM_NAME STREQUAL "Darwin" AND CMAKE_SYSTEM_PROCESSOR STREQUAL "arm64") - include_directories(/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1) - set(ENV{PATH} "$ENV{PATH}:/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1") - add_compile_options(-I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1) -endif() - # ANTS add_library(antsUtilities STATIC src/antscore/antsUtilities.cxx src/antscore/antsCommandLineOption.cxx src/antscore/antsCommandLineParser.cxx src/antscore/ReadWriteData.cxx src/antscore/ANTsVersion.cxx) add_library(registrationUtilities STATIC src/antscore/antsRegistrationTemplateHeader.cxx diff --git a/scripts/configure_ITK.sh b/scripts/configure_ITK.sh index b38f8c23..d8d9a9b2 100755 --- a/scripts/configure_ITK.sh +++ b/scripts/configure_ITK.sh @@ -38,25 +38,22 @@ cd ../ echo "Dependency;GitTag" > ./data/softwareVersions.csv echo "ITK;${itktag}" >> ./data/softwareVersions.csv -# if (CMAKE_SYSTEM_NAME STREQUAL "Darwin" AND CMAKE_SYSTEM_PROCESSOR STREQUAL "arm64") -# include_directories(/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1) -## set(ENV{PATH} "$ENV{PATH}:/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1") -# add_compile_options(-I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1) -# endif() - mkdir -p itkbuild cd itkbuild compflags=" -Wno-c++11-long-long -fPIC -O2 -DNDEBUG " +osx_sysroot="" if [[ `uname` == 'Darwin' ]] ; then - compflags=" -Wno-c++11-long-long -fPIC -O2 -DNDEBUG -isystem /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1 -stdlib=libc++ " + osx_sysroot=$(xcrun --sdk macosx --show-sdk-path) fi + cmake \ -G"${ADD_G}" \ -DITK_USE_SYSTEM_PNG=ON \ -DCMAKE_SH:BOOL=OFF \ -DCMAKE_BUILD_TYPE:STRING="${CMAKE_BUILD_TYPE}" \ - -DCMAKE_C_FLAGS="${CMAKE_C_FLAGS} -Wno-c++11-long-long -fPIC -O2 -DNDEBUG "\ + -DCMAKE_OSX_SYSROOT="${osx_sysroot}" \ + -DCMAKE_C_FLAGS="${CMAKE_C_FLAGS} ${compflags}"\ -DCMAKE_CXX_FLAGS="${CMAKE_CXX_FLAGS} ${compflags} "\ -DITK_USE_GIT_PROTOCOL:BOOL=OFF \ -DBUILD_SHARED_LIBS:BOOL=OFF \