Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
20 changes: 20 additions & 0 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -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
(
Expand All @@ -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\
Expand Down