-
Notifications
You must be signed in to change notification settings - Fork 157
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build: Remove bundled dependencies in favor of CMake FetchContent (#1177
) As discussed in the past and also already implemented for vecmem, this PR removes the bundled copies of - nlohmann_json - pybind11 - dfelibs - autodiff and uses CMake's FetchContent to grab a copy. Also added is an option `ACTS_USE_SYSTEM_PYBIND11` to allow using an already installed copy. For nlohmann_json and autodiff this was already present, and I don't think it's necessary for dfelibs.
- Loading branch information
1 parent
c30bcf8
commit c9a5b53
Showing
114 changed files
with
98 additions
and
57,244 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,62 +1,29 @@ | ||
# The minimum required cmake version | ||
cmake_minimum_required(VERSION 3.0) | ||
|
||
# Add cmake modules of this project to the module path | ||
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake) | ||
|
||
# Use ccache to speed up repeated compilations | ||
include(CCache) | ||
|
||
# Name and details of the project | ||
project(autodiff VERSION 0.6.3 LANGUAGES CXX) | ||
|
||
# Enable parallel build if MSVC is used | ||
add_compile_options($<$<CXX_COMPILER_ID:MSVC>:/MP>) | ||
|
||
# Include the cmake variables with values for installation directories | ||
include(GNUInstallDirs) | ||
|
||
# Ensure proper configuration if in a conda environment | ||
include(CondaAware) | ||
|
||
# Define build options | ||
option(AUTODIFF_BUILD_TESTS "Enable the compilation of the test files." ON) | ||
option(AUTODIFF_BUILD_PYTHON "Enable the compilation of the python bindings." ON) | ||
option(AUTODIFF_BUILD_EXAMPLES "Enable the compilation of the example files." ON) | ||
option(AUTODIFF_BUILD_DOCS "Enable the build of the documentation and website." ON) | ||
|
||
# Find eigen library | ||
find_package(Eigen3 REQUIRED) | ||
|
||
# autodiff requires a c++17 enabled compiler | ||
set(CMAKE_CXX_STANDARD 17) # ensure cmake instructs compiler to use C++17 | ||
set(CMAKE_CXX_STANDARD_REQUIRED ON) # ensure the C++ standard given before is actually used | ||
set(CMAKE_CXX_EXTENSIONS OFF) # avoid compile flags of the type -std=gnu++1z added by cmake | ||
|
||
# Build the library (actually, just provide details about the library target, specify required compile options, etc. because autodiff is header-only) | ||
add_subdirectory(autodiff) | ||
|
||
# Build the tests | ||
if(AUTODIFF_BUILD_TESTS) | ||
add_subdirectory(tests) | ||
endif() | ||
|
||
# Build the python wrappers | ||
if(AUTODIFF_BUILD_PYTHON) | ||
set(PYBIND11_CPP_STANDARD -std=c++17) # Ensure pybind11 uses C++17 standard | ||
find_package(pybind11 REQUIRED) | ||
add_subdirectory(python) | ||
endif() | ||
|
||
# Build the examples | ||
if(AUTODIFF_BUILD_EXAMPLES) | ||
add_subdirectory(examples) | ||
endif() | ||
|
||
# Build the docs | ||
if(AUTODIFF_BUILD_DOCS) | ||
add_subdirectory(docs) | ||
endif() | ||
|
||
# Install the cmake config files that permit users to use find_package(autodiff) | ||
include(autodiffInstallCMakeConfigFiles) | ||
cmake_minimum_required( VERSION 3.11 ) | ||
include( FetchContent ) | ||
|
||
# Tell the user what's happening. | ||
message( STATUS "Building autodiff as part of the ACTS project" ) | ||
|
||
|
||
# Declare where to get VecMem from. | ||
set( ACTS_AUTODIFF_GIT_REPOSITORY "https://github.com/autodiff/autodiff.git" | ||
CACHE STRING "Git repository to take autodiff from" ) | ||
set( ACTS_AUTODIFF_GIT_TAG "v0.6.4" CACHE STRING "Version of autodiff to build" ) | ||
mark_as_advanced( ACTS_AUTODIFF_GIT_REPOSITORY ACTS_AUTODIFF_GIT_TAG ) | ||
FetchContent_Declare( autodiff | ||
GIT_REPOSITORY "${ACTS_AUTODIFF_GIT_REPOSITORY}" | ||
GIT_TAG "${ACTS_AUTODIFF_GIT_TAG}" ) | ||
|
||
# Now set up its build. | ||
# This policy allows to set the options outside without changing autodiff's CMakeLists.txt | ||
set(CMAKE_POLICY_DEFAULT_CMP0077 NEW) | ||
set(AUTODIFF_BUILD_TESTS OFF CACHE INTERNAL "") | ||
set(AUTODIFF_BUILD_PYTHON OFF CACHE INTERNAL "") | ||
set(AUTODIFF_BUILD_EXAMPLES OFF CACHE INTERNAL "") | ||
set(AUTODIFF_BUILD_DOCS OFF CACHE INTERNAL "") | ||
|
||
FetchContent_MakeAvailable( autodiff ) | ||
|
||
# Mark autodiff as system include directories so that no warnings trigger | ||
get_target_property(_autodiff_includes autodiff INTERFACE_INCLUDE_DIRECTORIES) | ||
set_target_properties(autodiff PROPERTIES INTERFACE_SYSTEM_INCLUDE_DIRECTORIES "${_autodiff_includes}") |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.