Commit f2509d5e authored by Jonas Jelten's avatar Jonas Jelten 🥕
Browse files

allow building elsa completely with system dependencies

parent 39672516
......@@ -42,6 +42,8 @@ set(ELSA_CUDA_ARCH_TYPE "auto" CACHE STRING "Set CUDA architectures")
option(SYSTEM_EIGEN "Build elsa using the system eigen installation" OFF)
option(SYSTEM_SPDLOG "Build elsa using the system spdlog installation" OFF)
option(SYSTEM_DOCTEST "Build elsa using the system doctest installation" OFF)
option(SYSTEM_CATCH "Build elsa using the system catch installation" OFF)
# ------------ general setup -----------
# ------------
......@@ -56,9 +58,6 @@ include(SetDefaultBuildType)
# Forbid extensions (such as gnu++) for this project
set(CMAKE_CXX_EXTENSIONS OFF)
# Include CPM dependency manager
include(CPM)
# export compile_commands.json for language servers such as ccls
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
......@@ -76,6 +75,12 @@ set(INSTALL_CONFIG_DIR ${CMAKE_INSTALL_LIBDIR}/cmake/elsa)
# ------------ dependencies ------------
# ------------
if (NOT (SYSTEM_EIGEN AND SYSTEM_SPDLOG AND SYSTEM_DOCTEST AND SYSTEM_CATCH))
# Include CPM dependency manager for bundling dependencies
include(CPM)
endif()
# only add the dependencies if elsa is stand-alone
if(ELSA_MASTER_PROJECT)
if(SYSTEM_EIGEN)
......@@ -239,14 +244,19 @@ endif(NOT ELSA_MASTER_PROJECT)
if(ELSA_TESTING OR ELSA_BENCHMARKS)
enable_testing()
CPMAddPackage(
NAME doctest
GITHUB_REPOSITORY onqtam/doctest
GIT_TAG 2.4.4
)
if(SYSTEM_DOCTEST)
message(STATUS "Using system-wide doctest library...")
find_package(doctest REQUIRED)
else()
CPMAddPackage(
NAME doctest
GITHUB_REPOSITORY onqtam/doctest
GIT_TAG 2.4.4
)
# add the CMake modules for automatic test discovery
set(CMAKE_MODULE_PATH "${doctest_SOURCE_DIR}/scripts/cmake" ${CMAKE_MODULE_PATH})
# add the CMake modules for automatic test discovery
set(CMAKE_MODULE_PATH "${doctest_SOURCE_DIR}/scripts/cmake" ${CMAKE_MODULE_PATH})
endif()
if(ELSA_TESTING)
message(STATUS "elsa testing is enabled")
......
# Create binaries for benchmarks in bin/benchmarks
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin/benchmarks)
# add Catch2 only here to still use it in benchmarks
CPMAddPackage(
NAME Catch2
GITHUB_REPOSITORY catchorg/Catch2
VERSION 2.10.1 # <-- Current, update to: 2.13.1
)
# add the CMake modules for automatic test discovery
set(CMAKE_MODULE_PATH "${Catch2_SOURCE_DIR}/contrib" ${CMAKE_MODULE_PATH})
if (SYSTEM_CATCH)
message(STATUS "Using system-wide catch library...")
find_package(Catch2 REQUIRED 2.10)
else()
# add Catch2 only here to still use it in benchmarks
CPMAddPackage(
NAME Catch2
GITHUB_REPOSITORY catchorg/Catch2
VERSION 2.10.1 # <-- Current, update to: 2.13.1
)
# add the CMake modules for automatic test discovery
set(CMAKE_MODULE_PATH "${Catch2_SOURCE_DIR}/contrib" ${CMAKE_MODULE_PATH})
endif()
# enable ctest and Catch test discovery
include(CTest)
include(Catch)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment