From dbabc9e30494a8442898cc0bdf9ac8e89772a446 Mon Sep 17 00:00:00 2001 From: Florian Uhlig Date: Tue, 22 Apr 2025 12:05:22 +0200 Subject: [PATCH 01/23] [legacy] hepmc: Fix build system for CMake 4.0.1 --- cmake/legacy.cmake | 5 +++-- legacy/hepmc/fix_cmake.patch | 37 ++++++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+), 2 deletions(-) create mode 100644 legacy/hepmc/fix_cmake.patch diff --git a/cmake/legacy.cmake b/cmake/legacy.cmake index 5c89f7cc..334943a2 100644 --- a/cmake/legacy.cmake +++ b/cmake/legacy.cmake @@ -5,8 +5,8 @@ # GNU Lesser General Public Licence (LGPL) version 3, # # copied verbatim in the file "LICENSE" # ################################################################################ -cmake_minimum_required(VERSION 3.19...3.28 FATAL_ERROR) -cmake_policy(VERSION 3.19...3.28) +cmake_minimum_required(VERSION 3.19...4.0.1) +cmake_policy(VERSION 3.19...4.0.1) find_package(LibLZMA) if(LibLZMA_FOUND) @@ -276,6 +276,7 @@ set(hepmc_version "2.06.11") ExternalProject_Add(hepmc URL https://hepmc.web.cern.ch/releases/hepmc${hepmc_version}.tgz URL_HASH SHA256=86b66ea0278f803cde5774de8bd187dd42c870367f1cbf6cdaec8dc7cf6afc10 + PATCH_COMMAND ${patch} -p1 -i "${CMAKE_SOURCE_DIR}/legacy/hepmc/fix_cmake.patch" ${CMAKE_DEFAULT_ARGS} CMAKE_ARGS "-Dlength:STRING=CM" "-Dmomentum:STRING=GEV" diff --git a/legacy/hepmc/fix_cmake.patch b/legacy/hepmc/fix_cmake.patch new file mode 100644 index 00000000..2be7f193 --- /dev/null +++ b/legacy/hepmc/fix_cmake.patch @@ -0,0 +1,37 @@ +--- a/CMakeLists.txt 2025-04-22 10:37:30 ++++ b/CMakeLists.txt 2020-06-08 13:25:39 +@@ -14,7 +14,7 @@ + #------------------------------------------------------------------------------ + + # use cmake 2.6 or later +-cmake_minimum_required (VERSION 2.6) ++cmake_minimum_required (VERSION 2.6...4.0.1) + + # project name and version + project(HepMC) +--- a/cmake/Modules/HepMCUseCpack.cmake_orig 2025-04-22 11:44:59 ++++ b/cmake/Modules/HepMCUseCpack.cmake 2025-04-22 11:46:37 +@@ -8,8 +8,8 @@ + # + FUNCTION(_My_COMPILER_DUMPVERSION _OUTPUT_VERSION) + +- EXEC_PROGRAM(${CMAKE_CXX_COMPILER} +- ARGS ${CMAKE_CXX_COMPILER_ARG1} -dumpversion ++ EXECUTE_PROCESS(COMMAND ++ ${CMAKE_CXX_COMPILER} ${CMAKE_CXX_COMPILER_ARG1} -dumpversion + OUTPUT_VARIABLE _my_COMPILER_VERSION + ) + set( COMPILER_VERSION ${_my_COMPILER_VERSION} PARENT_SCOPE) +--- a/cmake/Modules/HepMCVariables.cmake_orig 2025-04-22 11:45:10 ++++ b/cmake/Modules/HepMCVariables.cmake 2025-04-22 11:46:01 +@@ -10,8 +10,8 @@ + # so we need this for the example makefile + macro( _hepmc_fortran_compiler ) + +- EXEC_PROGRAM(${CMAKE_CXX_COMPILER} +- ARGS ${CMAKE_CXX_COMPILER_ARG1} -dumpversion ++ EXECUTE_PROCESS(COMMAND ++ ${CMAKE_CXX_COMPILER} ${CMAKE_CXX_COMPILER_ARG1} -dumpversion + OUTPUT_VARIABLE _my_COMPILER_VERSION + ) + STRING(REGEX REPLACE "([0-9])\\.([0-9])(\\.[0-9])?" "\\1" From abcdaa8fc33e298f42b9207f0b71b2aff488ca48 Mon Sep 17 00:00:00 2001 From: Florian Uhlig Date: Tue, 22 Apr 2025 13:12:55 +0200 Subject: [PATCH 02/23] [legacy] zeromq: Fix build system for CMake 4.0.1 --- cmake/legacy.cmake | 1 + legacy/zeromq/fix_cmake.patch | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 legacy/zeromq/fix_cmake.patch diff --git a/cmake/legacy.cmake b/cmake/legacy.cmake index 334943a2..45c1dac8 100644 --- a/cmake/legacy.cmake +++ b/cmake/legacy.cmake @@ -230,6 +230,7 @@ list(APPEND packages zeromq) set(zeromq_version "4.3.5") ExternalProject_Add(zeromq GIT_REPOSITORY https://github.com/zeromq/libzmq GIT_TAG v${zeromq_version} + PATCH_COMMAND ${patch} -p1 -i "${CMAKE_SOURCE_DIR}/legacy/zeromq/fix_cmake.patch" ${CMAKE_DEFAULT_ARGS} CMAKE_ARGS "-DWITH_PERF_TOOL=ON" "-DZMQ_BUILD_TESTS=ON" diff --git a/legacy/zeromq/fix_cmake.patch b/legacy/zeromq/fix_cmake.patch new file mode 100644 index 00000000..fc7a50ff --- /dev/null +++ b/legacy/zeromq/fix_cmake.patch @@ -0,0 +1,32 @@ +--- a/CMakeLists.txt_orig 2025-04-22 12:58:25 ++++ b/CMakeLists.txt 2025-04-22 12:58:47 +@@ -2,9 +2,9 @@ + project(ZeroMQ) + + if(${CMAKE_SYSTEM_NAME} STREQUAL Darwin) +- cmake_minimum_required(VERSION 3.0.2) ++ cmake_minimum_required(VERSION 3.0.2...4.0.1) + else() +- cmake_minimum_required(VERSION 2.8.12) ++ cmake_minimum_required(VERSION 2.8.12...4.0.1) + endif() + + include(CheckIncludeFiles) +--- a/tests/CMakeLists.txt_orig 2025-04-22 13:02:31 ++++ b/tests/CMakeLists.txt 2025-04-22 13:02:49 +@@ -1,5 +1,5 @@ + # CMake build script for ZeroMQ tests +-cmake_minimum_required(VERSION "2.8.1") ++cmake_minimum_required(VERSION 2.8.1...4.0.1) + + # On Windows: solution file will be called tests.sln + project(tests) +--- a/unittests/CMakeLists.txt_orig 2025-04-22 13:04:17 ++++ b/unittests/CMakeLists.txt 2025-04-22 13:04:29 +@@ -1,5 +1,5 @@ + # CMake build script for ZeroMQ unit tests +-cmake_minimum_required(VERSION "2.8.1") ++cmake_minimum_required(VERSION 2.8.1...4.0.1) + + set(unittests + unittest_ypipe From 3e5a33311117465ba4831c0ad1b1cb7cbe1490bf Mon Sep 17 00:00:00 2001 From: Florian Uhlig Date: Tue, 22 Apr 2025 13:41:02 +0200 Subject: [PATCH 03/23] [legacy] vc: Fix build system for CMake 4.0.1 --- cmake/legacy.cmake | 1 + legacy/vc/fix_cmake.patch | 79 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 80 insertions(+) create mode 100644 legacy/vc/fix_cmake.patch diff --git a/cmake/legacy.cmake b/cmake/legacy.cmake index 45c1dac8..8c0e4497 100644 --- a/cmake/legacy.cmake +++ b/cmake/legacy.cmake @@ -290,6 +290,7 @@ set(vc_version "1.4.4") ExternalProject_Add(vc URL https://github.com/VcDevel/Vc/archive/refs/tags/${vc_version}.tar.gz URL_HASH SHA256=5933108196be44c41613884cd56305df320263981fe6a49e648aebb3354d57f3 + PATCH_COMMAND ${patch} -p1 -i "${CMAKE_SOURCE_DIR}/legacy/vc/fix_cmake.patch" ${CMAKE_DEFAULT_ARGS} ${LOG_TO_FILE} ${DEPENDS_ON_SOURCE_CACHE} ) diff --git a/legacy/vc/fix_cmake.patch b/legacy/vc/fix_cmake.patch new file mode 100644 index 00000000..7ba94fd2 --- /dev/null +++ b/legacy/vc/fix_cmake.patch @@ -0,0 +1,79 @@ +--- a/CMakeLists.txt_orig 2025-04-22 13:24:33 ++++ b/CMakeLists.txt 2025-04-22 13:25:34 +@@ -1,4 +1,4 @@ +-cmake_minimum_required(VERSION 3.0) ++cmake_minimum_required(VERSION 3.0...4.0.1) + + cmake_policy(SET CMP0028 NEW) # Double colon in target name means ALIAS or IMPORTED target. + cmake_policy(SET CMP0048 NEW) # The ``project()`` command manages VERSION variables. +--- a/cmake/VcMacros.cmake_orig 2025-04-22 13:33:46 ++++ b/cmake/VcMacros.cmake 2025-04-22 13:32:40 +@@ -41,7 +41,7 @@ + + macro(vc_determine_compiler) + if(NOT DEFINED Vc_COMPILER_IS_INTEL) +- execute_process(COMMAND "${CMAKE_CXX_COMPILER}" "--version" OUTPUT_VARIABLE _cxx_compiler_version ERROR_VARIABLE _cxx_compiler_version) ++ execute_process(COMMAND ${CMAKE_CXX_COMPILER} --version OUTPUT_VARIABLE _cxx_compiler_version ERROR_VARIABLE _cxx_compiler_version) + set(Vc_COMPILER_IS_INTEL false) + set(Vc_COMPILER_IS_OPEN64 false) + set(Vc_COMPILER_IS_CLANG false) +@@ -49,7 +49,7 @@ + set(Vc_COMPILER_IS_GCC false) + if(CMAKE_CXX_COMPILER MATCHES "/(icpc|icc)$") + set(Vc_COMPILER_IS_INTEL true) +- exec_program(${CMAKE_CXX_COMPILER} ARGS -dumpversion OUTPUT_VARIABLE Vc_ICC_VERSION) ++ execute_process(COMMAND ${CMAKE_CXX_COMPILER} ARGS -dumpversion OUTPUT_VARIABLE Vc_ICC_VERSION) + message(STATUS "Detected Compiler: Intel ${Vc_ICC_VERSION}") + + # break build with too old clang as early as possible. +@@ -61,7 +61,7 @@ + message(STATUS "Detected Compiler: Open64") + elseif(CMAKE_CXX_COMPILER MATCHES "clang\\+\\+$" OR "${_cxx_compiler_version}" MATCHES "clang") + set(Vc_COMPILER_IS_CLANG true) +- exec_program(${CMAKE_CXX_COMPILER} ARGS --version OUTPUT_VARIABLE Vc_CLANG_VERSION) ++ execute_process(COMMAND ${CMAKE_CXX_COMPILER} --version OUTPUT_VARIABLE Vc_CLANG_VERSION) + string(REGEX MATCH "[0-9]+\\.[0-9]+(\\.[0-9]+)?" Vc_CLANG_VERSION "${Vc_CLANG_VERSION}") + message(STATUS "Detected Compiler: Clang ${Vc_CLANG_VERSION}") + +@@ -74,13 +74,13 @@ + message(STATUS "Detected Compiler: MSVC ${MSVC_VERSION}") + elseif(CMAKE_COMPILER_IS_GNUCXX) + set(Vc_COMPILER_IS_GCC true) +- exec_program(${CMAKE_CXX_COMPILER} ARGS -dumpversion OUTPUT_VARIABLE Vc_GCC_VERSION) ++ execute_process(COMMAND ${CMAKE_CXX_COMPILER} -dumpversion OUTPUT_VARIABLE Vc_GCC_VERSION) + message(STATUS "Detected Compiler: GCC ${Vc_GCC_VERSION}") + + # some distributions patch their GCC to return nothing or only major and minor version on -dumpversion. + # In that case we must extract the version number from --version. + if(NOT Vc_GCC_VERSION OR Vc_GCC_VERSION MATCHES "^[0-9]\\.[0-9]+$") +- exec_program(${CMAKE_CXX_COMPILER} ARGS --version OUTPUT_VARIABLE Vc_GCC_VERSION) ++ execute_process(COMMAND ${CMAKE_CXX_COMPILER} --version OUTPUT_VARIABLE Vc_GCC_VERSION) + string(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+" Vc_GCC_VERSION "${Vc_GCC_VERSION}") + message(STATUS "GCC Version from --version: ${Vc_GCC_VERSION}") + endif() +@@ -144,12 +144,12 @@ + endmacro() + + macro(vc_check_assembler) +- exec_program(${CMAKE_CXX_COMPILER} ARGS -print-prog-name=as OUTPUT_VARIABLE _as) ++ execute_process(COMMAND ${CMAKE_CXX_COMPILER} -print-prog-name=as OUTPUT_VARIABLE _as) + mark_as_advanced(_as) + if(NOT _as) + message(WARNING "Could not find 'as', the assembler used by GCC. Hoping everything will work out...") + else() +- exec_program(${_as} ARGS --version OUTPUT_VARIABLE _as_version) ++ execute_process(COMMAND ${_as} --version OUTPUT_VARIABLE _as_version) + string(REGEX REPLACE "\\([^\\)]*\\)" "" _as_version "${_as_version}") + string(REGEX MATCH "[1-9]\\.[0-9]+(\\.[0-9]+)?" _as_version "${_as_version}") + if(_as_version VERSION_LESS "2.18.93") +--- a/cmake/OptimizeForArchitecture.cmake_orig 2025-04-22 13:34:22 ++++ b/cmake/OptimizeForArchitecture.cmake 2025-04-22 13:34:55 +@@ -70,7 +70,7 @@ + string(REGEX REPLACE ".*model[ \t]*:[ \t]+([a-zA-Z0-9_-]+).*" "\\1" _cpu_model "${_cpuinfo}") + string(REGEX REPLACE ".*flags[ \t]*:[ \t]+([^\n]+).*" "\\1" _cpu_flags "${_cpuinfo}") + elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin") +- exec_program("/usr/sbin/sysctl -n machdep.cpu.vendor machdep.cpu.model machdep.cpu.family machdep.cpu.features" OUTPUT_VARIABLE _sysctl_output_string) ++ execute_process(COMMAND /usr/sbin/sysctl -n machdep.cpu.vendor machdep.cpu.model machdep.cpu.family machdep.cpu.features OUTPUT_VARIABLE _sysctl_output_string) + string(REPLACE "\n" ";" _sysctl_output ${_sysctl_output_string}) + list(GET _sysctl_output 0 _vendor_id) + list(GET _sysctl_output 1 _cpu_model) From 50a2207cb9704303b811904fdc964cc6887e4c56 Mon Sep 17 00:00:00 2001 From: Florian Uhlig Date: Wed, 18 Jun 2025 14:08:27 +0200 Subject: [PATCH 04/23] [legacy] pythia6: Fix build system for CMake 4.0.1 --- cmake/legacy.cmake | 1 + legacy/pythia6/fix_cmake.patch | 8 ++++++++ 2 files changed, 9 insertions(+) create mode 100644 legacy/pythia6/fix_cmake.patch diff --git a/cmake/legacy.cmake b/cmake/legacy.cmake index 8c0e4497..fba4e400 100644 --- a/cmake/legacy.cmake +++ b/cmake/legacy.cmake @@ -268,6 +268,7 @@ ExternalProject_Add(pythia6 URL_HASH SHA256=b14e82870d3aa33d6fa07f4b1f4d17f1ab80a37d753f91ca6322352b397cb244 UPDATE_DISCONNECTED ON PATCH_COMMAND ${patch} -p1 -i "${CMAKE_SOURCE_DIR}/legacy/pythia6/add_missing_extern_keyword.patch" + COMMAND ${patch} -p1 -i "${CMAKE_SOURCE_DIR}/legacy/pythia6/fix_cmake.patch" ${CMAKE_DEFAULT_ARGS} ${LOG_TO_FILE} ${DEPENDS_ON_SOURCE_CACHE} ) diff --git a/legacy/pythia6/fix_cmake.patch b/legacy/pythia6/fix_cmake.patch new file mode 100644 index 00000000..1c1b0066 --- /dev/null +++ b/legacy/pythia6/fix_cmake.patch @@ -0,0 +1,8 @@ +--- a/CMakeLists.txt 2025-06-18 13:55:28 ++++ b/CMakeLists.txt 2025-06-18 13:55:44 +@@ -1,4 +1,4 @@ +-Cmake_Minimum_Required(VERSION 2.6.0 FATAL_ERROR) ++Cmake_Minimum_Required(VERSION 2.6.0...4.0.1) + + Project(Pythia6) + Enable_Language(Fortran) From b3ae9d88b458ac4176963bf9d9dd534e0075cb3b Mon Sep 17 00:00:00 2001 From: Florian Uhlig Date: Tue, 24 Jun 2025 13:14:47 +0200 Subject: [PATCH 05/23] [legacy] vmc: Fix build system for CMake 4.0.1 --- cmake/legacy.cmake | 1 + legacy/vmc/fix_cmake.patch | 13 +++++++++++++ 2 files changed, 14 insertions(+) create mode 100644 legacy/vmc/fix_cmake.patch diff --git a/cmake/legacy.cmake b/cmake/legacy.cmake index fba4e400..43d673a9 100644 --- a/cmake/legacy.cmake +++ b/cmake/legacy.cmake @@ -435,6 +435,7 @@ set(vmc_version "2-0") ExternalProject_Add(vmc GIT_REPOSITORY https://github.com/vmc-project/vmc GIT_TAG v${vmc_version} ${CMAKE_DEFAULT_ARGS} ${LOG_TO_FILE} + PATCH_COMMAND ${patch} -p1 -i "${CMAKE_SOURCE_DIR}/legacy/vmc/fix_cmake.patch" DEPENDS root ${extract_source_cache_target} ) diff --git a/legacy/vmc/fix_cmake.patch b/legacy/vmc/fix_cmake.patch new file mode 100644 index 00000000..fa46e706 --- /dev/null +++ b/legacy/vmc/fix_cmake.patch @@ -0,0 +1,13 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 9758860..ebbf90f 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -23,7 +23,7 @@ if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR}) + endif() + + #--- Define CMake requirements ------------------------------------------------- +-cmake_minimum_required(VERSION 3.3 FATAL_ERROR) ++cmake_minimum_required(VERSION 3.3...4.0.1) + + #--- Prepend our own CMake Modules to the search path -------------------------- + set(CMAKE_MODULE_PATH From 4abb7d25a4404560497ea10d6668e924b68ae200 Mon Sep 17 00:00:00 2001 From: Florian Uhlig Date: Tue, 24 Jun 2025 13:16:13 +0200 Subject: [PATCH 06/23] [legacy] vgm: Fix build system for CMake 4.0.1 --- cmake/legacy.cmake | 1 + legacy/vgm/fix_cmake.patch | 13 +++++++++++++ 2 files changed, 14 insertions(+) create mode 100644 legacy/vgm/fix_cmake.patch diff --git a/cmake/legacy.cmake b/cmake/legacy.cmake index 43d673a9..1aaa4c92 100644 --- a/cmake/legacy.cmake +++ b/cmake/legacy.cmake @@ -455,6 +455,7 @@ ExternalProject_Add(vgm GIT_REPOSITORY https://github.com/vmc-project/vgm GIT_TAG v${vgm_version} ${CMAKE_DEFAULT_ARGS} CMAKE_ARGS "-DWITH_TEST=OFF" + PATCH_COMMAND ${patch} -p1 -i "${CMAKE_SOURCE_DIR}/legacy/vgm/fix_cmake.patch" DEPENDS clhep geant4 root ${extract_source_cache_target} ${LOG_TO_FILE} ) diff --git a/legacy/vgm/fix_cmake.patch b/legacy/vgm/fix_cmake.patch new file mode 100644 index 00000000..affdc100 --- /dev/null +++ b/legacy/vgm/fix_cmake.patch @@ -0,0 +1,13 @@ +diff --git a/cmake/VGMConfig.cmake.in b/cmake/VGMConfig.cmake.in +index 0d4e51c..fc934b5 100644 +--- a/cmake/VGMConfig.cmake.in ++++ b/cmake/VGMConfig.cmake.in +@@ -25,7 +25,7 @@ + # I. Hrivnacova, 04/06/2014 + + # Support CMake >= 3.8 +-cmake_policy(VERSION 3.8) ++cmake_policy(VERSION 3.8...4.0.1) + if(CMAKE_VERSION VERSION_LESS 3.8) + message(FATAL_ERROR "VGMConfig requires CMake 3.8 or newer") + endif() From 3d8707225b0c88a65df89075e0a1352c0f67496a Mon Sep 17 00:00:00 2001 From: Florian Uhlig Date: Tue, 24 Jun 2025 13:23:09 +0200 Subject: [PATCH 07/23] [legacy] geant4_vmc: Fix build system for CMake 4.0.1 --- cmake/legacy.cmake | 1 + legacy/geant4_vmc/fix_cmake.patch | 286 ++++++++++++++++++++++++++++++ 2 files changed, 287 insertions(+) create mode 100644 legacy/geant4_vmc/fix_cmake.patch diff --git a/cmake/legacy.cmake b/cmake/legacy.cmake index 1aaa4c92..6b094ed4 100644 --- a/cmake/legacy.cmake +++ b/cmake/legacy.cmake @@ -470,6 +470,7 @@ ExternalProject_Add(geant4_vmc "-DGeant4VMC_USE_GEANT4_VIS=OFF" "-DGeant4VMC_USE_GEANT4_G3TOG4=ON" "-DWITH_TEST=OFF" + PATCH_COMMAND ${patch} -p1 -i "${CMAKE_SOURCE_DIR}/legacy/geant4_vmc/fix_cmake.patch" DEPENDS clhep geant4 root vgm vmc ${extract_source_cache_target} ${LOG_TO_FILE} ) diff --git a/legacy/geant4_vmc/fix_cmake.patch b/legacy/geant4_vmc/fix_cmake.patch new file mode 100644 index 00000000..024dfe68 --- /dev/null +++ b/legacy/geant4_vmc/fix_cmake.patch @@ -0,0 +1,286 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 20cedfe4..55f1c6d8 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -24,7 +24,7 @@ if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR}) + endif() + + #--- Define CMake requirements ------------------------------------------------- +-cmake_minimum_required(VERSION 3.3 FATAL_ERROR) ++cmake_minimum_required(VERSION 3.3...4.0.1) + + #--- Allow compiling with non Apple Clang on macOS ----------------------------- + cmake_policy(SET CMP0025 NEW) +diff --git a/examples/A01/CMakeLists.txt b/examples/A01/CMakeLists.txt +index 2a29c168..7f414132 100644 +--- a/examples/A01/CMakeLists.txt ++++ b/examples/A01/CMakeLists.txt +@@ -12,7 +12,7 @@ + + #---------------------------------------------------------------------------- + # Setup the project +-cmake_minimum_required(VERSION 2.8.12 FATAL_ERROR) ++cmake_minimum_required(VERSION 2.8.12...4.0.1) + + + #---------------------------------------------------------------------------- +diff --git a/examples/A01/geant4/CMakeLists.txt b/examples/A01/geant4/CMakeLists.txt +index d197af0a..0a2ba9bb 100644 +--- a/examples/A01/geant4/CMakeLists.txt ++++ b/examples/A01/geant4/CMakeLists.txt +@@ -12,7 +12,7 @@ + + #---------------------------------------------------------------------------- + # Setup the project +-cmake_minimum_required(VERSION 2.8.12 FATAL_ERROR) ++cmake_minimum_required(VERSION 2.8.12...4.0.1) + + + #---------------------------------------------------------------------------- +diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt +index 387f743c..6338db07 100644 +--- a/examples/CMakeLists.txt ++++ b/examples/CMakeLists.txt +@@ -13,7 +13,7 @@ + #---Adding examples subdirectories explicitly + # and a custom target to for building all VMC examples ------------- + +-cmake_minimum_required(VERSION 2.8.12 FATAL_ERROR) ++cmake_minimum_required(VERSION 2.8.12...4.0.1) + + + set(CMAKE_MODULE_PATH +diff --git a/examples/E01/CMakeLists.txt b/examples/E01/CMakeLists.txt +index d6c98dad..cfcaa280 100644 +--- a/examples/E01/CMakeLists.txt ++++ b/examples/E01/CMakeLists.txt +@@ -12,7 +12,7 @@ + + #---------------------------------------------------------------------------- + # Setup the project +-cmake_minimum_required(VERSION 2.8.12 FATAL_ERROR) ++cmake_minimum_required(VERSION 2.8.12...4.0.1) + + + #---------------------------------------------------------------------------- +diff --git a/examples/E02/CMakeLists.txt b/examples/E02/CMakeLists.txt +index ee2fc088..adb18b9a 100644 +--- a/examples/E02/CMakeLists.txt ++++ b/examples/E02/CMakeLists.txt +@@ -12,7 +12,7 @@ + + #---------------------------------------------------------------------------- + # Setup the project +-cmake_minimum_required(VERSION 2.8.12 FATAL_ERROR) ++cmake_minimum_required(VERSION 2.8.12...4.0.1) + + + #---------------------------------------------------------------------------- +diff --git a/examples/E03/CMakeLists.txt b/examples/E03/CMakeLists.txt +index d16307d6..8dd4b711 100644 +--- a/examples/E03/CMakeLists.txt ++++ b/examples/E03/CMakeLists.txt +@@ -13,7 +13,7 @@ + #---Adding examples subdirectories explicitly + # and a custom target to for building all VMC examples ------------- + +-cmake_minimum_required(VERSION 2.8.12 FATAL_ERROR) ++cmake_minimum_required(VERSION 2.8.12...4.0.1) + + + if(VMC_WITH_Multi) +diff --git a/examples/E03/E03a/CMakeLists.txt b/examples/E03/E03a/CMakeLists.txt +index 11e599a2..29c7199b 100644 +--- a/examples/E03/E03a/CMakeLists.txt ++++ b/examples/E03/E03a/CMakeLists.txt +@@ -12,7 +12,7 @@ + + #---------------------------------------------------------------------------- + # Setup the project +-cmake_minimum_required(VERSION 2.8.12 FATAL_ERROR) ++cmake_minimum_required(VERSION 2.8.12...4.0.1) + + + #---------------------------------------------------------------------------- +diff --git a/examples/E03/E03a/geant4/CMakeLists.txt b/examples/E03/E03a/geant4/CMakeLists.txt +index 6dc15c1d..df882c3a 100644 +--- a/examples/E03/E03a/geant4/CMakeLists.txt ++++ b/examples/E03/E03a/geant4/CMakeLists.txt +@@ -12,7 +12,7 @@ + + #---------------------------------------------------------------------------- + # Setup the project +-cmake_minimum_required(VERSION 2.8.12 FATAL_ERROR) ++cmake_minimum_required(VERSION 2.8.12...4.0.1) + + + #---------------------------------------------------------------------------- +diff --git a/examples/E03/E03b/CMakeLists.txt b/examples/E03/E03b/CMakeLists.txt +index 79db0001..aaa5b487 100644 +--- a/examples/E03/E03b/CMakeLists.txt ++++ b/examples/E03/E03b/CMakeLists.txt +@@ -12,7 +12,7 @@ + + #---------------------------------------------------------------------------- + # Setup the project +-cmake_minimum_required(VERSION 2.8.12 FATAL_ERROR) ++cmake_minimum_required(VERSION 2.8.12...4.0.1) + + + #---------------------------------------------------------------------------- +diff --git a/examples/E03/E03b/geant4/CMakeLists.txt b/examples/E03/E03b/geant4/CMakeLists.txt +index db38d6ab..744ca699 100644 +--- a/examples/E03/E03b/geant4/CMakeLists.txt ++++ b/examples/E03/E03b/geant4/CMakeLists.txt +@@ -12,7 +12,7 @@ + + #---------------------------------------------------------------------------- + # Setup the project +-cmake_minimum_required(VERSION 2.8.12 FATAL_ERROR) ++cmake_minimum_required(VERSION 2.8.12...4.0.1) + + + #---------------------------------------------------------------------------- +diff --git a/examples/E03/E03c/CMakeLists.txt b/examples/E03/E03c/CMakeLists.txt +index 995bfc0e..aab350cc 100644 +--- a/examples/E03/E03c/CMakeLists.txt ++++ b/examples/E03/E03c/CMakeLists.txt +@@ -12,7 +12,7 @@ + + #---------------------------------------------------------------------------- + # Setup the project +-cmake_minimum_required(VERSION 2.8.12 FATAL_ERROR) ++cmake_minimum_required(VERSION 2.8.12...4.0.1) + + + #---------------------------------------------------------------------------- +diff --git a/examples/E03/E03c/geant4/CMakeLists.txt b/examples/E03/E03c/geant4/CMakeLists.txt +index 64bb6f46..750043c2 100644 +--- a/examples/E03/E03c/geant4/CMakeLists.txt ++++ b/examples/E03/E03c/geant4/CMakeLists.txt +@@ -12,7 +12,7 @@ + + #---------------------------------------------------------------------------- + # Setup the project +-cmake_minimum_required(VERSION 2.8.12 FATAL_ERROR) ++cmake_minimum_required(VERSION 2.8.12...4.0.1) + + + #---------------------------------------------------------------------------- +diff --git a/examples/E06/CMakeLists.txt b/examples/E06/CMakeLists.txt +index e73be791..269802bb 100644 +--- a/examples/E06/CMakeLists.txt ++++ b/examples/E06/CMakeLists.txt +@@ -12,7 +12,7 @@ + + #---------------------------------------------------------------------------- + # Setup the project +-cmake_minimum_required(VERSION 2.8.12 FATAL_ERROR) ++cmake_minimum_required(VERSION 2.8.12...4.0.1) + + + #---------------------------------------------------------------------------- +diff --git a/examples/ExGarfield/CMakeLists.txt b/examples/ExGarfield/CMakeLists.txt +index f351b36f..e4edb6b5 100644 +--- a/examples/ExGarfield/CMakeLists.txt ++++ b/examples/ExGarfield/CMakeLists.txt +@@ -12,7 +12,7 @@ + + #---------------------------------------------------------------------------- + # Setup the project +-cmake_minimum_required(VERSION 2.8.12 FATAL_ERROR) ++cmake_minimum_required(VERSION 2.8.12...4.0.1) + + + #---------------------------------------------------------------------------- +diff --git a/examples/ExGarfield/geant4/CMakeLists.txt b/examples/ExGarfield/geant4/CMakeLists.txt +index 2fa00129..72c5cc03 100644 +--- a/examples/ExGarfield/geant4/CMakeLists.txt ++++ b/examples/ExGarfield/geant4/CMakeLists.txt +@@ -12,7 +12,7 @@ + + #---------------------------------------------------------------------------- + # Setup the project +-cmake_minimum_required(VERSION 2.8.12 FATAL_ERROR) ++cmake_minimum_required(VERSION 2.8.12...4.0.1) + + + #---------------------------------------------------------------------------- +diff --git a/examples/Gflash/CMakeLists.txt b/examples/Gflash/CMakeLists.txt +index 5474b8ab..85bbab16 100644 +--- a/examples/Gflash/CMakeLists.txt ++++ b/examples/Gflash/CMakeLists.txt +@@ -12,7 +12,7 @@ + + #---------------------------------------------------------------------------- + # Setup the project +-cmake_minimum_required(VERSION 2.8.12 FATAL_ERROR) ++cmake_minimum_required(VERSION 2.8.12...4.0.1) + + + #---------------------------------------------------------------------------- +diff --git a/examples/Monopole/CMakeLists.txt b/examples/Monopole/CMakeLists.txt +index 64f5a9be..cfcf1567 100644 +--- a/examples/Monopole/CMakeLists.txt ++++ b/examples/Monopole/CMakeLists.txt +@@ -12,7 +12,7 @@ + + #---------------------------------------------------------------------------- + # Setup the project +-cmake_minimum_required(VERSION 2.8.12 FATAL_ERROR) ++cmake_minimum_required(VERSION 2.8.12...4.0.1) + + + #---------------------------------------------------------------------------- +diff --git a/examples/TR/CMakeLists.txt b/examples/TR/CMakeLists.txt +index 74568186..31c336f8 100644 +--- a/examples/TR/CMakeLists.txt ++++ b/examples/TR/CMakeLists.txt +@@ -12,7 +12,7 @@ + + #---------------------------------------------------------------------------- + # Setup the project +-cmake_minimum_required(VERSION 2.8.12 FATAL_ERROR) ++cmake_minimum_required(VERSION 2.8.12...4.0.1) + + + #---------------------------------------------------------------------------- +diff --git a/g4root/CMakeLists.txt b/g4root/CMakeLists.txt +index b7507436..d9d5edf8 100644 +--- a/g4root/CMakeLists.txt ++++ b/g4root/CMakeLists.txt +@@ -11,7 +11,7 @@ + # I. Hrivnacova, 24/04/2014 + + #---CMake required version ----------------------------------------------------- +-cmake_minimum_required(VERSION 3.3 FATAL_ERROR) ++cmake_minimum_required(VERSION 3.3...4.0.1) + + #---Project G4Root ------------------------------------------------------------- + # +diff --git a/g4root/test/CMakeLists.txt b/g4root/test/CMakeLists.txt +index 35fe0973..b85da4fe 100644 +--- a/g4root/test/CMakeLists.txt ++++ b/g4root/test/CMakeLists.txt +@@ -2,7 +2,7 @@ + + #---Adding the OpNovice subdirectory explicitly + +-cmake_minimum_required(VERSION 2.8.12 FATAL_ERROR) ++cmake_minimum_required(VERSION 2.8.12...4.0.1) + + + set(CMAKE_MODULE_PATH +diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt +index 3ebb885e..3ff721c7 100644 +--- a/source/CMakeLists.txt ++++ b/source/CMakeLists.txt +@@ -11,7 +11,7 @@ + # I. Hrivnacova, 24/04/2014 + + #---CMake required version ----------------------------------------------------- +-cmake_minimum_required(VERSION 3.3 FATAL_ERROR) ++cmake_minimum_required(VERSION 3.3...4.0.1) + + #---Project Geant4VMC --------------------------------------------------------- + # From 03ff64525134ca564a6b199aef3f587656ea4dd0 Mon Sep 17 00:00:00 2001 From: Florian Uhlig Date: Tue, 24 Jun 2025 13:27:40 +0200 Subject: [PATCH 08/23] [legacy] geant3: Fix build system for CMake 4.0.1 Also fix an issue with the usage of the pythia6 library. The libarary wasn't found any longer such that it is explicitly added as dependency. --- cmake/legacy.cmake | 1 + legacy/geant3/fix_cmake.patch | 37 +++++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 legacy/geant3/fix_cmake.patch diff --git a/cmake/legacy.cmake b/cmake/legacy.cmake index 6b094ed4..5970eb7d 100644 --- a/cmake/legacy.cmake +++ b/cmake/legacy.cmake @@ -445,6 +445,7 @@ ExternalProject_Add(geant3 GIT_REPOSITORY https://github.com/FairRootGroup/geant3 GIT_TAG v${geant3_version} ${CMAKE_DEFAULT_ARGS} CMAKE_ARGS "-DBUILD_GCALOR=ON" + PATCH_COMMAND ${patch} -p1 -i "${CMAKE_SOURCE_DIR}/legacy/geant3/fix_cmake.patch" DEPENDS root vmc ${extract_source_cache_target} ${LOG_TO_FILE} ) diff --git a/legacy/geant3/fix_cmake.patch b/legacy/geant3/fix_cmake.patch new file mode 100644 index 00000000..5afa8aee --- /dev/null +++ b/legacy/geant3/fix_cmake.patch @@ -0,0 +1,37 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 918bef0..3efc04e 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -24,7 +24,7 @@ if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR}) + endif() + + #--- Define CMake requirements ------------------------------------------------- +-cmake_minimum_required(VERSION 2.8.12 FATAL_ERROR) ++cmake_minimum_required(VERSION 2.8.12...4.0.1) + + #--- Prepend our own CMake Modules to the search path -------------------------- + set(CMAKE_MODULE_PATH +diff --git a/cmake/Geant3BuildLibrary.cmake b/cmake/Geant3BuildLibrary.cmake +index 33ef258..dc1dc2b 100644 +--- a/cmake/Geant3BuildLibrary.cmake ++++ b/cmake/Geant3BuildLibrary.cmake +@@ -11,7 +11,7 @@ + # I. Hrivnacova, 13/06/2014 + + #---CMake required version ----------------------------------------------------- +-cmake_minimum_required(VERSION 2.8.12 FATAL_ERROR) ++cmake_minimum_required(VERSION 2.8.12...4.0.1) + + #------------------------------------------------------------------------------- + # Define installed names +diff --git a/cmake/Geant3RequiredPackages.cmake b/cmake/Geant3RequiredPackages.cmake +index 04182d5..2f2f306 100644 +--- a/cmake/Geant3RequiredPackages.cmake ++++ b/cmake/Geant3RequiredPackages.cmake +@@ -25,3 +25,6 @@ include(${ROOT_USE_FILE}) + + #-- VMC (required) ------------------------------------------------------------ + find_package(VMC CONFIG REQUIRED) ++find_package(Pythia6 REQUIRED) ++set(VMC_DEPS VMCLibrary ${Pythia6_LIBRARY}) ++ From baea65ddf8b59cb6e92633dd9c7a2635b894832b Mon Sep 17 00:00:00 2001 From: Florian Uhlig Date: Tue, 24 Jun 2025 13:12:10 +0200 Subject: [PATCH 09/23] [legacy] geant4: Fix config file The fix prevents a crash about wrong CMake versions when compiling geant4_vmc. --- cmake/legacy.cmake | 1 + legacy/geant4/fix_cmake.patch | 11 +++++++++++ 2 files changed, 12 insertions(+) create mode 100644 legacy/geant4/fix_cmake.patch diff --git a/cmake/legacy.cmake b/cmake/legacy.cmake index 5970eb7d..537c073e 100644 --- a/cmake/legacy.cmake +++ b/cmake/legacy.cmake @@ -361,6 +361,7 @@ ExternalProject_Add(geant4 "-DGEANT4_BUILD_VERBOSE_CODE=ON" "-DGEANT4_BUILD_BUILTIN_BACKTRACE=OFF" ${cmake_python_config_old} + PATCH_COMMAND ${patch} -p1 -i "${CMAKE_SOURCE_DIR}/legacy/geant4/fix_cmake.patch" DEPENDS boost clhep ${extract_source_cache_target} ${LOG_TO_FILE} ) diff --git a/legacy/geant4/fix_cmake.patch b/legacy/geant4/fix_cmake.patch new file mode 100644 index 00000000..94e25c07 --- /dev/null +++ b/legacy/geant4/fix_cmake.patch @@ -0,0 +1,11 @@ +--- a/source/externals/ptl/cmake/Templates/PTLConfig.cmake.in 2025-06-24 13:07:30 ++++ b/source/externals/ptl/cmake/Templates/PTLConfig.cmake.in 2025-06-24 13:08:20 +@@ -3,7 +3,7 @@ + # + @PACKAGE_INIT@ + +-cmake_minimum_required(VERSION 3.8) ++cmake_minimum_required(VERSION 3.8...4.0.1) + + # -------------------------------------------------------------------------------------- # + # basic paths From de226289dec47ddc996f9013c12ba13aada76101 Mon Sep 17 00:00:00 2001 From: Florian Uhlig Date: Tue, 24 Jun 2025 08:08:43 +0200 Subject: [PATCH 10/23] [legacy] build system: Allow setting the proper SDK Before a SDK defined via the CMake parameter CMAKE_OSX_SYSROOT was overwritten with the value extracted from brew. --- FairSoftConfig.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/FairSoftConfig.cmake b/FairSoftConfig.cmake index 115c11fc..4485bfa0 100644 --- a/FairSoftConfig.cmake +++ b/FairSoftConfig.cmake @@ -74,7 +74,7 @@ endif() # `brew` contains some logic to detect installed SDKs on your machine and can choose the latest. # Since we anyways depend on brew, let's use it. # -if(APPLE) +if(APPLE AND NOT CMAKE_OSX_SYSROOT) execute_process(COMMAND brew ruby -e "puts MacOS.sdk_path" OUTPUT_VARIABLE macos_sdk_path) string(STRIP "${macos_sdk_path}" macos_sdk_path) set(CMAKE_OSX_SYSROOT "${macos_sdk_path}" CACHE FILEPATH "macOS SDK" FORCE) From 6ea4176003b216d7c5adb14efab16ba877f89c06 Mon Sep 17 00:00:00 2001 From: Florian Uhlig Date: Mon, 23 Jun 2025 16:48:08 +0200 Subject: [PATCH 11/23] [legacy] root: Fix compilation on macosx with Clang 17 and SDK 15 Clang 17 remove the header fp.h which is used in ROOT's copy of libAfterimage. Add a patch which uses math.h instead. The included ROOT version can't be compiled any longer with the SDK 15. Specifing the older SDK 14 when running CMake (with -DCMAKE_OSX_SYSROOT) only works partly since rootcling still uses the latest SDK version. Add a patch such that rootcling also uses the specified SDK. All projects depending on ROOT need also to set CMAKE_OSX_SYSROOT to the same value used when building ROOT. Otherwise the dictionary generation may fail. Fix patch for ROOT using CMAKE_OSX_SYSROOT minimize the patch --- cmake/legacy.cmake | 4 +- legacy/root/fix_macos_sdk_for_rootcling.patch | 86 +++++++++++++++++++ legacy/root/fix_macosx_clang17.patch | 20 +++++ 3 files changed, 109 insertions(+), 1 deletion(-) create mode 100644 legacy/root/fix_macos_sdk_for_rootcling.patch create mode 100644 legacy/root/fix_macosx_clang17.patch diff --git a/cmake/legacy.cmake b/cmake/legacy.cmake index 537c073e..51b761c2 100644 --- a/cmake/legacy.cmake +++ b/cmake/legacy.cmake @@ -379,7 +379,7 @@ else() unset(root_cocoa) set(root_x11 ON) endif() -find_package(nlohmann_json 3.9) +find_package(nlohmann_json 3.9 QUIET) if(nlohmann_json_FOUND) set(root_builtin_nlohmannjson "-Dbuiltin_nlohmannjson=OFF") else() @@ -427,6 +427,8 @@ ExternalProject_Add(root UPDATE_DISCONNECTED ON PATCH_COMMAND ${patch} -p1 -i "${CMAKE_SOURCE_DIR}/legacy/root/fix_macos_sdk_mismatch.patch" COMMAND ${patch} -p1 -i "${CMAKE_SOURCE_DIR}/legacy/root/fix_macosx_findOpenGL.patch" + COMMAND ${patch} -p1 -i "${CMAKE_SOURCE_DIR}/legacy/root/fix_macosx_clang17.patch" + COMMAND ${patch} -p1 -i "${CMAKE_SOURCE_DIR}/legacy/root/fix_macos_sdk_for_rootcling.patch" DEPENDS pythia6 pythia8 vc ${extract_source_cache_target} ${LOG_TO_FILE} ) diff --git a/legacy/root/fix_macos_sdk_for_rootcling.patch b/legacy/root/fix_macos_sdk_for_rootcling.patch new file mode 100644 index 00000000..32690baa --- /dev/null +++ b/legacy/root/fix_macos_sdk_for_rootcling.patch @@ -0,0 +1,86 @@ +diff --git a/cmake/modules/RootMacros.cmake b/cmake/modules/RootMacros.cmake +index 616b133943..0ed52ee3bc 100644 +--- a/cmake/modules/RootMacros.cmake ++++ b/cmake/modules/RootMacros.cmake +@@ -604,6 +604,8 @@ function(ROOT_GENERATE_DICTIONARY dictionary) + if(ARG_STAGE1) + if(MSVC AND CMAKE_ROOTTEST_DICT) + set(command ${CMAKE_COMMAND} -E ${CMAKE_BINARY_DIR}/bin/rootcling_stage1.exe) ++ elseif(APPLE AND CMAKE_OSX_SYSROOT) ++ set(command ${CMAKE_COMMAND} -E env "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/lib:$ENV{LD_LIBRARY_PATH}" env "SDKROOT=${CMAKE_OSX_SYSROOT}" $) + else() + set(command ${CMAKE_COMMAND} -E env "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/lib:$ENV{LD_LIBRARY_PATH}" $) + endif() +@@ -613,6 +615,11 @@ function(ROOT_GENERATE_DICTIONARY dictionary) + if(CMAKE_PROJECT_NAME STREQUAL ROOT) + if(MSVC AND CMAKE_ROOTTEST_DICT) + set(command ${CMAKE_COMMAND} -E env "ROOTIGNOREPREFIX=1" ${CMAKE_BINARY_DIR}/bin/rootcling.exe) ++ elseif(APPLE AND CMAKE_OSX_SYSROOT) ++ set(command ${CMAKE_COMMAND} -E env "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/lib:$ENV{LD_LIBRARY_PATH}" env "SDKROOT=${CMAKE_OSX_SYSROOT}" ++ "ROOTIGNOREPREFIX=1" $ -rootbuild) ++ # Modules need RConfigure.h copied into include/. ++ set(ROOTCINTDEP rootcling rconfigure) + else() + set(command ${CMAKE_COMMAND} -E env "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/lib:$ENV{LD_LIBRARY_PATH}" + "ROOTIGNOREPREFIX=1" $ -rootbuild) +@@ -620,7 +627,9 @@ function(ROOT_GENERATE_DICTIONARY dictionary) + set(ROOTCINTDEP rootcling rconfigure) + endif() + elseif(TARGET ROOT::rootcling) +- if(APPLE) ++ if(APPLE AND CMAKE_OSX_SYSROOT) ++ set(command ${CMAKE_COMMAND} -E env "DYLD_LIBRARY_PATH=${ROOT_LIBRARY_DIR}:$ENV{DYLD_LIBRARY_PATH}" env "SDKROOT=${CMAKE_OSX_SYSROOT}" $) ++ elseif(APPLE) + set(command ${CMAKE_COMMAND} -E env "DYLD_LIBRARY_PATH=${ROOT_LIBRARY_DIR}:$ENV{DYLD_LIBRARY_PATH}" $) + else() + set(command ${CMAKE_COMMAND} -E env "LD_LIBRARY_PATH=${ROOT_LIBRARY_DIR}:$ENV{LD_LIBRARY_PATH}" $) +diff --git a/etc/dictpch/makepch.py b/etc/dictpch/makepch.py +index 8233f4e2f2..c54c2e959a 100755 +--- a/etc/dictpch/makepch.py ++++ b/etc/dictpch/makepch.py +@@ -112,8 +112,12 @@ def makepch(): + + my_env = os.environ.copy() + existing_ldlib = my_env.get("LD_LIBRARY_PATH") ++ osx_sdk = my_env.get("CMAKE_OSX_SYSROOT") ++ + if not existing_ldlib: existing_ldlib = "" + my_env["LD_LIBRARY_PATH"] = os.path.join(rootdir, "lib") + ":" + existing_ldlib ++ if osx_sdk: ++ my_env["SDKROOT"] = 'osx_sdk' + + ret = subprocess.call(command.split(), env=my_env) + if ret == 0: +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 77c7762225..c5feadd9e1 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -524,6 +524,12 @@ else() + get_property(__pch_dependencies GLOBAL PROPERTY ROOT_PCH_DEPENDENCIES) + get_property(__pch_dictionaries GLOBAL PROPERTY ROOT_PCH_DICTIONARIES) + ++ if (APPLE AND CMAKE_OSX_SYSROOT) ++ set(_sysroot_arg "SDKROOT=${CMAKE_OSX_SYSROOT}") ++ else() ++ set(_sysroot_arg) ++ endif() ++ + add_custom_command(OUTPUT etc/allDict.cxx.pch + BYPRODUCTS + etc/dictpch/allCppflags.txt +@@ -533,9 +539,12 @@ else() + ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/build/unix/makepchinput.py + ${CMAKE_SOURCE_DIR} . ${pyroot_legacy} ${__cling_pch} + COMMAND +- ${CMAKE_COMMAND} -E env ROOTIGNOREPREFIX=1 ${PYTHON_EXECUTABLE} +- ${CMAKE_SOURCE_DIR}/etc/dictpch/makepch.py etc/allDict.cxx.pch +- ${__allIncludes} -I${CMAKE_BINARY_DIR}/include -I${CMAKE_SOURCE_DIR}/core ++ ${CMAKE_COMMAND} -E env ++ ${_sysroot_arg} ++ ROOTIGNOREPREFIX=1 ++ ${PYTHON_EXECUTABLE} ++ ${CMAKE_SOURCE_DIR}/etc/dictpch/makepch.py etc/allDict.cxx.pch ++ ${__allIncludes} -I${CMAKE_BINARY_DIR}/include -I${CMAKE_SOURCE_DIR}/core + DEPENDS + rootcling ${__pch_dependencies} ${__pch_dictionaries} + ${CMAKE_SOURCE_DIR}/build/unix/makepchinput.py diff --git a/legacy/root/fix_macosx_clang17.patch b/legacy/root/fix_macosx_clang17.patch new file mode 100644 index 00000000..bb1fa085 --- /dev/null +++ b/legacy/root/fix_macosx_clang17.patch @@ -0,0 +1,20 @@ +diff --git a/graf2d/asimage/src/libAfterImage/libpng/pngconf.h b/graf2d/asimage/src/libAfterImage/libpng/pngconf.h +index f0a69ccb6c..8ad4eb4ec3 100644 +--- a/graf2d/asimage/src/libAfterImage/libpng/pngconf.h ++++ b/graf2d/asimage/src/libAfterImage/libpng/pngconf.h +@@ -429,9 +429,12 @@ + * as it seems it doesn't agree with , yet we should really use + * if possible. + */ +-# if !defined(__MATH_H__) && !defined(__MATH_H) && !defined(__cmath__) +-# include +-# endif ++// On recent macosx systems fp.h is deprecated, so use the ++// normal math library ++# include ++//# if !defined(__MATH_H__) && !defined(__MATH_H) && !defined(__cmath__) ++//# include ++//# endif + # else + # include + # endif From e1ac7286d05a1cbbe442d29020f0bc98858180db Mon Sep 17 00:00:00 2001 From: Florian Uhlig Date: Tue, 24 Jun 2025 08:11:30 +0200 Subject: [PATCH 12/23] [legacy] geant4: Fix compilation crash with Clang 17 Fix a typo in the code. This code could actually never be compiled and it is unclear why this compilation error only popped up now with Clang 17. --- cmake/legacy.cmake | 1 + legacy/geant4/fix_typo.patch | 11 +++++++++++ 2 files changed, 12 insertions(+) create mode 100644 legacy/geant4/fix_typo.patch diff --git a/cmake/legacy.cmake b/cmake/legacy.cmake index 51b761c2..48282ad5 100644 --- a/cmake/legacy.cmake +++ b/cmake/legacy.cmake @@ -362,6 +362,7 @@ ExternalProject_Add(geant4 "-DGEANT4_BUILD_BUILTIN_BACKTRACE=OFF" ${cmake_python_config_old} PATCH_COMMAND ${patch} -p1 -i "${CMAKE_SOURCE_DIR}/legacy/geant4/fix_cmake.patch" + COMMAND ${patch} -p1 -i "${CMAKE_SOURCE_DIR}/legacy/geant4/fix_typo.patch" DEPENDS boost clhep ${extract_source_cache_target} ${LOG_TO_FILE} ) diff --git a/legacy/geant4/fix_typo.patch b/legacy/geant4/fix_typo.patch new file mode 100644 index 00000000..e70d729c --- /dev/null +++ b/legacy/geant4/fix_typo.patch @@ -0,0 +1,11 @@ +--- a/source/externals/g4tools/include/tools/wroot/columns.icc_orig 2025-06-23 17:33:15 ++++ b/source/externals/g4tools/include/tools/wroot/columns.icc 2025-06-23 17:33:49 +@@ -399,7 +399,7 @@ + protected: + std_vector_column_ref(const std_vector_column_ref& a_from) + :icol(a_from) +- ,m_branch(a_from.m_barnch) ++ ,m_branch(a_from.m_branch) + ,m_ref(a_from.m_ref) + ,m_leaf(0) + ,m_leaf_count(0) From 6a8262036a51727b4b5e3807f0c57365eae43296 Mon Sep 17 00:00:00 2001 From: Florian Uhlig Date: Wed, 17 Sep 2025 10:45:38 +0200 Subject: [PATCH 13/23] [legacy] setup scripts: Add new packages for macosx The default bash version on macosx is to old to support all features needed in the test suite of FairRoot. The system version of make doesn't properly support the jobserver such that the build process ins't properly parallelized. --- legacy/setup-macos.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/legacy/setup-macos.sh b/legacy/setup-macos.sh index 8b0b0091..eb0f7ce4 100755 --- a/legacy/setup-macos.sh +++ b/legacy/setup-macos.sh @@ -1,7 +1,7 @@ #! /bin/bash brew update -brew install cmake cfitsio coreutils davix expat icu4c fftw freetype \ +brew install bash cmake cfitsio coreutils davix expat icu4c fftw freetype \ ftgl gcc giflib gl2ps gpatch graphviz grpc gsl libjpeg libpng \ - libtiff lz4 mesa-glu numpy openlibm openssl pcre pkg-config \ + libtiff lz4 make mesa-glu numpy openlibm openssl pcre pkg-config \ protobuf python sqlite tbb xerces-c xrootd xxhash xz yaml-cpp zstd From cd3a4e03ce5b03176005e36e839989b9559a07a6 Mon Sep 17 00:00:00 2001 From: Florian Uhlig Date: Mon, 22 Sep 2025 14:31:52 +0200 Subject: [PATCH 14/23] [legacy] On macosx use Homebrews patch and make --- cmake/legacy.cmake | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/cmake/legacy.cmake b/cmake/legacy.cmake index 48282ad5..79316fd5 100644 --- a/cmake/legacy.cmake +++ b/cmake/legacy.cmake @@ -45,9 +45,31 @@ endif() find_package(Git REQUIRED) -find_package(Patch REQUIRED) + +if (APPLE) + find_program(_patch NAMES gpatch patch) + if(NOT _patch) + message(FATAL_ERROR "Could not find gpatch or patch command") + else() + message(STATUS "Found Patch: ${_patch}") + endif() + set(patch ${_patch} --merge) +else() + find_package(Patch REQUIRED) + set(patch $ --merge) +endif() + +if(APPLE AND ${CMAKE_MAKE_PROGRAM} MATCHES ".*/make$") + find_program(_make NAMES gmake make) + if(NOT _make) + message(FATAL_ERROR "Could not find gmake or make command") + else() + message(STATUS "Found Make: ${_make}") + endif() + set(CMAKE_MAKE_PROGRAM ${_make} CACHE FILEPATH "Make program" FORCE) +endif() + find_package(UnixCommands) -set(patch $ --merge) set(PROJECT_MIN_CXX_STANDARD 17) From a21255455b5ec6fdd68206743d36bb8cb1a0f278 Mon Sep 17 00:00:00 2001 From: Florian Uhlig Date: Wed, 17 Sep 2025 10:47:47 +0200 Subject: [PATCH 15/23] [legacy] documentation: Add infos macosx Describe some known problems on macosx and the corresponding solutions. --- legacy/README.md | 35 +++++++++++++++++++++++++++++++++++ legacy/advanced.md | 11 +++++++++++ 2 files changed, 46 insertions(+) diff --git a/legacy/README.md b/legacy/README.md index b900930e..42654e6d 100644 --- a/legacy/README.md +++ b/legacy/README.md @@ -51,6 +51,41 @@ cmake -S -B -C /FairSoftConfig. Set the installation prefix and more customization options in the [`FairSoftConfig.cmake`](../FairSoftConfig.cmake) file itself. +#### 3.1 CMake configure step for macOS users + +There are some known problems about the compilation of FairSoft on macosx. + +The first two problems are related to the version of the **patch** and **make** +commands on macosx. + +The **patch** command does not support the needed parameters, +so one needs ot install a version of the **patch** command with brew. +The **make** command doesn't properly support the jobsserver which allows +parallel builds of all the packages contained in FairSoft which slows down +the installation enormously. The version provided by brew fixes the problem. +Both packages are already added in the updated setup script for macosx. +If found the packages from the homebrew installation directory will be used. + +The last problem is related to the macosx, compiler and SDK versions, such +that it depends on the personal setup. As described in more detail at +[macOS SDK](advanced.md#macos-sdk)! ROOT is very picky about the compiler +and the connected SDK. Compiling older ROOT versions with newer compilers +may need using an older SDK version. If not specified explicitely the +latest SDK version is used. To use an older SDK version on needs to add the +following parameter when running CMake + +``` +-DCMAKE_OSX_SYSROOT= +``` + +e.g. for Apple Clang 17 on macosx 15 or Apple Clang 16 on macosx 14 + +``` +-DCMAKE_OSX_SYSROOT=/Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk +``` + +More information can be found at + **macOS users**: Notice [macOS SDK](advanced.md#macos-sdk)! ### 4. CMake build/install step diff --git a/legacy/advanced.md b/legacy/advanced.md index a6644adf..44dbcb0e 100644 --- a/legacy/advanced.md +++ b/legacy/advanced.md @@ -59,6 +59,17 @@ installed SDK version is the most sensible course of action here. `brew` contains already some logic to detect and choose the latest SDK. See the "macOS SDK" section in [FairSoftConfig.cmake](../FairSoftConfig.cmake). +The downside with picking the latest SDK version is that some older ROOT +versions can't be compiled any longer after updating the compiler and the +connected SDK. As described above the problems with compilation errors due +to **wrong** SDKs are because of ROOT and there mainly becuase of rootcling. +To overcome the problem and allow a more flexible compilation also with +non default SDKs we add the possibilty to define an older SDK when running +CMake. There are some additional changes in the build system of ROOT such +that rootcling take the setting properly into account. With this changes it +becomes possible to install FairSoft jan24 (ROOT 6.30.08) with Apple Clang +17 on macosx 15. + **If you have a deeper understanding of this issue and know a better solution, please let us know!** From a2888508f2b4816587868205ceed6ff30a5ea35a Mon Sep 17 00:00:00 2001 From: Florian Uhlig Date: Tue, 23 Sep 2025 14:59:26 +0200 Subject: [PATCH 16/23] [legacy] boost: Build Boost with correct SDK Pass the needed information to the boost build system if a non standard SDK is used. --- cmake/legacy.cmake | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/cmake/legacy.cmake b/cmake/legacy.cmake index 79316fd5..306f1842 100644 --- a/cmake/legacy.cmake +++ b/cmake/legacy.cmake @@ -167,6 +167,7 @@ ExternalProject_Add(faircmakemodules list(APPEND packages boost) set(boost_version "83") set(boost_features + "-d+2" "cxxstd=${CMAKE_CXX_STANDARD}" "link=shared" "threading=multi" @@ -175,6 +176,11 @@ set(boost_features "pch=off" ) +if (APPLE AND CMAKE_OSX_SYSROOT) + list(APPEND boost_features "cxxflags='-isysroot${CMAKE_OSX_SYSROOT}'") + list(APPEND boost_features "linkflags='-isysroot${CMAKE_OSX_SYSROOT}'") +endif() + list(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_PREFIX}/lib" isSystemDir) if("${isSystemDir}" STREQUAL "-1") From ee8846ee5ff9f87489afddcdcb11102f54c1f668 Mon Sep 17 00:00:00 2001 From: Florian Uhlig Date: Tue, 23 Sep 2025 17:57:20 +0200 Subject: [PATCH 17/23] [legacy] pythia8: Build Pythia8 with correct SDK Pass the needed information to the pythia8 build system if a non standard SDK is used. --- cmake/legacy.cmake | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/cmake/legacy.cmake b/cmake/legacy.cmake index 306f1842..5609c1db 100644 --- a/cmake/legacy.cmake +++ b/cmake/legacy.cmake @@ -342,6 +342,12 @@ ExternalProject_Add_Step(clhep move_dir DEPENDEES download DEPENDERS patch LOG ON ) +if (APPLE AND CMAKE_OSX_SYSROOT) + set(_pythia8_macosx_sdk -isysroot${CMAKE_OSX_SYSROOT}) +else() + set(_pythia8_macosx_sdk) +endif() + list(APPEND packages pythia8) set(pythia8_version "8310") string(SUBSTRING "${pythia8_version}" 0 2 pythia8_major_version) @@ -354,7 +360,7 @@ ExternalProject_Add(pythia8 "--with-hepmc2=${CMAKE_INSTALL_PREFIX}" "--prefix=${CMAKE_INSTALL_PREFIX}" "--cxx=${CMAKE_CXX_COMPILER}" - "--cxx-common='${CMAKE_CXX_FLAGS_${selected}} -fPIC -std=c++${CMAKE_CXX_STANDARD}'" + "--cxx-common='${CMAKE_CXX_FLAGS_${selected}} -fPIC -std=c++${CMAKE_CXX_STANDARD} ${_pythia8_macosx_sdk}'" DEPENDS hepmc ${extract_source_cache_target} ${LOG_TO_FILE} ) From 49a454dc7a25e95881245f65883953032b6de459 Mon Sep 17 00:00:00 2001 From: Florian Uhlig Date: Sun, 28 Sep 2025 15:17:18 +0200 Subject: [PATCH 18/23] [legacy] root: Fix build with gcc15 Some legacy C code can't be compiled with C standard version 23 which is the new default for gcc15 so use C standard version 11 for the compilation. Add some missing include statements for . Probably due to header cleanup in the include files of gcc 15. --- cmake/legacy.cmake | 2 ++ legacy/root/fix_gcc15.patch | 48 +++++++++++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+) create mode 100644 legacy/root/fix_gcc15.patch diff --git a/cmake/legacy.cmake b/cmake/legacy.cmake index 5609c1db..8cc8b53c 100644 --- a/cmake/legacy.cmake +++ b/cmake/legacy.cmake @@ -425,6 +425,7 @@ ExternalProject_Add(root GIT_REPOSITORY https://github.com/root-project/root/ GIT_TAG v${root_version_gittag} GIT_SHALLOW 1 ${CMAKE_DEFAULT_ARGS} CMAKE_ARGS + "-DCMAKE_C_STANDARD=11" "-Daqua=ON" "-Dasimage=ON" "-Dcintex=OFF" @@ -464,6 +465,7 @@ ExternalProject_Add(root COMMAND ${patch} -p1 -i "${CMAKE_SOURCE_DIR}/legacy/root/fix_macosx_findOpenGL.patch" COMMAND ${patch} -p1 -i "${CMAKE_SOURCE_DIR}/legacy/root/fix_macosx_clang17.patch" COMMAND ${patch} -p1 -i "${CMAKE_SOURCE_DIR}/legacy/root/fix_macos_sdk_for_rootcling.patch" + COMMAND ${patch} -p1 -i "${CMAKE_SOURCE_DIR}/legacy/root/fix_gcc15.patch" DEPENDS pythia6 pythia8 vc ${extract_source_cache_target} ${LOG_TO_FILE} ) diff --git a/legacy/root/fix_gcc15.patch b/legacy/root/fix_gcc15.patch new file mode 100644 index 00000000..339ac75d --- /dev/null +++ b/legacy/root/fix_gcc15.patch @@ -0,0 +1,48 @@ +diff --git a/graf2d/gpadv7/inc/ROOT/RVirtualCanvasPainter.hxx b/graf2d/gpadv7/inc/ROOT/RVirtualCanvasPainter.hxx +index 881f1ecf8e..ee926dd050 100644 +--- a/graf2d/gpadv7/inc/ROOT/RVirtualCanvasPainter.hxx ++++ b/graf2d/gpadv7/inc/ROOT/RVirtualCanvasPainter.hxx +@@ -9,6 +9,7 @@ + #ifndef ROOT7_RVirtualCanvasPainter + #define ROOT7_RVirtualCanvasPainter + ++#include + #include + #include + #include +diff --git a/interpreter/llvm-project/llvm/include/llvm/ADT/SmallVector.h b/interpreter/llvm-project/llvm/include/llvm/ADT/SmallVector.h +index b8a11030fc..8bce0ea958 100644 +--- a/interpreter/llvm-project/llvm/include/llvm/ADT/SmallVector.h ++++ b/interpreter/llvm-project/llvm/include/llvm/ADT/SmallVector.h +@@ -21,6 +21,7 @@ + #include + #include + #include ++#include + #include + #include + #include +diff --git a/interpreter/llvm-project/llvm/lib/Target/X86/MCTargetDesc/X86MCTargetDesc.h b/interpreter/llvm-project/llvm/lib/Target/X86/MCTargetDesc/X86MCTargetDesc.h +index 35604cd3ec..93cb72ad7f 100644 +--- a/interpreter/llvm-project/llvm/lib/Target/X86/MCTargetDesc/X86MCTargetDesc.h ++++ b/interpreter/llvm-project/llvm/lib/Target/X86/MCTargetDesc/X86MCTargetDesc.h +@@ -13,6 +13,7 @@ + #ifndef LLVM_LIB_TARGET_X86_MCTARGETDESC_X86MCTARGETDESC_H + #define LLVM_LIB_TARGET_X86_MCTARGETDESC_X86MCTARGETDESC_H + ++#include + #include + #include + +diff --git a/tmva/tmva/inc/TMVA/RTensor.hxx b/tmva/tmva/inc/TMVA/RTensor.hxx +index d645009ee0..4832535ccc 100644 +--- a/tmva/tmva/inc/TMVA/RTensor.hxx ++++ b/tmva/tmva/inc/TMVA/RTensor.hxx +@@ -1,6 +1,7 @@ + #ifndef TMVA_RTENSOR + #define TMVA_RTENSOR + ++#include + #include + #include // std::size_t + #include // std::runtime_error From 6678e083fbbc4a23126ca4ed3b4ae83cf469f5c8 Mon Sep 17 00:00:00 2001 From: Florian Uhlig Date: Sun, 28 Sep 2025 15:20:24 +0200 Subject: [PATCH 19/23] [legacy] geant3: Fix compilation for gcc15 The legacy C code can't be compiled with C standard version 23 which is the new default for gcc15 so use C standard version 11 for the compilation. For unknown reasons the pythia library isn't found any longer which is fixed by adding possible library names. --- cmake/legacy.cmake | 1 + legacy/geant3/fix_cmake.patch | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/cmake/legacy.cmake b/cmake/legacy.cmake index 8cc8b53c..142124d5 100644 --- a/cmake/legacy.cmake +++ b/cmake/legacy.cmake @@ -485,6 +485,7 @@ ExternalProject_Add(geant3 GIT_REPOSITORY https://github.com/FairRootGroup/geant3 GIT_TAG v${geant3_version} ${CMAKE_DEFAULT_ARGS} CMAKE_ARGS "-DBUILD_GCALOR=ON" + "-DCMAKE_C_STANDARD=11" PATCH_COMMAND ${patch} -p1 -i "${CMAKE_SOURCE_DIR}/legacy/geant3/fix_cmake.patch" DEPENDS root vmc ${extract_source_cache_target} ${LOG_TO_FILE} diff --git a/legacy/geant3/fix_cmake.patch b/legacy/geant3/fix_cmake.patch index 5afa8aee..ac2f9947 100644 --- a/legacy/geant3/fix_cmake.patch +++ b/legacy/geant3/fix_cmake.patch @@ -35,3 +35,25 @@ index 04182d5..2f2f306 100644 +find_package(Pythia6 REQUIRED) +set(VMC_DEPS VMCLibrary ${Pythia6_LIBRARY}) + +diff --git a/cmake/FindPythia6.cmake b/cmake/FindPythia6.cmake +index 0102be8..71a291d 100644 +--- a/cmake/FindPythia6.cmake ++++ b/cmake/FindPythia6.cmake +@@ -28,7 +28,7 @@ + #message(STATUS "Looking for Pythia6 ...") + + find_path(Pythia6_LIBRARY_DIR +- NAMES libPythia6.so libPythia6.dylib ++ NAMES libPythia6.so libPythia6.dylib libpythia6.so libpythia6.dylib + pythia6-$ENV{PYTHIA6_VERSION}.so pythia6-$ENV{PYTHIA6_VERSION}.dylib + PATHS + ${Pythia6_LIB_DIR} +@@ -39,7 +39,7 @@ find_path(Pythia6_LIBRARY_DIR + ) + + find_library(Pythia6_LIBRARY +- NAMES Pythia6 pythia6-$ENV{PYTHIA6_VERSION} ++ NAMES Pythia6 pythia6 pythia6-$ENV{PYTHIA6_VERSION} + HINTS ${Pythia6_LIBRARY_DIR}) + + set(Pythia6_LIBRARIES ${Pythia6_LIBRARY}) From 24febab4890ce450bb7fd6fd828c32c7a0c2554d Mon Sep 17 00:00:00 2001 From: Florian Uhlig Date: Sun, 28 Sep 2025 15:23:37 +0200 Subject: [PATCH 20/23] [legacy] tests: Fix test for gcc15 Use C11 as standard C version when compiling FairRoot. The C code of the MbsApi can't be compiled with C23 which is the new default version with gcc15. --- test/legacy/fairroot.sh.in | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/legacy/fairroot.sh.in b/test/legacy/fairroot.sh.in index 460b27e5..d921f566 100755 --- a/test/legacy/fairroot.sh.in +++ b/test/legacy/fairroot.sh.in @@ -11,7 +11,8 @@ pushd $sourcedir mkdir -p build/install export FAIRROOTPATH="$(realpath ./build/install)" cmake -S. -Bbuild \ - -DCMAKE_INSTALL_PREFIX=$FAIRROOTPATH + -DCMAKE_INSTALL_PREFIX=$FAIRROOTPATH \ + -DCMAKE_C_STANDARD=11 cmake --build build --target install -j @NCPUS@ pushd build ctest --output-on-failure -E "(ex_MQ_pixel|pixelSplitDDS).*" -j @NCPUS@ $(ctest --version | grep -q "3\.16" || echo "--repeat until-pass:5") From e474e36d529f7ec08356e35ac308ce0ea39237c3 Mon Sep 17 00:00:00 2001 From: Florian Uhlig Date: Wed, 1 Oct 2025 11:18:20 +0200 Subject: [PATCH 21/23] [legacy] root: Fix compilation for some systems The version of ftgl contained in the ROOT source code results in a compilation error with the gcc14 compiler suite used in Debian 13 and the gcc15 compiler suite in OpenSuse 16.0. For all other tested system the code is okay. The problem was also found by the Debian team https://www.mail-archive.com/debian-qa-packages@lists.debian.org/msg81745.html and a fix is available from upstream https://github.com/frankheckenbach/ftgl/pull/20 Add a cmake check for OS and apply the fix only in case a Debian 13 or OpenSuse 16.0 is found. --- cmake/legacy.cmake | 30 ++++++++++++++++++++++++++++ legacy/root/fix_ftgl.patch | 40 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 70 insertions(+) create mode 100644 legacy/root/fix_ftgl.patch diff --git a/cmake/legacy.cmake b/cmake/legacy.cmake index 142124d5..a90801d1 100644 --- a/cmake/legacy.cmake +++ b/cmake/legacy.cmake @@ -421,6 +421,35 @@ else() set(root_builtin_nlohmannjson "-Dbuiltin_nlohmannjson=ON") endif() +# Extract the OS and VERSION on Linux +if(CMAKE_SYSTEM_NAME STREQUAL "Linux") + execute_process(COMMAND cat /etc/os-release + COMMAND grep ID= + COMMAND grep -v VERSION + COMMAND cut -d= -f2 + OUTPUT_VARIABLE OS_NAME + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + string(REPLACE "\"" "" OS_NAME ${OS_NAME}) + + execute_process(COMMAND cat /etc/os-release + COMMAND grep ID= + COMMAND grep VERSION + COMMAND cut -d= -f2 + COMMAND cut -d\" -f2 + OUTPUT_VARIABLE OS_VERSION + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + + if(${OS_NAME}${OS_VERSION} MATCHES "debian13" OR ${OS_NAME}${OS_VERSION} MATCHES "opensuse-leap16.0") + set(debian13_patch COMMAND ${patch} -p1 -i "${CMAKE_SOURCE_DIR}/legacy/root/fix_ftgl.patch") + else() + set(debian13_patch) + endif() +else() + set(debian13_patch) +endif() + ExternalProject_Add(root GIT_REPOSITORY https://github.com/root-project/root/ GIT_TAG v${root_version_gittag} GIT_SHALLOW 1 @@ -466,6 +495,7 @@ ExternalProject_Add(root COMMAND ${patch} -p1 -i "${CMAKE_SOURCE_DIR}/legacy/root/fix_macosx_clang17.patch" COMMAND ${patch} -p1 -i "${CMAKE_SOURCE_DIR}/legacy/root/fix_macos_sdk_for_rootcling.patch" COMMAND ${patch} -p1 -i "${CMAKE_SOURCE_DIR}/legacy/root/fix_gcc15.patch" + ${debian13_patch} DEPENDS pythia6 pythia8 vc ${extract_source_cache_target} ${LOG_TO_FILE} ) diff --git a/legacy/root/fix_ftgl.patch b/legacy/root/fix_ftgl.patch new file mode 100644 index 00000000..9fb7b07e --- /dev/null +++ b/legacy/root/fix_ftgl.patch @@ -0,0 +1,40 @@ +diff --git a/graf3d/ftgl/inc/FTContour.h b/graf3d/ftgl/inc/FTContour.h +index 8eb5132165..899643e109 100644 +--- a/graf3d/ftgl/inc/FTContour.h ++++ b/graf3d/ftgl/inc/FTContour.h +@@ -25,7 +25,7 @@ class FTGL_EXPORT FTContour + * @param pointTags + * @param numberOfPoints + */ +- FTContour( FT_Vector* contour, char* pointTags, unsigned int numberOfPoints); ++ FTContour( FT_Vector* contour, unsigned char* pointTags, unsigned int numberOfPoints); + + /** + * Destructor +diff --git a/graf3d/ftgl/src/FTContour.cxx b/graf3d/ftgl/src/FTContour.cxx +index 76ada3c9c7..8a79b7f3a8 100644 +--- a/graf3d/ftgl/src/FTContour.cxx ++++ b/graf3d/ftgl/src/FTContour.cxx +@@ -69,8 +69,7 @@ void FTContour::evaluateCubicCurve() + } + } + +- +-FTContour::FTContour( FT_Vector* contour, char* pointTags, unsigned int numberOfPoints) ++FTContour::FTContour( FT_Vector* contour, unsigned char* pointTags, unsigned int numberOfPoints) + { + for( unsigned int pointIndex = 0; pointIndex < numberOfPoints; ++ pointIndex) + { +diff --git a/graf3d/ftgl/src/FTVectoriser.cxx b/graf3d/ftgl/src/FTVectoriser.cxx +index df32ac2f83..a468533b68 100644 +--- a/graf3d/ftgl/src/FTVectoriser.cxx ++++ b/graf3d/ftgl/src/FTVectoriser.cxx +@@ -140,7 +140,7 @@ void FTVectoriser::ProcessContours() + for( short contourIndex = 0; contourIndex < ftContourCount; ++contourIndex) + { + FT_Vector* pointList = &outline.points[startIndex]; +- char* tagList = &outline.tags[startIndex]; ++ unsigned char* tagList = &outline.tags[startIndex]; + + endIndex = outline.contours[contourIndex]; + contourLength = ( endIndex - startIndex) + 1; From c3c9f3f53dfe5d19ed994cfd95e493229c33d9b9 Mon Sep 17 00:00:00 2001 From: Florian Uhlig Date: Sat, 11 Oct 2025 12:29:20 +0200 Subject: [PATCH 22/23] [legacy] test: Allow test with non standard SDK on macosx Properly pass CMAKE_OSX_SYSROOT to the build and test processes. Don't test building onnxruntime if CMake version >= 4.0.0 --- FairSoft_test.cmake | 24 ++++++++++++++---------- test/legacy/fairroot.sh.in | 10 +++++++--- 2 files changed, 21 insertions(+), 13 deletions(-) diff --git a/FairSoft_test.cmake b/FairSoft_test.cmake index 29e40a1e..c4fd9de6 100644 --- a/FairSoft_test.cmake +++ b/FairSoft_test.cmake @@ -154,15 +154,19 @@ if (BUILD_METHOD STREQUAL legacy) list(APPEND options "-DCMAKE_CXX_STANDARD=${CMAKE_CXX_STANDARD}") endif() if(APPLE) - execute_process(COMMAND brew --prefix python OUTPUT_VARIABLE python_prefix) - string(STRIP "${python_prefix}" python_prefix) - list(APPEND options "-DPython_EXECUTABLE=${python_prefix}/bin/python3") - execute_process(COMMAND brew --prefix icu4c OUTPUT_VARIABLE icu_prefix) - string(STRIP "${icu_prefix}" icu_prefix) - list(APPEND options "-DICU_ROOT=${icu_prefix}") - execute_process(COMMAND brew ruby -e "puts MacOS.sdk_path" OUTPUT_VARIABLE macos_sdk_path) - string(STRIP "${macos_sdk_path}" macos_sdk_path) - list(APPEND options "-DCMAKE_OSX_SYSROOT=${macos_sdk_path}") + if(NOT CMAKE_OSX_SYSROOT) + execute_process(COMMAND brew --prefix python OUTPUT_VARIABLE python_prefix) + string(STRIP "${python_prefix}" python_prefix) + list(APPEND options "-DPython_EXECUTABLE=${python_prefix}/bin/python3") + execute_process(COMMAND brew --prefix icu4c OUTPUT_VARIABLE icu_prefix) + string(STRIP "${icu_prefix}" icu_prefix) + list(APPEND options "-DICU_ROOT=${icu_prefix}") + execute_process(COMMAND brew ruby -e "puts MacOS.sdk_path" OUTPUT_VARIABLE macos_sdk_path) + string(STRIP "${macos_sdk_path}" macos_sdk_path) + list(APPEND options "-DCMAKE_OSX_SYSROOT=${macos_sdk_path}") + else() + list(APPEND options "-DCMAKE_OSX_SYSROOT=${CMAKE_OSX_SYSROOT}") + endif() endif() list(JOIN options ";" optionsstr) show_big_header("Configuring") @@ -176,7 +180,7 @@ if (BUILD_METHOD STREQUAL legacy) if (_ctest_build_errors) set(_ctest_build_retval 255) endif() - if(NOT _ctest_build_errors) + if(NOT _ctest_build_errors AND ${CMAKE_VERSION} VERSION_LESS 4) ctest_build(RETURN_VALUE _ctest_build_retval NUMBER_ERRORS _ctest_build_errors TARGET "onnxruntime" diff --git a/test/legacy/fairroot.sh.in b/test/legacy/fairroot.sh.in index d921f566..ba67ce63 100755 --- a/test/legacy/fairroot.sh.in +++ b/test/legacy/fairroot.sh.in @@ -10,9 +10,13 @@ git clone -b ${version} https://github.com/FairRootGroup/FairRoot $sourcedir pushd $sourcedir mkdir -p build/install export FAIRROOTPATH="$(realpath ./build/install)" -cmake -S. -Bbuild \ - -DCMAKE_INSTALL_PREFIX=$FAIRROOTPATH \ - -DCMAKE_C_STANDARD=11 +_arguments="-DCMAKE_INSTALL_PREFIX=$FAIRROOTPATH -DCMAKE_C_STANDARD=11" +if [[ -n "@APPLE@" ]]; then + if [[ -n "@CMAKE_OSX_SYSROOT@" ]]; then + _arguments="${_arguments} -DCMAKE_OSX_SYSROOT=@CMAKE_OSX_SYSROOT@" + fi +fi +cmake -S. -Bbuild ${_arguments} cmake --build build --target install -j @NCPUS@ pushd build ctest --output-on-failure -E "(ex_MQ_pixel|pixelSplitDDS).*" -j @NCPUS@ $(ctest --version | grep -q "3\.16" || echo "--repeat until-pass:5") From 63cbc993cc9f018495e03f729e3fbb969dc41128 Mon Sep 17 00:00:00 2001 From: Florian Uhlig Date: Sat, 11 Oct 2025 13:23:42 +0200 Subject: [PATCH 23/23] [legacy] test: Add test of FairRoot dev branch --- cmake/legacy.cmake | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/cmake/legacy.cmake b/cmake/legacy.cmake index a90801d1..fa45098f 100644 --- a/cmake/legacy.cmake +++ b/cmake/legacy.cmake @@ -632,8 +632,12 @@ add_custom_target(source-cache include(CTest) -foreach(ver IN ITEMS 18.6 18.8 19.0) - set(TEST_VERSION v${ver}_patches) +foreach(ver IN ITEMS 18.6 18.8 19.0 dev) + if(ver STREQUAL dev) + set(TEST_VERSION ${ver}) + else() + set(TEST_VERSION v${ver}_patches) + endif() configure_file(test/legacy/fairroot.sh.in ${CMAKE_BINARY_DIR}/test_fairroot_${ver}.sh @ONLY) add_test(NAME FairRoot_${ver} COMMAND test_fairroot_${ver}.sh