Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
dbabc9e
[legacy] hepmc: Fix build system for CMake 4.0.1
fuhlig1 Apr 22, 2025
abcdaa8
[legacy] zeromq: Fix build system for CMake 4.0.1
fuhlig1 Apr 22, 2025
3e5a333
[legacy] vc: Fix build system for CMake 4.0.1
fuhlig1 Apr 22, 2025
50a2207
[legacy] pythia6: Fix build system for CMake 4.0.1
fuhlig1 Jun 18, 2025
b3ae9d8
[legacy] vmc: Fix build system for CMake 4.0.1
fuhlig1 Jun 24, 2025
4abb7d2
[legacy] vgm: Fix build system for CMake 4.0.1
fuhlig1 Jun 24, 2025
3d87072
[legacy] geant4_vmc: Fix build system for CMake 4.0.1
fuhlig1 Jun 24, 2025
03ff645
[legacy] geant3: Fix build system for CMake 4.0.1
fuhlig1 Jun 24, 2025
baea65d
[legacy] geant4: Fix config file
fuhlig1 Jun 24, 2025
de22628
[legacy] build system: Allow setting the proper SDK
fuhlig1 Jun 24, 2025
6ea4176
[legacy] root: Fix compilation on macosx with Clang 17 and SDK 15
fuhlig1 Jun 23, 2025
e1ac728
[legacy] geant4: Fix compilation crash with Clang 17
fuhlig1 Jun 24, 2025
6a82620
[legacy] setup scripts: Add new packages for macosx
fuhlig1 Sep 17, 2025
cd3a4e0
[legacy] On macosx use Homebrews patch and make
fuhlig1 Sep 22, 2025
a212554
[legacy] documentation: Add infos macosx
fuhlig1 Sep 17, 2025
a288850
[legacy] boost: Build Boost with correct SDK
fuhlig1 Sep 23, 2025
ee8846e
[legacy] pythia8: Build Pythia8 with correct SDK
fuhlig1 Sep 23, 2025
49a454d
[legacy] root: Fix build with gcc15
fuhlig1 Sep 28, 2025
6678e08
[legacy] geant3: Fix compilation for gcc15
fuhlig1 Sep 28, 2025
24febab
[legacy] tests: Fix test for gcc15
fuhlig1 Sep 28, 2025
e474e36
[legacy] root: Fix compilation for some systems
fuhlig1 Oct 1, 2025
c3c9f3f
[legacy] test: Allow test with non standard SDK on macosx
fuhlig1 Oct 11, 2025
63cbc99
[legacy] test: Add test of FairRoot dev branch
fuhlig1 Oct 11, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion FairSoftConfig.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
24 changes: 14 additions & 10 deletions FairSoft_test.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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"
Expand Down
99 changes: 91 additions & 8 deletions cmake/legacy.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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 $<TARGET_FILE:Patch::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 $<TARGET_FILE:Patch::patch> --merge)

set(PROJECT_MIN_CXX_STANDARD 17)

Expand Down Expand Up @@ -145,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"
Expand All @@ -153,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")
Expand Down Expand Up @@ -230,6 +258,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"
Expand Down Expand Up @@ -267,6 +296,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}
)
Expand All @@ -276,6 +306,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"
Expand All @@ -288,6 +319,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}
)
Expand All @@ -310,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)
Expand All @@ -322,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}
)
Expand Down Expand Up @@ -357,6 +395,8 @@ 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"
COMMAND ${patch} -p1 -i "${CMAKE_SOURCE_DIR}/legacy/geant4/fix_typo.patch"
DEPENDS boost clhep ${extract_source_cache_target}
${LOG_TO_FILE}
)
Expand All @@ -374,17 +414,47 @@ 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()
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
${CMAKE_DEFAULT_ARGS} CMAKE_ARGS
"-DCMAKE_C_STANDARD=11"
"-Daqua=ON"
"-Dasimage=ON"
"-Dcintex=OFF"
Expand Down Expand Up @@ -422,6 +492,10 @@ 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"
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}
)
Expand All @@ -431,6 +505,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}
)

Expand All @@ -440,6 +515,8 @@ 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}
)
Expand All @@ -450,6 +527,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}
)
Expand All @@ -464,6 +542,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}
)
Expand Down Expand Up @@ -553,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
Expand Down
35 changes: 35 additions & 0 deletions legacy/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,41 @@ cmake -S <path-to-source> -B <path-to-build> -C <path-to-source>/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.
Copy link

Copilot AI Oct 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Spelling error: 'ot' should be 'to'.

Suggested change
so one needs ot install a version of the **patch** command with brew.
so one needs to install a version of the **patch** command with brew.

Copilot uses AI. Check for mistakes.
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=<full path to SDK directory>
```

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
Expand Down
11 changes: 11 additions & 0 deletions legacy/advanced.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Copy link

Copilot AI Oct 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Spelling error: 'becuase' should be 'because'.

Suggested change
to **wrong** SDKs are because of ROOT and there mainly becuase of rootcling.
to **wrong** SDKs are because of ROOT and there mainly because of rootcling.

Copilot uses AI. Check for mistakes.
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!**

Expand Down
Loading