Skip to content

Commit

Permalink
build!: Make third-party libraries system dependencies (#3949)
Browse files Browse the repository at this point in the history
ACTS currently supports downloading its dependencies via FetchContent which has the problem that they are - by default - considered as files belonging to the project itself. This is undesirable, as this may introduce warnings into the build of ACTS that we cannot do anything about. In CMake 3.25, FetchContent gained the `SYSTEM` flag which allows dependencies fetched through it to be marked as system libraries, for which no warnings are issued.

This commit turns all out third-party dependencies into system dependencies.

<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
## Summary by CodeRabbit

- **Build Configuration**
	- Updated minimum CMake version to 3.25 across multiple third-party library configurations
	- Added `SYSTEM` keyword to `FetchContent_Declare` for various dependencies
	- Updated GitHub Actions and GitLab CI workflows to support multiple compiler configurations

- **CI/CD Improvements**
	- Added new job matrix for Linux builds with different compilers
	- Updated Docker image versions
	- Introduced logging threshold configuration
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
  • Loading branch information
stephenswat authored Jan 22, 2025
1 parent 0011c14 commit bbd3fcc
Show file tree
Hide file tree
Showing 13 changed files with 49 additions and 33 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -248,9 +248,11 @@ jobs:
include:
- image: ubuntu2204
std: 20
- image: ubuntu2204_clang
cxx: g++
- image: ubuntu2204
std: 20
container: ghcr.io/acts-project/${{ matrix.image }}:63
cxx: clang++
container: ghcr.io/acts-project/${{ matrix.image }}:71
env:
INSTALL_DIR: ${{ github.workspace }}/install
ACTS_LOG_FAILURE_THRESHOLD: WARNING
Expand Down Expand Up @@ -285,6 +287,7 @@ jobs:
ccache -z &&
cmake -B build -S .
--preset=github-ci
-DCMAKE_CXX_COMPILER=${{ matrix.cxx }}
-DCMAKE_CXX_STANDARD=${{ matrix.std }}
-DCMAKE_INSTALL_PREFIX="${INSTALL_DIR}"
-DPython_EXECUTABLE=$(which python3)
Expand Down
7 changes: 5 additions & 2 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,7 @@ linux_physmon:
.linux_ubuntu_extra:
variables:
INSTALL_DIR: ${CI_PROJECT_DIR}/install
CXX: g++

stage: build

Expand All @@ -336,6 +337,7 @@ linux_physmon:
--preset=gitlab-ci
-DPython_EXECUTABLE=$(which python3)
-DCMAKE_CXX_STANDARD=${CXXSTD}
-DCMAKE_CXX_COMPILER=${CXX}
- ccache -z
- cmake --build build -- -j6
Expand Down Expand Up @@ -367,14 +369,15 @@ linux_ubuntu_2204:
variables:
CXXSTD: 20
DEPENDENCY_URL: https://acts.web.cern.ch/ACTS/ci/ubuntu-22.04/deps.$DEPENDENCY_TAG.tar.zst
image: registry.cern.ch/ghcr.io/acts-project/ubuntu2204:63
image: registry.cern.ch/ghcr.io/acts-project/ubuntu2204:71

linux_ubuntu_2204_clang:
extends: .linux_ubuntu_extra
variables:
CXX: clang++
CXXSTD: 20
DEPENDENCY_URL: https://acts.web.cern.ch/ACTS/ci/ubuntu-22.04/deps.$DEPENDENCY_TAG.tar.zst
image: registry.cern.ch/ghcr.io/acts-project/ubuntu2204_clang:63
image: registry.cern.ch/ghcr.io/acts-project/ubuntu2204:71


######################
Expand Down
8 changes: 3 additions & 5 deletions thirdparty/Annoy/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.

cmake_minimum_required(VERSION 3.25)

# CMake include(s).
include(FetchContent)

Expand All @@ -18,6 +20,7 @@ set(ANNOY_VERSION "v${_acts_annoy_version}")
# Declare the fetching of the Annoy library.
FetchContent_Declare(
Annoy
SYSTEM
${ACTS_ANNOY_SOURCE}
PATCH_COMMAND
patch -p1 < ${CMAKE_CURRENT_SOURCE_DIR}/0001-Modify-annoy.patch
Expand All @@ -26,8 +29,3 @@ FetchContent_Declare(
# Make the fetched content available.
# Annoy contains a CMakeLists.txt file, so it will be added as a subdirectory.
FetchContent_MakeAvailable(Annoy)

target_compile_options(
Annoy
INTERFACE "-Wno-old-style-cast" "-Wno-zero-as-null-pointer-constant"
)
5 changes: 4 additions & 1 deletion thirdparty/FRNN/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,15 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.

cmake_minimum_required(VERSION 3.25)

include(FetchContent)

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

# Declare where to get frnncontent from
FetchContent_Declare(frnncontent ${ACTS_FRNN_SOURCE})
FetchContent_Declare(frnncontent SYSTEM ${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
4 changes: 3 additions & 1 deletion thirdparty/actsvg/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.

cmake_minimum_required(VERSION 3.25)

# CMake include(s).
include(FetchContent)

# Tell the user what's happening.
message(STATUS "Building actsvg as part of the ACTS project")

FetchContent_Declare(actsvg ${ACTS_ACTSVG_SOURCE})
FetchContent_Declare(actsvg SYSTEM ${ACTS_ACTSVG_SOURCE})

set(ACTSVG_BUILD_PYTHON_BINDINGS
OFF
Expand Down
4 changes: 3 additions & 1 deletion thirdparty/algebra-plugins/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.

cmake_minimum_required(VERSION 3.25)

# CMake include(s).
include(FetchContent)

# Tell the user what's happening.
message(STATUS "Building algebra-plugins as part of the Acts project")

FetchContent_Declare(AlgebraPlugins ${ACTS_ALGEBRAPLUGINS_SOURCE})
FetchContent_Declare(AlgebraPlugins SYSTEM ${ACTS_ALGEBRAPLUGINS_SOURCE})

# Options used in the build of Algebra Plugins.
set(ALGEBRA_PLUGINS_BUILD_TESTING
Expand Down
4 changes: 3 additions & 1 deletion thirdparty/covfie/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.

cmake_minimum_required(VERSION 3.25)

# CMake include(s).
include(FetchContent)

Expand All @@ -15,7 +17,7 @@ message(STATUS "Building Covfie as part of the Acts project")
set(COVFIE_VERSION "v${_acts_covfie_version}")

# Declare where to get covfie from.
FetchContent_Declare(covfie ${ACTS_COVFIE_SOURCE})
FetchContent_Declare(covfie SYSTEM ${ACTS_COVFIE_SOURCE})

# Options used for covfie.
set(COVFIE_BUILD_EXAMPLES OFF CACHE BOOL "Build covfie examples")
Expand Down
4 changes: 3 additions & 1 deletion thirdparty/detray/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.

cmake_minimum_required(VERSION 3.25)

# CMake include(s).
include(FetchContent)

Expand All @@ -15,7 +17,7 @@ message(STATUS "Building Detray as part of the Acts project")
set(DETRAY_VERSION "v${_acts_detray_version}")

# Declare where to get Detray from.
FetchContent_Declare(Detray ${ACTS_DETRAY_SOURCE})
FetchContent_Declare(Detray SYSTEM ${ACTS_DETRAY_SOURCE})

# Options used in the build of Detray.
set(ACTS_DETRAY_SCALARTYPE "double")
Expand Down
23 changes: 8 additions & 15 deletions thirdparty/eigen3/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,18 +1,11 @@
message(STATUS "Building Eigen ${_acts_eigen3_version}")
cmake_minimum_required(VERSION 3.25)

include(ExternalProject)
# CMake include(s).
include(FetchContent)

set(Eigen3_INCLUDE_DIR ${CMAKE_CURRENT_BINARY_DIR}/eigen3-prefix/src/eigen3)
# Tell the user what's happening.
message(STATUS "Building Eigen3 as part of the Acts project")

ExternalProject_Add(
eigen3
"${ACTS_EIGEN3_SOURCE};CONFIGURE_COMMAND;;BUILD_COMMAND;;INSTALL_COMMAND;"
)

add_library(Eigen3::Eigen INTERFACE IMPORTED GLOBAL)
add_dependencies(Eigen3::Eigen eigen3)
target_include_directories(Eigen3::Eigen INTERFACE ${Eigen3_INCLUDE_DIR})
install(
DIRECTORY ${Eigen3_INCLUDE_DIR}/Eigen
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
)
# Declare where to get Eigen from.
FetchContent_Declare(Eigen SYSTEM ${ACTS_EIGEN3_SOURCE})
FetchContent_MakeAvailable(Eigen)
4 changes: 3 additions & 1 deletion thirdparty/nlohmann_json/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
cmake_minimum_required(VERSION 3.25)

include(FetchContent)

# Tell the user what's happening.
message(STATUS "Building nlohmann_json as part of the ACTS project")

# Declare where to get nlohmann json from.
FetchContent_Declare(nlohmann_json ${ACTS_NLOHMANNJSON_SOURCE})
FetchContent_Declare(nlohmann_json SYSTEM ${ACTS_NLOHMANNJSON_SOURCE})

# Now set up its build.
set(JSON_BuildTests OFF CACHE INTERNAL "")
Expand Down
4 changes: 3 additions & 1 deletion thirdparty/pybind11/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
cmake_minimum_required(VERSION 3.25)

include(FetchContent)

# Tell the user what's happening.
message(STATUS "Building pybind11 as part of the ACTS project")

# Declare where to get pybind from.
FetchContent_Declare(pybind11 ${ACTS_PYBIND11_SOURCE})
FetchContent_Declare(pybind11 SYSTEM ${ACTS_PYBIND11_SOURCE})

# Now set up its build.
set(PYBIND11_TEST OFF)
Expand Down
4 changes: 3 additions & 1 deletion thirdparty/traccc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.

cmake_minimum_required(VERSION 3.25)

# CMake include(s).
include(FetchContent)

Expand All @@ -15,7 +17,7 @@ message(STATUS "Building traccc as part of the Acts project")
set(TRACCC_VERSION "${_acts_traccc_version}")

# Declare where to get traccc from.
FetchContent_Declare(traccc ${ACTS_TRACCC_SOURCE})
FetchContent_Declare(traccc SYSTEM ${ACTS_TRACCC_SOURCE})

set(ACTS_TRACCC_SCALARTYPE "double")

Expand Down
4 changes: 3 additions & 1 deletion thirdparty/vecmem/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.

cmake_minimum_required(VERSION 3.25)

# CMake include(s).
include(FetchContent)

Expand All @@ -15,7 +17,7 @@ message(STATUS "Building VecMem as part of the Acts project")
set(VECMEM_VERSION "v${_acts_vecmem_version}")

# Declare where to get VecMem from.
FetchContent_Declare(VecMem ${ACTS_VECMEM_SOURCE})
FetchContent_Declare(VecMem SYSTEM ${ACTS_VECMEM_SOURCE})

# Options used in the build of VecMem.
set(VECMEM_BUILD_TESTING
Expand Down

0 comments on commit bbd3fcc

Please sign in to comment.