Skip to content

Commit

Permalink
build: setup covfie, detray, traccc, and shared libraries (acts-proje…
Browse files Browse the repository at this point in the history
…ct#3099)

Updated cmake files to fetch covfie, detray, traccc, thrust, algebra-plugins and set the cmake options in the projects to use shared libraries instead of setting them up for themselves.
Update dfelibs version to v20211029, vecmem version to v1.4.0, and nlohmanjson to v3.10.5.
Added new cmake options:
- added ACTS_SETUP_<name> and ACTS_USE_SYSTEM_<name> for covfie, detray, tracc, thrust, algebra-plugins, and dfelibs.
- added ACTS_BUILD_PLUGIN_COVFIE and ACTS_BUILD_PLUGIN_TRACCC for building plugins that would allow acts to easily make use of covfie and traccc (future work)
Added tests for covfie and traccc to check if the libraries and plugins are available.
  • Loading branch information
fredevb authored and Matthew Harris committed Jun 18, 2024
1 parent a4673ff commit e952d0d
Show file tree
Hide file tree
Showing 21 changed files with 362 additions and 84 deletions.
65 changes: 59 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ option(ACTS_BUILD_PLUGIN_PODIO "Build Podio plugin" OFF)
option(ACTS_BUILD_PLUGIN_EDM4HEP "Build EDM4hep plugin" OFF)
option(ACTS_BUILD_PLUGIN_FPEMON "Build FPE monitoring plugin" OFF)
option(ACTS_BUILD_PLUGIN_GEOMODEL "Build GeoModel plugin" OFF)
option(ACTS_BUILD_PLUGIN_COVFIE "Build Covfie plugin" OFF)
option(ACTS_BUILD_PLUGIN_DETRAY "Build Detray plugin" OFF)
option(ACTS_BUILD_PLUGIN_TRACCC "Build Traccc plugin" OFF)
option(ACTS_USE_SYSTEM_GEOMODEL "Use a system-provided GeoModel installation" ${ACTS_USE_SYSTEM_LIBS})
option(ACTS_BUILD_PLUGIN_GEANT4 "Build Geant4 plugin" OFF)
option(ACTS_BUILD_PLUGIN_EXATRKX "Build the Exa.TrkX plugin" OFF)
Expand All @@ -46,8 +49,18 @@ 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
option(ACTS_BUILD_FATRAS "Build FAst TRAcking Simulation package" OFF)
Expand Down Expand Up @@ -118,6 +131,7 @@ set_option_if(
OR ACTS_BUILD_EXAMPLES_BINARIES
OR ACTS_BUILD_EVERYTHING)
# core plugins might be required by examples or depend on each other

set_option_if(
ACTS_BUILD_PLUGIN_DD4HEP
ACTS_BUILD_EXAMPLES_DD4HEP OR ACTS_BUILD_EVERYTHING OR
Expand Down Expand Up @@ -184,9 +198,9 @@ set(_acts_boost_version 1.71.0)
set(_acts_dd4hep_version 1.21)
set(_acts_edm4hep_version 0.7)
set(_acts_geomodel_version 4.6.0)
set(_acts_eigen3_version 3.3.7)
set(_acts_podio_version 0.16)
set(_acts_doxygen_version 1.9.4)
set(_acts_eigen3_version 3.3.7)
set(_acts_hepmc3_version 3.2.1)
set(_acts_nlohmanjson_version 3.2.0)
set(_acts_onnxruntime_version 1.12.0)
Expand All @@ -197,6 +211,9 @@ set(_acts_tbb_version 2020.1)
# this version we will try so.
set(_acts_boost_recommended_version 1.78.0)

# Include the sources for the external dependencies.
include(ActsExternSources)

# required packages
if (ACTS_SETUP_BOOST)
if (ACTS_USE_SYSTEM_BOOST)
Expand Down Expand Up @@ -227,11 +244,29 @@ 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 REQUIRED)
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()
endif()

Expand Down Expand Up @@ -269,9 +304,30 @@ endmacro()
# 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)
message(STATUS "Using system installation of actsvg")
find_package(actsvg ${_acts_actsvg_version} REQUIRED CONFIG)
else()
add_subdirectory(thirdparty/actsvg)
Expand All @@ -287,15 +343,13 @@ if(ACTS_BUILD_PLUGIN_DD4HEP)
endif()
if(ACTS_BUILD_PLUGIN_JSON)
if(ACTS_USE_SYSTEM_NLOHMANN_JSON)
message(STATUS "Using system installation of nlohmann::json")
find_package(nlohmann_json ${_acts_nlohmanjson_version} REQUIRED CONFIG)
else()
add_subdirectory(thirdparty/nlohmann_json)
endif()
endif()
if(ACTS_BUILD_PLUGIN_GEOMODEL)
if(ACTS_USE_SYSTEM_GEOMODEL)
message(STATUS "Using system installation of GeoModel")
find_package(GeoModel ${_acts_geomodel_version} REQUIRED CONFIG)
else()
add_subdirectory(thirdparty/GeoModel)
Expand Down Expand Up @@ -352,7 +406,6 @@ if(ACTS_BUILD_EXAMPLES)
# for simplicity always request all potentially required components.
find_package(ROOT ${_acts_root_version} REQUIRED CONFIG COMPONENTS Core Geom Graf GenVector Hist Tree TreePlayer)
check_root_compatibility()
add_subdirectory(thirdparty/dfelibs)
endif()
if(ACTS_BUILD_EXAMPLES_PYTHON_BINDINGS)
find_package(Python 3.8 REQUIRED COMPONENTS Interpreter Development)
Expand Down
52 changes: 52 additions & 0 deletions cmake/ActsExternSources.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
set( ACTS_ACTSVG_SOURCE
"URL;https://github.com/acts-project/actsvg/archive/refs/tags/v0.4.40.tar.gz;URL_MD5;c8f3a7ac47db7f39cd4f215a5bbf148d" CACHE STRING "Source to take ACTSVG from")
mark_as_advanced( ACTS_ACTSVG_SOURCE )

set( ACTS_VECMEM_SOURCE
"URL;https://github.com/acts-project/vecmem/archive/refs/tags/v1.4.0.tar.gz;URL_MD5;af5434e34ca9c084678c2c043441f174" CACHE STRING "Source to take VECMEM from")
mark_as_advanced( ACTS_VECMEM_SOURCE )

set( ACTS_ALGEBRAPLUGINS_SOURCE
"URL;https://github.com/acts-project/algebra-plugins/archive/refs/tags/v0.22.0.tar.gz;URL_MD5;42bcaad8d19a2c773993a974816dfdf5" CACHE STRING "Source to take ALGEBRAPLUGINS from")
mark_as_advanced( ACTS_ALGEBRAPLUGINS_SOURCE )

set( ACTS_COVFIE_SOURCE
"URL;https://github.com/acts-project/covfie/archive/refs/tags/v0.10.0.tar.gz;URL_MD5;af59c6e2a1eebfa765b29f0af9fc70f7" CACHE STRING "Source to take COVFIE from")
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")
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")
mark_as_advanced( ACTS_TRACCC_SOURCE )

set( ACTS_DFELIBS_SOURCE
"URL;https://github.com/acts-project/dfelibs/archive/refs/tags/v20211029.tar.gz;URL_MD5;87fb09c5a11b98250f5e266e9cd501ea" CACHE STRING "Source to take dfelibs from")
mark_as_advanced( ACTS_DFELIBS_SOURCE )

set( ACTS_FRNN_SOURCE
"GIT_REPOSITORY;https://github.com/lxxue/FRNN;GIT_TAG;3e370d8d9073d4e130363faf87d2370598b5fbf2" CACHE STRING "Source to take FRNN from")
mark_as_advanced( ACTS_FRNN_SOURCE )

set( ACTS_GEOMODEL_SOURCE
"GIT_REPOSITORY;https://gitlab.cern.ch/GeoModelDev/GeoModel;GIT_TAG;4.6.0;PATCH_COMMAND;git am ${CMAKE_CURRENT_SOURCE_DIR}/0001-Add-option-to-skip-setting-up-json-completely.patch" CACHE STRING "Source to take GeoModel from")
mark_as_advanced( ACTS_GEOMODEL_SOURCE )

set( ACTS_NLOHMANNJSON_SOURCE
"URL;https://github.com/nlohmann/json/archive/refs/tags/v3.10.5.tar.gz;URL_HASH;SHA1=8969f5ad1a422e01f040ff48dcae9c0e6ad0811d" CACHE STRING "Source to take nlohmann_json from")
mark_as_advanced( ACTS_NLOHMANN_JSON_SOURCE )

string(REPLACE "." "_" _acts_boost_recommended_version_ ${_acts_boost_recommended_version})
set( ACTS_BOOST_SOURCE
"URL;https://boostorg.jfrog.io/artifactory/main/release/${_acts_boost_recommended_version}/source/boost_${_acts_boost_recommended_version_}.tar.gz" CACHE STRING "Source to take boost from")
mark_as_advanced( ACTS_BOOST_SOURCE )

set( ACTS_EIGEN3_SOURCE
"URL;https://gitlab.com/libeigen/eigen/-/archive/${_acts_eigen3_version}/${_acts_eigen3_version}.tar.gz" CACHE STRING "Source to take eigen3 from")
mark_as_advanced( ACTS_EIGEN3_SOURCE )

set( ACTS_PYBIND11_SOURCE
"GIT_REPOSITORY;https://github.com/pybind/pybind11.git;GIT_TAG;v2.10.1" CACHE STRING "Source to take pybind11 from")
mark_as_advanced( ACTS_PYBIND11_SOURCE )
13 changes: 13 additions & 0 deletions docs/getting_started.md
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,9 @@ components.
| ACTS_BUILD_PLUGIN_EDM4HEP | Build EDM4hep plugin<br> type: `bool`, default: `OFF` |
| ACTS_BUILD_PLUGIN_FPEMON | Build FPE monitoring plugin<br> type: `bool`, default: `OFF` |
| ACTS_BUILD_PLUGIN_GEOMODEL | Build GeoModel plugin<br> type: `bool`, default: `OFF` |
| ACTS_BUILD_PLUGIN_COVFIE | Build Covfie plugin<br> type: `bool`, default: `OFF` |
| ACTS_BUILD_PLUGIN_DETRAY | Build Detray plugin<br> type: `bool`, default: `OFF` |
| ACTS_BUILD_PLUGIN_TRACCC | Build Traccc plugin<br> type: `bool`, default: `OFF` |
| ACTS_USE_SYSTEM_GEOMODEL | Use a system-provided GeoModel<br>installation<br> type: `bool`, default: `ACTS_USE_SYSTEM_LIBS -> OFF` |
| ACTS_BUILD_PLUGIN_GEANT4 | Build Geant4 plugin<br> type: `bool`, default: `OFF` |
| ACTS_BUILD_PLUGIN_EXATRKX | Build the Exa.TrkX plugin<br> type: `bool`, default: `OFF` |
Expand All @@ -276,8 +279,18 @@ 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` |
| ACTS_BUILD_FATRAS_GEANT4 | Build Geant4 Fatras package<br> type: `bool`, default: `OFF` |
Expand Down
12 changes: 2 additions & 10 deletions thirdparty/FRNN/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,8 @@ include(FetchContent)

message(STATUS "Building FRNN as part of the ACTS project")

set(ACTS_FRNN_GIT_REPOSITORY "https://github.com/lxxue/FRNN"
CACHE STRING "Git repository to take FRNN from")
set(ACTS_FRNN_GIT_TAG "3e370d8d9073d4e130363faf87d2370598b5fbf2"
CACHE STRING "Version of FRNN to build")

mark_as_advanced(ACTS_FRNN_GIT_REPOSITORY ACTS_FRNN_GIT_TAG)

FetchContent_Declare(frnncontent
GIT_REPOSITORY "${ACTS_FRNN_GIT_REPOSITORY}"
GIT_TAG "${ACTS_FRNN_GIT_TAG}" )
# Declare where to get frnncontent from
FetchContent_Declare( frnncontent ${ACTS_FRNN_SOURCE} )

# FRNN does not provide a CMakeLists.txt, so we use a custom one. Because of this,
# we have to implement the populate step manually
Expand Down
13 changes: 2 additions & 11 deletions thirdparty/GeoModel/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,8 @@ set( GEOMODEL_VERSION "${_acts_geomodel_version}")

set( GEOMODEL_SETUP_JSON OFF CACHE BOOL "Skip setting up json completely" )


# Declare where to get VecMem from.
set( ACTS_GEOMODEL_GIT_REPOSITORY "https://gitlab.cern.ch/GeoModelDev/GeoModel"
CACHE STRING "Git repository to take GeoModel from" )
set( ACTS_GEOMODEL_GIT_TAG "${GEOMODEL_VERSION}" CACHE STRING "Version of GeoModel to build" )
mark_as_advanced( ACTS_GEOMODEL_GIT_REPOSITORY ACTS_GEOMODEL_GIT_TAG )
FetchContent_Declare( geomodel
GIT_REPOSITORY "${ACTS_GEOMODEL_GIT_REPOSITORY}"
GIT_TAG "${ACTS_GEOMODEL_GIT_TAG}"
PATCH_COMMAND git am ${CMAKE_CURRENT_SOURCE_DIR}/0001-Add-option-to-skip-setting-up-json-completely.patch
)
# Declare where to get geomodel from.
FetchContent_Declare( geomodel ${ACTS_GEOMODEL_SOURCE} )

# Now set up its build.
FetchContent_MakeAvailable( geomodel )
11 changes: 1 addition & 10 deletions thirdparty/actsvg/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,7 @@ include( FetchContent )
# Tell the user what's happening.
message( STATUS "Building actsvg as part of the ACTS project" )

set( ACTS_VERSION "v${_acts_actsvg_version}")

# Declare where to get VecMem from.
set( ACTS_ACTSVG_GIT_REPOSITORY "https://github.com/acts-project/actsvg.git"
CACHE STRING "Git repository to take actsvg from" )
set( ACTS_ACTSVG_GIT_TAG "${ACTS_VERSION}" CACHE STRING "Version of actsvg to build" )
mark_as_advanced( ACTS_ACTSVG_GIT_REPOSITORY ACTS_ACTSVG_GIT_TAG )
FetchContent_Declare( actsvg
GIT_REPOSITORY "${ACTS_ACTSVG_GIT_REPOSITORY}"
GIT_TAG "${ACTS_ACTSVG_GIT_TAG}" )
FetchContent_Declare( actsvg ${ACTS_ACTSVG_SOURCE} )

# Now set up its build.
FetchContent_MakeAvailable( actsvg )
Loading

0 comments on commit e952d0d

Please sign in to comment.