Skip to content

Commit

Permalink
Merge pull request #4519 from thewtex/macos-arm-ci
Browse files Browse the repository at this point in the history
ENH: Add macOS ARM GitHub Actions configuration
  • Loading branch information
thewtex authored Apr 11, 2024
2 parents 3dcbf20 + 99d13a4 commit 21e3edd
Show file tree
Hide file tree
Showing 12 changed files with 113 additions and 15 deletions.
86 changes: 86 additions & 0 deletions .github/workflows/macos-arm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
name: ITK.macOS.Arm64

on:
push:
branches:
- master
- 'release*'
paths-ignore:
- '*.md'
- LICENSE
- NOTICE
- 'Documentation/**'
- 'Utilities/Debugger/**'
- 'Utilities/ITKv5Preparation/**'
- 'Utilities/Maintenance/**'
pull_request:
paths-ignore:
- '*.md'
- LICENSE
- NOTICE
- 'Documentation/**'
- 'Utilities/Debugger/**'
- 'Utilities/ITKv5Preparation/**'
- 'Utilities/Maintenance/**'

env:
ExternalDataVersion: 5.3.0

jobs:
macOS:
runs-on: macos-14
timeout-minutes: 0
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 5
clean: true

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'

- name: Install dependencies
run: |
set -x
python3 -m pip install ninja
python3 -m pip install --upgrade setuptools
python3 -m pip install scikit-ci-addons
python3 -m pip install lxml
- name: Download dashboard script and testing data
run: |
set -x
git clone -b dashboard --single-branch https://github.com/InsightSoftwareConsortium/ITK.git ITK-dashboard
curl -L https://github.com/InsightSoftwareConsortium/ITK/releases/download/v${{ env.ExternalDataVersion }}/InsightData-${{ env.ExternalDataVersion }}.tar.gz -O
cmake -E tar xfz InsightData-${{ env.ExternalDataVersion }}.tar.gz
cmake -E rename InsightToolkit-${{ env.ExternalDataVersion }}/.ExternalData/MD5 ${{ github.workspace }}/.ExternalData/MD5
- name: Configure CTest script
run: |
cat > ITK-dashboard/dashboard.cmake << EOF
set(CTEST_BUILD_CONFIGURATION "Release")
set(CTEST_CMAKE_GENERATOR "Ninja")
set(dashboard_cache "
BUILD_SHARED_LIBS:BOOL=ON
BUILD_EXAMPLES:BOOL=ON
ITK_WRAP_PYTHON:BOOL=OFF
ITK_USE_CLANG_FORMAT:BOOL=OFF
")
include(${{ github.workspace }}/ITK-dashboard/github_actions_dashboard.cmake)
EOF
cat ITK-dashboard/dashboard.cmake
- name: Build and test
run: |
set -x
c++ --version
cmake --version
ctest -S ${{ github.workspace }}/ITK-dashboard/dashboard.cmake -VV -j 4
env:
CTEST_OUTPUT_ON_FAILURE: 1
21 changes: 9 additions & 12 deletions CMake/ITKClangFormatSetup.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
option(ITK_USE_CLANG_FORMAT "Enable the use of clang-format enforce ITK coding style." ${BUILD_TESTING})
mark_as_advanced(ITK_USE_CLANG_FORMAT)

if(ITK_USE_CLANG_FORMAT AND NOT EXISTS "${CLANG_FORMAT_EXECUTABLE}")
find_program(CLANG_FORMAT_EXECUTABLE NAMES clang-format-8.0 clang-format8 clang-format)
mark_as_advanced(CLANG_FORMAT_EXECUTABLE)
if(ITK_USE_CLANG_FORMAT AND NOT CLANG_FORMAT_EXECUTABLE)
# Download pre-built binaries (about 2M) of clang-format extracted from
# https://releases.llvm.org/download.html and cached on data.kitware.com
#
Expand All @@ -31,14 +33,14 @@ if(ITK_USE_CLANG_FORMAT AND NOT EXISTS "${CLANG_FORMAT_EXECUTABLE}")
# Android - Android NDK (GCC, Clang)
# CrayLinuxEnvironment - Cray supercomputers (Cray compiler)
# MSYS - Windows (MSYS2 shell native GCC)
if("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin")
if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Darwin")
set(CLANG_FORMAT_DOWNLOAD_URL "https://data.kitware.com/api/v1/file/5d274e88877dfcc902effc47/download")
elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "Windows")
elseif(CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows")
set(CLANG_FORMAT_DOWNLOAD_URL "https://data.kitware.com/api/v1/file/5d2b8775877dfcc902fd8236/download")
elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
elseif (CMAKE_HOST_SYSTEM_NAME MATCHES "Linux" AND CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "x86_64")
set(CLANG_FORMAT_DOWNLOAD_URL "https://data.kitware.com/api/v1/file/5d2b8c87877dfcc902fda594/download")
else()
message(FATAL_ERROR "UNKNOWN SYSTEM: Set CLANG_FORMAT_EXECUTABLE manually to the clang-format version 8.0 binary")
message(FATAL_ERROR "System binaries not available: set CLANG_FORMAT_EXECUTABLE to clang-format 8 or disable ITK_USE_CLANG_FORMAT.")
endif()
file(MAKE_DIRECTORY "${ITK_BINARY_DIR}/temp")
if(WIN32)
Expand All @@ -54,11 +56,6 @@ if(ITK_USE_CLANG_FORMAT AND NOT EXISTS "${CLANG_FORMAT_EXECUTABLE}")
set(CLANG_FORMAT_EXECUTABLE
"${ITK_BINARY_DIR}/${CLANG_FORMAT_EXECUTABLE_NAME}"
CACHE FILEPATH "The binary for clang-format" FORCE)
endif()
if(CLANG_FORMAT_EXECUTABLE)
mark_as_advanced(CLANG_FORMAT_EXECUTABLE)
endif()
if(ITK_USE_CLANG_FORMAT AND NOT EXISTS "${CLANG_FORMAT_EXECUTABLE}")
message(FATAL_ERROR "Missing suitable clang-format executable, set CLANG_FORMAT_EXECUTABLE variable to version 8.0")
unset(CLANG_FORMAT_EXECUTABLE)
elseif(ITK_USE_CLANG_FORMAT AND NOT CLANG_FORMAT_EXECUTABLE)
message(FATAL_ERROR "Missing suitable clang-format executable, set CLANG_FORMAT_EXECUTABLE to clang-format 8 or disable ITK_USE_CLANG_FORMAT.")
endif()
1 change: 1 addition & 0 deletions CMake/ITKModuleHeaderTest.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ macro(itk_module_headertest _name)
${${_name}_SOURCE_DIR} ${${_name}_BINARY_DIR} ${MAXIMUM_NUMBER_OF_HEADERS} ${_test_num})
add_executable(${_test_name} ${_header_test_src})
target_link_libraries(${_test_name} PUBLIC ${${_name}_LIBRARIES} itksys)
target_link_options(${_test_name} PRIVATE "$<$<AND:$<C_COMPILER_ID:AppleClang>,$<VERSION_GREATER_EQUAL:$<C_COMPILER_VERSION>,15.0>>:LINKER:-no_warn_duplicate_libraries>")

add_dependencies(${_name}-all ${_test_name})
math(EXPR _test_num "${_test_num} + 1")
Expand Down
1 change: 1 addition & 0 deletions CMake/ITKModuleMacros.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -492,6 +492,7 @@ macro(itk_module_add_library _name)
endif()
add_library(${_name} ${_LIBRARY_BUILD_TYPE} ${ARGN})
target_compile_features(${_name} PUBLIC cxx_std_${CMAKE_CXX_STANDARD})
target_link_options(${_name} PUBLIC "$<$<AND:$<C_COMPILER_ID:AppleClang>,$<VERSION_GREATER_EQUAL:$<C_COMPILER_VERSION>,15.0>>:LINKER:-no_warn_duplicate_libraries>")
itk_module_link_dependencies()
itk_module_target(${_name})
endmacro()
2 changes: 2 additions & 0 deletions CMake/ITKModuleTest.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ EM_ASM(
LINK_PUBLIC
${KIT_LIBS}
${ITKTestKernel_LIBRARIES})
target_link_options(${KIT}TestDriver PRIVATE "$<$<AND:$<C_COMPILER_ID:AppleClang>,$<VERSION_GREATER_EQUAL:$<C_COMPILER_VERSION>,15.0>>:LINKER:-no_warn_duplicate_libraries>")
itk_module_target_label(${KIT}TestDriver)
endmacro()

Expand Down Expand Up @@ -240,6 +241,7 @@ function(
${KIT_LIBS}
GTest::GTest
GTest::Main)
target_link_options(${exe} PRIVATE "$<$<AND:$<C_COMPILER_ID:AppleClang>,$<VERSION_GREATER_EQUAL:$<C_COMPILER_VERSION>,15.0>>:LINKER:-no_warn_duplicate_libraries>")
itk_module_target_label(${exe})

include(GoogleTest)
Expand Down
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@
# continue to generate policy warnings "CMake Warning (dev)...Policy CMP0XXX is not set:"
#
set(ITK_OLDEST_VALIDATED_POLICIES_VERSION "3.16.3")
set(ITK_NEWEST_VALIDATED_POLICIES_VERSION "3.19.7")
set(ITK_NEWEST_VALIDATED_POLICIES_VERSION "3.29.0")
cmake_minimum_required(VERSION ${ITK_OLDEST_VALIDATED_POLICIES_VERSION}...${ITK_NEWEST_VALIDATED_POLICIES_VERSION}
FATAL_ERROR)

#
# Now enumerate specific policies newer than ITK_NEWEST_VALIDATED_POLICIES_VERSION
# that may need to be individually set to NEW/OLD
#
foreach(pnew "CMP0120" "CMP0135")
foreach(pnew )
if(POLICY ${pnew})
cmake_policy(SET ${pnew} NEW)
endif()
Expand Down
4 changes: 4 additions & 0 deletions Modules/Core/Common/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ set(BASELINE "${ITK_DATA_ROOT}/Baseline/Common")
set(TEMP ${ITK_TEST_OUTPUT_DIR})

add_executable(itkMathTest itkMathTest.cxx)
target_link_options(itkMathTest PRIVATE "$<$<AND:$<C_COMPILER_ID:AppleClang>,$<VERSION_GREATER_EQUAL:$<C_COMPILER_VERSION>,15.0>>:LINKER:-no_warn_duplicate_libraries>")
itk_module_target_label(itkMathTest)
target_link_libraries(itkMathTest LINK_PUBLIC ${ITKCommon_LIBRARIES})
itk_add_test(
Expand All @@ -218,6 +219,7 @@ itk_add_test(
itkMathTest)

add_executable(itkSystemInformation itkSystemInformation.cxx)
target_link_options(itkSystemInformation PRIVATE "$<$<AND:$<C_COMPILER_ID:AppleClang>,$<VERSION_GREATER_EQUAL:$<C_COMPILER_VERSION>,15.0>>:LINKER:-no_warn_duplicate_libraries>")
itk_module_target_label(itkSystemInformation)
target_link_libraries(itkSystemInformation LINK_PUBLIC ${ITKCommon_LIBRARIES})
itk_add_test(
Expand Down Expand Up @@ -1767,6 +1769,7 @@ if(NOT ITK_BUILD_SHARED_LIBS
".*-static.*")
macro(BuildSharedTestLibrary _name _type)
add_library(SharedTestLibrary${_name} ${_type} SharedTestLibrary${_name}.cxx)
target_link_options(SharedTestLibrary${_name} PRIVATE "$<$<AND:$<C_COMPILER_ID:AppleClang>,$<VERSION_GREATER_EQUAL:$<C_COMPILER_VERSION>,15.0>>:LINKER:-no_warn_duplicate_libraries>")
itk_module_target_label(SharedTestLibrary${_name})
target_link_libraries(SharedTestLibrary${_name} LINK_PUBLIC ${ITKCommon_LIBRARIES})
set_property(TARGET SharedTestLibrary${_name} PROPERTY LIBRARY_OUTPUT_DIRECTORY ${ITK_TEST_OUTPUT_DIR})
Expand All @@ -1784,6 +1787,7 @@ if(NOT ITK_BUILD_SHARED_LIBS
buildsharedtestlibrary(A SHARED)
buildsharedtestlibrary(B SHARED)
add_executable(itkObjectFactoryBasePrivateDestructor itkObjectFactoryBasePrivateDestructor.cxx)
target_link_options(itkObjectFactoryBasePrivateDestructor PRIVATE "$<$<AND:$<C_COMPILER_ID:AppleClang>,$<VERSION_GREATER_EQUAL:$<C_COMPILER_VERSION>,15.0>>:LINKER:-no_warn_duplicate_libraries>")
itk_module_target_label(itkObjectFactoryBasePrivateDestructor)
target_link_libraries(
itkObjectFactoryBasePrivateDestructor
Expand Down
1 change: 1 addition & 0 deletions Modules/Core/TestKernel/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ if(NOT DO_NOT_BUILD_ITK_TEST_DRIVER)
${ITKTestKernel_LIBRARIES})
itk_module_target_label(itkTestDriver)
itk_module_target_export(itkTestDriver)
target_link_options(itkTestDriver PRIVATE "$<$<AND:$<C_COMPILER_ID:AppleClang>,$<VERSION_GREATER_EQUAL:$<C_COMPILER_VERSION>,15.0>>:LINKER:-no_warn_duplicate_libraries>")

if(NOT DO_NOT_INSTALL_ITK_TEST_DRIVER) # used only by vcpkg
itk_module_target_install(itkTestDriver)
Expand Down
1 change: 1 addition & 0 deletions Modules/Filtering/FFT/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,7 @@ endforeach()

# Test header files circular dependencies
add_executable(ITKFFTTestCircularDependency itkTestCircularDependency.cxx)
target_link_options(ITKFFTTestCircularDependency PRIVATE "$<$<AND:$<C_COMPILER_ID:AppleClang>,$<VERSION_GREATER_EQUAL:$<C_COMPILER_VERSION>,15.0>>:LINKER:-no_warn_duplicate_libraries>")
target_link_libraries(ITKFFTTestCircularDependency ${ITKFFT-Test_LIBRARIES})
itk_add_test(
NAME
Expand Down
4 changes: 4 additions & 0 deletions Modules/Nonunit/IntegratedTest/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ set(TEMP ${ITK_TEST_OUTPUT_DIR})

# temporary solution for all print tests. Each module should have its own print test later.
add_executable(itkAlgorithmsPrintTest itkAlgorithmsPrintTest.cxx)
target_link_options(itkAlgorithmsPrintTest PRIVATE "$<$<AND:$<C_COMPILER_ID:AppleClang>,$<VERSION_GREATER_EQUAL:$<C_COMPILER_VERSION>,15.0>>:LINKER:-no_warn_duplicate_libraries>")
itk_module_target_label(itkAlgorithmsPrintTest)
target_link_libraries(itkAlgorithmsPrintTest LINK_PUBLIC ${ITKIntegratedTest-Test_LIBRARIES})
itk_add_test(
Expand All @@ -25,6 +26,7 @@ itk_add_test(
itkAlgorithmsPrintTest)

add_executable(itkAlgorithmsPrintTest2 itkAlgorithmsPrintTest2.cxx)
target_link_options(itkAlgorithmsPrintTest2 PRIVATE "$<$<AND:$<C_COMPILER_ID:AppleClang>,$<VERSION_GREATER_EQUAL:$<C_COMPILER_VERSION>,15.0>>:LINKER:-no_warn_duplicate_libraries>")
itk_module_target_label(itkAlgorithmsPrintTest2)
target_link_libraries(itkAlgorithmsPrintTest2 LINK_PUBLIC ${ITKIntegratedTest-Test_LIBRARIES})
itk_add_test(
Expand All @@ -34,6 +36,7 @@ itk_add_test(
itkAlgorithmsPrintTest)

add_executable(itkAlgorithmsPrintTest3 itkAlgorithmsPrintTest3.cxx)
target_link_options(itkAlgorithmsPrintTest3 PRIVATE "$<$<AND:$<C_COMPILER_ID:AppleClang>,$<VERSION_GREATER_EQUAL:$<C_COMPILER_VERSION>,15.0>>:LINKER:-no_warn_duplicate_libraries>")
itk_module_target_label(itkAlgorithmsPrintTest3)
target_link_libraries(itkAlgorithmsPrintTest3 LINK_PUBLIC ${ITKIntegratedTest-Test_LIBRARIES})
itk_add_test(
Expand All @@ -43,6 +46,7 @@ itk_add_test(
itkAlgorithmsPrintTest)

add_executable(itkAlgorithmsPrintTest4 itkAlgorithmsPrintTest4.cxx)
target_link_options(itkAlgorithmsPrintTest4 PRIVATE "$<$<AND:$<C_COMPILER_ID:AppleClang>,$<VERSION_GREATER_EQUAL:$<C_COMPILER_VERSION>,15.0>>:LINKER:-no_warn_duplicate_libraries>")
itk_module_target_label(itkAlgorithmsPrintTest4)
target_link_libraries(itkAlgorithmsPrintTest4 LINK_PUBLIC ${ITKIntegratedTest-Test_LIBRARIES})
itk_add_test(
Expand Down
2 changes: 1 addition & 1 deletion Modules/ThirdParty/ZLIB/src/itkzlib-ng/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.5.1)
if(CMAKE_VERSION VERSION_LESS 3.12)
cmake_policy(VERSION ${CMAKE_VERSION})
else()
cmake_policy(VERSION 3.5.1...3.13.2)
cmake_policy(VERSION 3.5.1...3.29.0)
endif()
message(STATUS "Using CMake version ${CMAKE_VERSION}")

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
bafkreibx5jakzrnnkua475ceigcciipkve4cdlkcxcv4x4u3u2jj4klwxm

0 comments on commit 21e3edd

Please sign in to comment.