From a5730ffb521173b6fc97c10a6b34a0f7687115c0 Mon Sep 17 00:00:00 2001 From: Ziv Yaniv Date: Thu, 2 Jul 2026 16:00:58 -0400 Subject: [PATCH 1/2] Update CircleCI to retain the built artifacts. Retain the built artifacts in CircleCI. Useful for debugging and possibly manual upload as GitHub release assets. The latter can be done automatically but requires a GitHub Personal Access Token to be set in CircleCI and that requires bot account on the SimpleITK organization and we want to avoid that for now. --- .circleci/config.yml | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index abfb41e..c50734d 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -92,8 +92,27 @@ jobs: no_output_timeout: 30m command: | set -x - R -e "Sys.setenv(MAKEJ=3); remotes::install_git(c('.'), lib=c('${R_LIBS}'))" + R -e "Sys.setenv(MAKEJ=3); remotes::install_git(c('.'), lib=c('${R_LIBS}'), upgrade='never', INSTALL_opts='--build')" R -e "library(SimpleITK); Version()" + - run: + name: Rename package + command: | + # package naming is SimpleITK_${PKG_VERSION}_R${R_VERSION_SHORT}_${OS_ARCHIVE_EXT} + R_VERSION_SHORT=$(echo "<< parameters.r-version >>" | cut -d'.' -f1,2) + PKG_VERSION=$(Rscript -e "cat(read.dcf('DESCRIPTION', 'Version')[1])") + + # canonical approach to collecting build artifacts in a directory for upload + mkdir -p artifacts + + # Find the built package and rename according to the naming convention + BUILT_PKG=$(ls SimpleITK_*.tgz | head -1) + PKG_NAME="SimpleITK_${PKG_VERSION}_R${R_VERSION_SHORT}_macos-arm64.tgz" + mv "$BUILT_PKG" "artifacts/$PKG_NAME" + + ls -lh artifacts/ + - store_artifacts: + path: artifacts + destination: . workflows: r-build-test: # Runs on: push to main, pull requests to main, manual trigger, and scheduled runs From 7b3cec0bcecfecc3bc73b18824fba1d23a5573c3 Mon Sep 17 00:00:00 2001 From: Ziv Yaniv Date: Mon, 6 Jul 2026 09:55:19 -0400 Subject: [PATCH 2/2] Target specific macOS version via CMake. macOS is designed with forward compatibility, software compiled for older OS version should run on a newer version. To support the largest range of macOS versions, we follow the guidlines from the https://mac.r-project.org/: Starting with R 4.0.0 we are building R using standard Apple tools (Xcode) and GNU Fortran (see tools for downloads and details). We maintain following binary builds: sonoma-arm64 build supports arm64 Macs (M1+) from macOS 14 (Sonoma) and higher (since R 4.6.0) big-sur-x86_64 build supports legacy Intel Macs from macOS 11 (Big Sur) and higher (since R 4.3.0) --- configure | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/configure b/configure index 7afdfb9..5896792 100755 --- a/configure +++ b/configure @@ -37,6 +37,25 @@ if [ -z "${MAKEJ}" ] ; then export MAKEJ fi +## For MacOS, set CMAKE_OSX_DEPLOYMENT_TARGET based on architecture +## Following https://mac.r-project.org/ guidelines: +## "sonoma-arm64 build supports arm64 Macs (M1+) from macOS 14 (Sonoma) and higher (since R 4.6.0)" +## "big-sur-x86_64 build supports legacy Intel Macs from macOS 11 (Big Sur) and higher (since R 4.3.0)" +CMAKE_OSX_ARGS="" +if [ "$(uname -s)" == "Darwin" ]; then + OS_ARCH=$(uname -m) + if [ "$OS_ARCH" == "arm64" ] || [ "$OS_ARCH" == "aarch64" ]; then + # For Apple Silicon, target macOS 14 (Sonoma) + export CMAKE_OSX_DEPLOYMENT_TARGET="14.0" + elif [ "$OS_ARCH" == "x86_64" ]; then + # For Intel Macs, target macOS 11 (Big Sur) + export CMAKE_OSX_DEPLOYMENT_TARGET="11.0" + fi + if [ -n "${CMAKE_OSX_DEPLOYMENT_TARGET}" ]; then + CMAKE_OSX_ARGS="-D CMAKE_OSX_DEPLOYMENT_TARGET:STRING=${CMAKE_OSX_DEPLOYMENT_TARGET}" + fi +fi + ## All the building is going to happen in an SITK folder mkdir -p SITK ( @@ -56,6 +75,7 @@ mkdir -p SITK cmake \ -D "CMAKE_CXX_FLAGS:STRING=-fvisibility=hidden -fvisibility-inlines-hidden ${CFLAGS}" \ -D "CMAKE_C_FLAGS:STRING=-fvisibility=hidden ${CFLAGS}" \ + ${CMAKE_OSX_ARGS} \ -DITK_C_OPTIMIZATION_FLAGS:STRING="" \ -DITK_CXX_OPTIMIZATION_FLAGS:STRING="" \ -DWRAP_DEFAULT=OFF\