From 6e88ab6fd993076873555390e8a088266f0d797b Mon Sep 17 00:00:00 2001 From: Matt McCormick Date: Mon, 8 Apr 2024 13:58:29 -0400 Subject: [PATCH 1/5] COMP: Bump Validated CMake policies version to 3.29.0 Fix CLANG_FORMAT_EXECUTABLE location with find_program to address: CMake Error at CMake/ITKClangFormatSetup.cmake:62 (message): Missing suitable clang-format executable, set CLANG_FORMAT_EXECUTABLE variable to version 8.0 Call Stack (most recent call first): CMakeLists.txt:586 (include) Improve host system detection for the clang-format binary download. --- CMake/ITKClangFormatSetup.cmake | 21 +++++++++------------ CMakeLists.txt | 4 ++-- 2 files changed, 11 insertions(+), 14 deletions(-) diff --git a/CMake/ITKClangFormatSetup.cmake b/CMake/ITKClangFormatSetup.cmake index 74d4c7b9b71..9ded94935e0 100644 --- a/CMake/ITKClangFormatSetup.cmake +++ b/CMake/ITKClangFormatSetup.cmake @@ -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 # @@ -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) @@ -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() diff --git a/CMakeLists.txt b/CMakeLists.txt index e5be518d87c..1267b1aae95 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,7 +11,7 @@ # 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) @@ -19,7 +19,7 @@ cmake_minimum_required(VERSION ${ITK_OLDEST_VALIDATED_POLICIES_VERSION}...${ITK_ # 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() From cdd8be3b919aec025a0656e71bbdef5caa033e0e Mon Sep 17 00:00:00 2001 From: Matt McCormick Date: Tue, 9 Apr 2024 11:00:06 -0400 Subject: [PATCH 2/5] COMP: Bump zlib-ng CMake max policy to 3.29.0 Addresses: 3.29.0/share/cmake/Modules/CMakeDependentOption.cmake:89 (message): Policy CMP0127 is not set: cmake_dependent_option() supports full Condition Syntax. Run "cmake --help-policy CMP0127" for policy details. Use the cmake_policy command to set the policy and suppress this warning. Call Stack (most recent call first): CMakeLists.txt:107 (cmake_dependent_option) This warning is for project developers. Use -Wno-dev to suppress it. Submitted upstream: https://github.com/zlib-ng/zlib-ng/pull/1709 --- Modules/ThirdParty/ZLIB/src/itkzlib-ng/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/ThirdParty/ZLIB/src/itkzlib-ng/CMakeLists.txt b/Modules/ThirdParty/ZLIB/src/itkzlib-ng/CMakeLists.txt index ef3eed3fe3a..80fe31d6b42 100644 --- a/Modules/ThirdParty/ZLIB/src/itkzlib-ng/CMakeLists.txt +++ b/Modules/ThirdParty/ZLIB/src/itkzlib-ng/CMakeLists.txt @@ -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}") From 7231bf793f552517e309a354ee5643b3f2967ed0 Mon Sep 17 00:00:00 2001 From: Matt McCormick Date: Tue, 9 Apr 2024 12:26:19 -0400 Subject: [PATCH 3/5] COMP: Apple Clang 15 duplicate libraries Addresses: ld: warning: ignoring duplicate libraries: '-lm' With Apple Clang 15. This approach works with older CMake but based on: https://gitlab.kitware.com/cmake/cmake/-/commit/7b99c42e57b11afe818827ac537ca020c020addd --- CMake/ITKModuleHeaderTest.cmake | 1 + CMake/ITKModuleMacros.cmake | 1 + CMake/ITKModuleTest.cmake | 2 ++ Modules/Core/Common/test/CMakeLists.txt | 4 ++++ Modules/Core/TestKernel/src/CMakeLists.txt | 1 + Modules/Filtering/FFT/test/CMakeLists.txt | 1 + Modules/Nonunit/IntegratedTest/test/CMakeLists.txt | 4 ++++ 7 files changed, 14 insertions(+) diff --git a/CMake/ITKModuleHeaderTest.cmake b/CMake/ITKModuleHeaderTest.cmake index 67917cc07dd..555d4adac10 100644 --- a/CMake/ITKModuleHeaderTest.cmake +++ b/CMake/ITKModuleHeaderTest.cmake @@ -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 "$<$,$,15.0>>:LINKER:-no_warn_duplicate_libraries>") add_dependencies(${_name}-all ${_test_name}) math(EXPR _test_num "${_test_num} + 1") diff --git a/CMake/ITKModuleMacros.cmake b/CMake/ITKModuleMacros.cmake index d0375b494a0..2dcf9a264fa 100644 --- a/CMake/ITKModuleMacros.cmake +++ b/CMake/ITKModuleMacros.cmake @@ -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 "$<$,$,15.0>>:LINKER:-no_warn_duplicate_libraries>") itk_module_link_dependencies() itk_module_target(${_name}) endmacro() diff --git a/CMake/ITKModuleTest.cmake b/CMake/ITKModuleTest.cmake index acd87fc5177..8659779c1dc 100644 --- a/CMake/ITKModuleTest.cmake +++ b/CMake/ITKModuleTest.cmake @@ -70,6 +70,7 @@ EM_ASM( LINK_PUBLIC ${KIT_LIBS} ${ITKTestKernel_LIBRARIES}) + target_link_options(${KIT}TestDriver PRIVATE "$<$,$,15.0>>:LINKER:-no_warn_duplicate_libraries>") itk_module_target_label(${KIT}TestDriver) endmacro() @@ -240,6 +241,7 @@ function( ${KIT_LIBS} GTest::GTest GTest::Main) + target_link_options(${exe} PRIVATE "$<$,$,15.0>>:LINKER:-no_warn_duplicate_libraries>") itk_module_target_label(${exe}) include(GoogleTest) diff --git a/Modules/Core/Common/test/CMakeLists.txt b/Modules/Core/Common/test/CMakeLists.txt index 8123e5a9f61..78846a40f49 100644 --- a/Modules/Core/Common/test/CMakeLists.txt +++ b/Modules/Core/Common/test/CMakeLists.txt @@ -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 "$<$,$,15.0>>:LINKER:-no_warn_duplicate_libraries>") itk_module_target_label(itkMathTest) target_link_libraries(itkMathTest LINK_PUBLIC ${ITKCommon_LIBRARIES}) itk_add_test( @@ -218,6 +219,7 @@ itk_add_test( itkMathTest) add_executable(itkSystemInformation itkSystemInformation.cxx) +target_link_options(itkSystemInformation PRIVATE "$<$,$,15.0>>:LINKER:-no_warn_duplicate_libraries>") itk_module_target_label(itkSystemInformation) target_link_libraries(itkSystemInformation LINK_PUBLIC ${ITKCommon_LIBRARIES}) itk_add_test( @@ -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 "$<$,$,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}) @@ -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 "$<$,$,15.0>>:LINKER:-no_warn_duplicate_libraries>") itk_module_target_label(itkObjectFactoryBasePrivateDestructor) target_link_libraries( itkObjectFactoryBasePrivateDestructor diff --git a/Modules/Core/TestKernel/src/CMakeLists.txt b/Modules/Core/TestKernel/src/CMakeLists.txt index e363d6431dc..5ae5b75de02 100644 --- a/Modules/Core/TestKernel/src/CMakeLists.txt +++ b/Modules/Core/TestKernel/src/CMakeLists.txt @@ -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 "$<$,$,15.0>>:LINKER:-no_warn_duplicate_libraries>") if(NOT DO_NOT_INSTALL_ITK_TEST_DRIVER) # used only by vcpkg itk_module_target_install(itkTestDriver) diff --git a/Modules/Filtering/FFT/test/CMakeLists.txt b/Modules/Filtering/FFT/test/CMakeLists.txt index ca553cd16ea..bb742fca56a 100644 --- a/Modules/Filtering/FFT/test/CMakeLists.txt +++ b/Modules/Filtering/FFT/test/CMakeLists.txt @@ -440,6 +440,7 @@ endforeach() # Test header files circular dependencies add_executable(ITKFFTTestCircularDependency itkTestCircularDependency.cxx) +target_link_options(ITKFFTTestCircularDependency PRIVATE "$<$,$,15.0>>:LINKER:-no_warn_duplicate_libraries>") target_link_libraries(ITKFFTTestCircularDependency ${ITKFFT-Test_LIBRARIES}) itk_add_test( NAME diff --git a/Modules/Nonunit/IntegratedTest/test/CMakeLists.txt b/Modules/Nonunit/IntegratedTest/test/CMakeLists.txt index a4890ad145e..d9cde27e7a4 100644 --- a/Modules/Nonunit/IntegratedTest/test/CMakeLists.txt +++ b/Modules/Nonunit/IntegratedTest/test/CMakeLists.txt @@ -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 "$<$,$,15.0>>:LINKER:-no_warn_duplicate_libraries>") itk_module_target_label(itkAlgorithmsPrintTest) target_link_libraries(itkAlgorithmsPrintTest LINK_PUBLIC ${ITKIntegratedTest-Test_LIBRARIES}) itk_add_test( @@ -25,6 +26,7 @@ itk_add_test( itkAlgorithmsPrintTest) add_executable(itkAlgorithmsPrintTest2 itkAlgorithmsPrintTest2.cxx) +target_link_options(itkAlgorithmsPrintTest2 PRIVATE "$<$,$,15.0>>:LINKER:-no_warn_duplicate_libraries>") itk_module_target_label(itkAlgorithmsPrintTest2) target_link_libraries(itkAlgorithmsPrintTest2 LINK_PUBLIC ${ITKIntegratedTest-Test_LIBRARIES}) itk_add_test( @@ -34,6 +36,7 @@ itk_add_test( itkAlgorithmsPrintTest) add_executable(itkAlgorithmsPrintTest3 itkAlgorithmsPrintTest3.cxx) +target_link_options(itkAlgorithmsPrintTest3 PRIVATE "$<$,$,15.0>>:LINKER:-no_warn_duplicate_libraries>") itk_module_target_label(itkAlgorithmsPrintTest3) target_link_libraries(itkAlgorithmsPrintTest3 LINK_PUBLIC ${ITKIntegratedTest-Test_LIBRARIES}) itk_add_test( @@ -43,6 +46,7 @@ itk_add_test( itkAlgorithmsPrintTest) add_executable(itkAlgorithmsPrintTest4 itkAlgorithmsPrintTest4.cxx) +target_link_options(itkAlgorithmsPrintTest4 PRIVATE "$<$,$,15.0>>:LINKER:-no_warn_duplicate_libraries>") itk_module_target_label(itkAlgorithmsPrintTest4) target_link_libraries(itkAlgorithmsPrintTest4 LINK_PUBLIC ${ITKIntegratedTest-Test_LIBRARIES}) itk_add_test( From 75e08fcf43601ba98608d70f0d7291624ea90dbc Mon Sep 17 00:00:00 2001 From: Matt McCormick Date: Tue, 9 Apr 2024 17:28:37 -0400 Subject: [PATCH 4/5] COMP: ResampleImageFilter9 baseline for ARM macOS Slight differences on this platform. --- .../Filtering/ResampleImageFilter9TestPixelCentered.5.png.cid | 1 + 1 file changed, 1 insertion(+) create mode 100644 Testing/Data/Baseline/Filtering/ResampleImageFilter9TestPixelCentered.5.png.cid diff --git a/Testing/Data/Baseline/Filtering/ResampleImageFilter9TestPixelCentered.5.png.cid b/Testing/Data/Baseline/Filtering/ResampleImageFilter9TestPixelCentered.5.png.cid new file mode 100644 index 00000000000..651ea2b518a --- /dev/null +++ b/Testing/Data/Baseline/Filtering/ResampleImageFilter9TestPixelCentered.5.png.cid @@ -0,0 +1 @@ +bafkreibx5jakzrnnkua475ceigcciipkve4cdlkcxcv4x4u3u2jj4klwxm From 99d13a4677d43222db0e560084460f02485f4b6c Mon Sep 17 00:00:00 2001 From: Matt McCormick Date: Thu, 14 Mar 2024 17:59:13 -0400 Subject: [PATCH 5/5] ENH: Add macOS ARM GitHub Actions configuration Uses new GitHub Actions dashboard script --- .github/workflows/macos-arm.yml | 86 +++++++++++++++++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 .github/workflows/macos-arm.yml diff --git a/.github/workflows/macos-arm.yml b/.github/workflows/macos-arm.yml new file mode 100644 index 00000000000..72ccc32c6cb --- /dev/null +++ b/.github/workflows/macos-arm.yml @@ -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