Skip to content

Commit

Permalink
build: Improve traccc dependency loading
Browse files Browse the repository at this point in the history
This commit makes a few changes to the way some of the Acts R&D projects
are loaded in Acts (i.e. detray, traccc, algebra-plugins), namely:

1. It adds code to load detray's dependencies if the Acts project is
   installed.
2. It updates the versions of detray and traccc so they are compatible.
3. It adds some documentation to the `thirdparty/` directory.
4. It refines the parameters for the CMake build systems of various
   projects to be more robust.
5. It establishes a dependency of the traccc plugin on the detray
   plugin, and the detray plugin on the covfie plugin.

Co-authored-by: Stephen Nicholas Swatman <[email protected]>
  • Loading branch information
fredevb and stephenswat committed Aug 5, 2024
1 parent 0b9ed36 commit d991cd1
Show file tree
Hide file tree
Showing 8 changed files with 91 additions and 74 deletions.
106 changes: 52 additions & 54 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,17 +49,11 @@ option(ACTS_BUILD_PLUGIN_JSON "Build json plugin" OFF)
option(ACTS_USE_SYSTEM_NLOHMANN_JSON "Use nlohmann::json provided by the system instead of the bundled version" ${ACTS_USE_SYSTEM_LIBS})
option(ACTS_BUILD_PLUGIN_LEGACY "Build legacy plugin" OFF)
option(ACTS_BUILD_PLUGIN_ONNX "Build ONNX plugin" OFF)
option(ACTS_SETUP_COVFIE "Explicitly set up covfie for the project" OFF)
option(ACTS_USE_SYSTEM_COVFIE "Use a system-provided covfie installation" ${ACTS_USE_SYSTEM_LIBS})
option(ACTS_SETUP_DETRAY "Explicitly set up detray for the project" OFF)
option(ACTS_USE_SYSTEM_DETRAY "Use a system-provided detray installation" ${ACTS_USE_SYSTEM_LIBS})
option(ACTS_SETUP_TRACCC "Explicitly set up traccc for the project" OFF)
option(ACTS_USE_SYSTEM_TRACCC "Use a system-provided traccc installation" ${ACTS_USE_SYSTEM_LIBS})
option(ACTS_SETUP_DFELIBS "Explicitly set up dfelibs for the project" ON)
option(ACTS_USE_SYSTEM_DFELIBS "Use a system-provided dfelibs installation" ${ACTS_USE_SYSTEM_LIBS})
option(ACTS_SETUP_VECMEM "Explicitly set up vecmem for the project" OFF)
option(ACTS_USE_SYSTEM_VECMEM "Use a system-provided vecmem installation" ${ACTS_USE_SYSTEM_LIBS})
option(ACTS_SETUP_ALGEBRAPLUGINS "Explicitly set up algebra-plugins for the project" OFF)
option(ACTS_USE_SYSTEM_ALGEBRAPLUGINS "Use a system-provided algebra-plugins installation" ${ACTS_USE_SYSTEM_LIBS})
option(ACTS_BUILD_PLUGIN_TGEO "Build TGeo plugin" OFF)
# fatras related options
Expand Down Expand Up @@ -155,6 +149,12 @@ set_option_if(
set_option_if(
ACTS_BUILD_PLUGIN_FPEMON
ACTS_BUILD_EXAMPLES)
set_option_if(
ACTS_BUILD_PLUGIN_DETRAY
ACTS_BUILD_PLUGIN_TRACCC)
set_option_if(
ACTS_BUILD_PLUGIN_COVFIE
ACTS_BUILD_PLUGIN_DETRAY)

# feature tests
include(CheckCXXSourceCompiles)
Expand Down Expand Up @@ -205,6 +205,11 @@ set(_acts_onnxruntime_version 1.12.0)
set(_acts_root_version 6.20)
set(_acts_tbb_version 2020.1)
set(_acts_pythia8_version 8.309)
set(_acts_detray_version 0.72.0)
set(_acts_traccc_version 0.13.0)
set(_acts_covfie_version 0.10.0)
set(_acts_vecmem_version 1.4.0)
set(_acts_algebraplugins_version 0.22.0)

# recommended dependency version. if there is an opportunity to reach
# this version we will try so.
Expand Down Expand Up @@ -249,30 +254,10 @@ if (ACTS_SETUP_EIGEN3)
endif()
endif()

if (ACTS_SETUP_DFELIBS)
if (ACTS_USE_SYSTEM_DFELIBS)
find_package(dfelibs ${_acts_dfelibs_version} REQUIRED)
else()
add_subdirectory(thirdparty/dfelibs)
endif()
endif()

if (ACTS_SETUP_VECMEM)
if (ACTS_USE_SYSTEM_VECMEM)
find_package(vecmem ${_acts_vecmem_version} REQUIRED)
else()
add_subdirectory(thirdparty/vecmem)
# Make the "VecMem language code" available for the whole project.
include( "${VECMEM_LANGUAGE_DIR}/vecmem-check-language.cmake" )
endif()
endif()

if (ACTS_SETUP_ALGEBRAPLUGINS)
if (ACTS_USE_SYSTEM_ALGEBRAPLUGINS)
find_package(algebra-plugins ${_acts_algebraplugins_version} REQUIRED)
else()
add_subdirectory(thirdparty/algebra-plugins)
endif()
if (ACTS_USE_SYSTEM_DFELIBS)
find_package(dfelibs ${_acts_dfelibs_version} REQUIRED)
else()
add_subdirectory(thirdparty/dfelibs)
endif()

find_package(Filesystem REQUIRED)
Expand Down Expand Up @@ -307,30 +292,6 @@ endmacro()
# find packages explicitly for each component even if this means searching for
# the same package twice. This avoids having complex if/else trees to sort out
# when a particular package is actually needed.

# plugin dependencies
if(ACTS_SETUP_COVFIE)
if(ACTS_USE_SYSTEM_COVFIE)
find_package(covfie ${_acts_covfie_version} REQUIRED CONFIG)
else()
add_subdirectory(thirdparty/covfie)
endif()
endif()
if(ACTS_SETUP_DETRAY)
if(ACTS_USE_SYSTEM_DETRAY)
find_package(detray ${_acts_detray_version} REQUIRED CONFIG)
else()
add_subdirectory(thirdparty/detray)
endif()
endif()
if(ACTS_SETUP_TRACCC)
if(ACTS_USE_SYSTEM_TRACCC)
find_package(traccc ${_acts_traccc_version} REQUIRED CONFIG)
else()
add_subdirectory(thirdparty/traccc)
endif()
endif()

if(ACTS_BUILD_PLUGIN_ACTSVG)
if(ACTS_USE_SYSTEM_ACTSVG)
find_package(actsvg ${_acts_actsvg_version} REQUIRED CONFIG)
Expand Down Expand Up @@ -409,6 +370,43 @@ endif()
if(ACTS_BUILD_PLUGIN_GEANT4)
find_package(Geant4 REQUIRED CONFIG COMPONENTS gdml)
endif()
if(ACTS_BUILD_PLUGIN_DETRAY)
if(ACTS_USE_SYSTEM_DETRAY)
find_package(detray ${_acts_detray_version} REQUIRED CONFIG)
else()
add_subdirectory(thirdparty/detray)
endif()

if (ACTS_USE_SYSTEM_VECMEM)
find_package(vecmem ${_acts_vecmem_version} REQUIRED)
else()
add_subdirectory(thirdparty/vecmem)
# Make the "VecMem language code" available for the whole project.
include( "${VECMEM_LANGUAGE_DIR}/vecmem-check-language.cmake" )
endif()

if (ACTS_USE_SYSTEM_ALGEBRAPLUGINS)
find_package(algebra-plugins ${_acts_algebraplugins_version} REQUIRED)
else()
add_subdirectory(thirdparty/algebra-plugins)
endif()
endif()
if(ACTS_BUILD_PLUGIN_COVFIE)
if(ACTS_USE_SYSTEM_COVFIE)
find_package(covfie ${_acts_covfie_version} REQUIRED CONFIG)
else()
add_subdirectory(thirdparty/covfie)
endif()
endif()
if(ACTS_BUILD_PLUGIN_TRACCC)
# traccc also depends on vecmem and covfie, but those plugins should always
# be enabled if traccc is.
if(ACTS_USE_SYSTEM_TRACCC)
find_package(traccc ${_acts_traccc_version} REQUIRED CONFIG)
else()
add_subdirectory(thirdparty/traccc)
endif()
endif()

# examples dependencies
if(ACTS_BUILD_EXAMPLES)
Expand Down
7 changes: 6 additions & 1 deletion cmake/ActsConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,12 @@ if(PluginPodio IN_LIST Acts_COMPONENTS)
include(${CMAKE_CURRENT_LIST_DIR}/ActsPodioEdmTargets.cmake)
endif()

if(PluginDetray IN_LIST Acts_COMPONENTS)
find_dependency(vecmem @vecmem_VERSION@ CONFIG EXACT)
find_dependency(algebra-plugins @algebra-plugins_VERSION@ CONFIG EXACT)
find_dependency(detray @detray_VERSION@ CONFIG EXACT)
endif()

# load **all** available components. we can not just include the requested
# components since there can be interdependencies between them.
if(NOT Acts_FIND_QUIETLY)
Expand All @@ -108,4 +114,3 @@ foreach(_component ${Acts_COMPONENTS})
# include the targets file to create the imported targets for the user
include(${CMAKE_CURRENT_LIST_DIR}/Acts${_component}Targets.cmake)
endforeach()

4 changes: 2 additions & 2 deletions cmake/ActsExternSources.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ set( ACTS_COVFIE_SOURCE
mark_as_advanced( ACTS_COVFIE_SOURCE )

set( ACTS_DETRAY_SOURCE
"URL;https://github.com/acts-project/detray/archive/refs/tags/v0.65.1.tar.gz;URL_MD5;fbf57a881565fa6019d79d13409b588f" CACHE STRING "Source to take DETRAY from")
"URL;https://github.com/acts-project/detray/archive/refs/tags/v0.72.1.tar.gz;URL_MD5;342ab0bfba45c5764c8eef3842897c16" CACHE STRING "Source to take DETRAY from")
mark_as_advanced( ACTS_DETRAY_SOURCE )

set( ACTS_TRACCC_SOURCE
"URL;https://github.com/acts-project/traccc/archive/refs/tags/v0.10.0.tar.gz;URL_MD5;131399d26e3280c4d7f7ca2995efd256" CACHE STRING "Source to take TRACCC from")
"URL;https://github.com/acts-project/traccc/archive/refs/tags/v0.13.0.tar.gz;URL_MD5;1ddf757ddcbaa08fd7db3a7752ef7f98" CACHE STRING "Source to take TRACCC from")
mark_as_advanced( ACTS_TRACCC_SOURCE )

set( ACTS_DFELIBS_SOURCE
Expand Down
6 changes: 0 additions & 6 deletions docs/getting_started.md
Original file line number Diff line number Diff line change
Expand Up @@ -282,17 +282,11 @@ components.
| ACTS_USE_SYSTEM_NLOHMANN_JSON | Use nlohmann::json provided by the<br>system instead of the bundled version<br> type: `bool`, default: `ACTS_USE_SYSTEM_LIBS -> OFF` |
| ACTS_BUILD_PLUGIN_LEGACY | Build legacy plugin<br> type: `bool`, default: `OFF` |
| ACTS_BUILD_PLUGIN_ONNX | Build ONNX plugin<br> type: `bool`, default: `OFF` |
| ACTS_SETUP_COVFIE | Explicitly set up covfie for the project<br> type: `bool`, default: `OFF` |
| ACTS_USE_SYSTEM_COVFIE | Use a system-provided covfie<br>installation<br> type: `bool`, default: `ACTS_USE_SYSTEM_LIBS -> OFF` |
| ACTS_SETUP_DETRAY | Explicitly set up detray for the project<br> type: `bool`, default: `OFF` |
| ACTS_USE_SYSTEM_DETRAY | Use a system-provided detray<br>installation<br> type: `bool`, default: `ACTS_USE_SYSTEM_LIBS -> OFF` |
| ACTS_SETUP_TRACCC | Explicitly set up traccc for the project<br> type: `bool`, default: `OFF` |
| ACTS_USE_SYSTEM_TRACCC | Use a system-provided traccc<br>installation<br> type: `bool`, default: `ACTS_USE_SYSTEM_LIBS -> OFF` |
| ACTS_SETUP_DFELIBS | Explicitly set up dfelibs for the<br>project<br> type: `bool`, default: `ON` |
| ACTS_USE_SYSTEM_DFELIBS | Use a system-provided dfelibs<br>installation<br> type: `bool`, default: `ACTS_USE_SYSTEM_LIBS -> OFF` |
| ACTS_SETUP_VECMEM | Explicitly set up vecmem for the project<br> type: `bool`, default: `OFF` |
| ACTS_USE_SYSTEM_VECMEM | Use a system-provided vecmem<br>installation<br> type: `bool`, default: `ACTS_USE_SYSTEM_LIBS -> OFF` |
| ACTS_SETUP_ALGEBRAPLUGINS | Explicitly set up algebra-plugins for<br>the project<br> type: `bool`, default: `OFF` |
| ACTS_USE_SYSTEM_ALGEBRAPLUGINS | Use a system-provided algebra-plugins<br>installation<br> type: `bool`, default: `ACTS_USE_SYSTEM_LIBS -> OFF` |
| ACTS_BUILD_PLUGIN_TGEO | Build TGeo plugin<br> type: `bool`, default: `OFF` |
| ACTS_BUILD_FATRAS | Build FAst TRAcking Simulation package<br> type: `bool`, default: `OFF` |
Expand Down
20 changes: 20 additions & 0 deletions thirdparty/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,23 @@ CMake instructions to build [Pybind11](https://github.com/pybind/pybind11), whic
## FRNN

CMake instructions to build [FRNN](https://github.com/lxxue/FRNN), which is used by the Exa.TrkX plugin.

## Algebra plugins

CMake instruction to build [algebra-plugins](https://github.com/acts-project/algebra-plugins), which is used by the traccc plugin.

## VecMem

CMake instruction to build [VecMem](https://github.com/acts-project/vecmem), which is used by the traccc plugin.

## Covfie

CMake instruction to build [covfie](https://github.com/acts-project/covfie), which is used by the traccc plugin.

## Detray

CMake instruction to build [detray](https://github.com/acts-project/detray), which is used by the traccc plugin.

## Traccc

CMake instruction to build [traccc](https://github.com/acts-project/traccc), which is used by the traccc plugin.
8 changes: 4 additions & 4 deletions thirdparty/algebra-plugins/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ set(ALGEBRA_PLUGINS_BUILD_TESTING FALSE CACHE BOOL
"Turn off the build of the Algebra Plugins unit tests")
set(ALGEBRA_PLUGINS_INCLUDE_EIGEN TRUE CACHE BOOL
"Turn on the build of algebra::eigen")
set(ALGEBRA_PLUGINS_INCLUDE_VC TRUE CACHE BOOL
"Turn on the build of algebra::vc_array")
set(ALGEBRA_PLUGINS_INCLUDE_VC FALSE CACHE BOOL
"Turn off the build of algebra::vc_array")
set(ALGEBRA_PLUGINS_INCLUDE_VECMEM TRUE CACHE BOOL
"Turn on the build of algebra::vecmem_array")

Expand All @@ -31,8 +31,8 @@ set(ALGEBRA_PLUGINS_INCLUDE_SMATRIX ${DETRAY_SMATRIX_PLUGIN}

set(ALGEBRA_PLUGINS_SETUP_EIGEN3 OFF CACHE BOOL
"Do not have Algebra Plugins set up Eigen3 for itself")
set(ALGEBRA_PLUGINS_SETUP_VC ON CACHE BOOL
"Have Algebra Plugins set up Vc for itself")
set(ALGEBRA_PLUGINS_SETUP_VC OFF CACHE BOOL
"Do not have Algebra Plugins set up Vc for itself")
set(ALGEBRA_PLUGINS_USE_SYSTEM_VC OFF CACHE BOOL
"Have Algebra Plugins build Vc itself")
set(ALGEBRA_PLUGINS_SETUP_VECMEM FALSE CACHE BOOL
Expand Down
10 changes: 4 additions & 6 deletions thirdparty/detray/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ set( DETRAY_BUILD_TUTORIALS OFF CACHE BOOL
"Turn off the build of the Detray tutorials" )
set( DETRAY_EIGEN_PLUGIN ON CACHE BOOL
"Turn on the build of the Detray Eigen code" )
set( DETRAY_VC_PLUGIN ON CACHE BOOL
"Turn on the build of the Detray Vc code" )
set( DETRAY_VC_PLUGIN OFF CACHE BOOL
"Turn off the build of the Detray Vc code" )

set( DETRAY_SETUP_VECMEM OFF CACHE BOOL
"Do not set up VecMem as part of Detray" )
Expand All @@ -48,10 +48,8 @@ set( DETRAY_SETUP_ACTSVG OFF CACHE BOOL
"Do not set up Actsvg as part of Detray" )
set( DETRAY_SETUP_DFELIBS OFF CACHE BOOL
"Do not set up Dfelibs as part of Detray" )
#set( DETRAY_VC_PLUGIN OFF CACHE BOOL
# "Do not build Vc based math plugin" )
#set( DETRAY_SVG_DISPLAY ON CACHE BOOL
# "Build the ActSVG display module" )
set( DETRAY_SVG_DISPLAY ${ACTS_BUILD_PLUGIN_ACTSVG} CACHE BOOL
"Build the ActSVG display module depending on the ACTS_BUILD_PLUGIN_ACTSVG" )


#Now set up its build.
Expand Down
4 changes: 3 additions & 1 deletion thirdparty/traccc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ set( TRACCC_SETUP_VECMEM OFF CACHE BOOL
"Do not set up Actsvg as part of Traccc" )
set( TRACCC_SETUP_EIGEN3 OFF CACHE BOOL
"Do not set up Eigen3 as part of Traccc" )
set( TRACCC_SETUP_THRUST OFF CACHE BOOL
set( TRACCC_SETUP_THRUST ON CACHE BOOL
"Do not set up Thrust as part of Traccc" )
set( TRACCC_SETUP_ALGEBRA_PLUGINS OFF CACHE BOOL
"Do not set up Algebra Plugins as part of Traccc" )
Expand All @@ -34,6 +34,8 @@ set( TRACCC_SETUP_DETRAY OFF CACHE BOOL
"Do not set up Detray as part of Traccc" )
set( TRACCC_SETUP_ACTS OFF CACHE BOOL
"Do not set up ACTS as part of Traccc" )
set( TRACCC_SETUP_TBB OFF CACHE BOOL
"Do not set up TBB as part of Traccc" )

set( TRACCC_BUILD_TESTING OFF CACHE BOOL
"Turn off the build of the Traccc unit tests" )
Expand Down

0 comments on commit d991cd1

Please sign in to comment.