Commit cb7992b3 authored by Tobias Lasser's avatar Tobias Lasser
Browse files

fixing minor issues in CMake setup #18

parent 9aa4e345
Pipeline #169924 failed with stages
in 9 minutes and 18 seconds
......@@ -7,27 +7,29 @@ project(elsa VERSION 0.5
# ------------ elsa options ------------
# ------------
# detect if elsa is being bundled, disable some options based on this
if (NOT DEFINED ELSA_MASTER_PROJECT)
if (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
# detect if elsa is being as a submodule, enable/disable some options based on this
if(NOT DEFINED ELSA_MASTER_PROJECT)
if(CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
set(ELSA_MASTER_PROJECT ON)
else()
set(ELSA_MASTER_PROJECT OFF)
endif()
endif ()
option(ELSA_TESTING "Enable the unit tests of elsa" ${ELSA_MASTER_PROJECT})
option(ELSA_INSTALL "Generate the install target" ${ELSA_MASTER_PROJECT})
option(GIT_SUBMODULE "Check submodules during build" ${ELSA_MASTER_PROJECT})
option(ELSA_BUILD_EXAMPLES "Build examples" ${ELSA_MASTER_PROJECT})
option(ELSA_COVERAGE "Enables test coverage reporting" OFF)
option(ELSA_TESTING "Enable building the unit tests" ${ELSA_MASTER_PROJECT})
option(ELSA_CREATE_JUNIT_REPORTS "Enable creating JUnit style reports when running tests" ON)
option(ELSA_COVERAGE "Enable test coverage computation and reporting" OFF)
option(ELSA_BUILD_CUDA_PROJECTORS "Attempts to build CUDA projectors if set" ON)
option(ELSA_BUILD_WITH_MORE_WARNINGS "Reduce noise of warnings, but make chaning fast and easy" OFF)
option(ELSA_CREATE_JUNIT_REPORTS "Create JUnit style reports while running tests" ON)
option(GIT_SUBMODULE "Enable updating the submodules during build" ${ELSA_MASTER_PROJECT})
option(ELSA_INSTALL "Enable generating the install targets for make install" ${ELSA_MASTER_PROJECT})
option(ELSA_BUILD_EXAMPLES "Enable building of examples" ${ELSA_MASTER_PROJECT})
option(ELSA_BUILD_CUDA_PROJECTORS "Enable building (or attempting to) the CUDA projectors" ON)
option(ELSA_BUILD_WITH_MORE_WARNINGS "Enable all and extra warnings when building (-Wall -Wextra)" OFF)
option(ELSA_SANITIZE_THREAD "Build elsa with thread sanitizers (TSAN)" OFF)
option(ELSA_SANITIZE_ADDRESS "Build elsa with address and undefined-behavior sanitizers (ASAN and UBSAN)" OFF)
option(ELSA_SANITIZE_THREAD "Build with TSAN" OFF)
option(ELSA_SANITIZE_ADDRESS "Build with ASAN and UBSAN" OFF)
# ------------ general setup -----------
# ------------
......@@ -42,34 +44,36 @@ include(SetDefaultBuildType)
# set where to install the exports/targets
set(INSTALL_CONFIG_DIR ${CMAKE_INSTALL_LIBDIR}/cmake)
# ------------ dependencies ------------
# ------------
# only populate the dependencies, iff it's a standalone project!
# only add the dependencies if elsa is stand-alone
if(ELSA_MASTER_PROJECT)
# include the git submodule update
include(UpdateGitSubmodules)
# find Eigen Library
# if you're not using the submodules use set(EIGEN3_INCLUDE_DIR path/to/Eigen3) to point to the Eigen3 directory
# setup Eigen Library
set(EIGEN3_INCLUDE_DIR "${PROJECT_SOURCE_DIR}/thirdparty/eigen3")
find_package(Eigen3 3.3 REQUIRED)
message(STATUS "Using eigen3 submodule at ${EIGEN3_INCLUDE_DIR}")
# find spdlog Library
# if you're not using the submodules use set(Spdlog_INCLUDE_DIR path/to/spdlog) to point to the spdlog directory
# setup spdlog Library
set(Spdlog_INCLUDE_DIR "${PROJECT_SOURCE_DIR}/thirdparty/spdlog")
find_package(Spdlog REQUIRED)
message(STATUS "Using spdlog submodule at ${Spdlog_INCLUDE_DIR}")
else()
message(STATUS " No dependencies added for elsa, as it's a subproject")
message(STATUS " No dependencies added for elsa, as it is not stand-alone")
endif()
# include the In stallElsaModule function
# include the InstallElsaModule function
include(InstallElsaModule)
# ------------ setup testing -----------
# ------------
# reset ELSA_TESTING to only be active, if it's a standlone project
# if elsa is used as a submodule, turn testing off
if(NOT ELSA_MASTER_PROJECT)
set(ELSA_TESTING OFF)
endif(NOT ELSA_MASTER_PROJECT)
......@@ -82,23 +86,22 @@ if(ELSA_TESTING)
# add the CMake modules for automatic test discovery
set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/thirdparty/Catch2/contrib" ${CMAKE_MODULE_PATH})
else(ELSA_TESTING)
message(STATUS " elsa testing is disabled")
endif(ELSA_TESTING)
if(ELSA_COVERAGE)
message(STATUS "elsa test coverage is enabled")
# ------------ setup coverage test -----------
# ------------
if(ELSA_COVERAGE)
message(STATUS "elsa coverage is enabled")
include(CodeCoverage)
APPEND_COVERAGE_COMPILER_FLAGS()
set(COVERAGE_LCOV_EXCLUDES '${PROJECT_SOURCE_DIR}/thirdparty/*' '/usr/*')
SETUP_TARGET_FOR_COVERAGE_LCOV(NAME test_coverage EXECUTABLE ctest)
include(CodeCoverage)
APPEND_COVERAGE_COMPILER_FLAGS()
set(COVERAGE_LCOV_EXCLUDES '${PROJECT_SOURCE_DIR}/thirdparty/*' '/usr/*')
SETUP_TARGET_FOR_COVERAGE_LCOV(NAME test_coverage EXECUTABLE ctest)
endif(ELSA_COVERAGE)
else(ELSA_COVERAGE)
message(STATUS "elsa test coverage is disabled")
endif(ELSA_COVERAGE)
else(ELSA_TESTING)
message(STATUS " elsa testing is disabled")
endif(ELSA_TESTING)
# ------------ add code/docs -----------
......@@ -115,6 +118,7 @@ if(ELSA_BUILD_EXAMPLES)
add_subdirectory(examples EXCLUDE_FROM_ALL)
endif(ELSA_BUILD_EXAMPLES)
# ------------ setup installation ------
# ------------
......@@ -143,7 +147,6 @@ if(ELSA_INSTALL)
DESTINATION ${INSTALL_CONFIG_DIR}
)
# this puts the local build tree into the user package repository, but not the installed version...
# ...but we rely on the paths in the installed version. sigh. commented out for now.
#export(PACKAGE elsa)
......
......@@ -68,15 +68,13 @@ if(NOT Spdlog_FIND_VERSION)
set(Spdlog_FIND_VERSION "${SPDLOG_MAJOR_VERSION}.${SPDLOG_MINOR_VERSION}.${SPDLOG_PATCH_VERSION}")
endif(NOT Spdlog_FIND_VERSION)
find_package(PkgConfig)
if(EXISTS "${Spdlog_INCLUDE_DIR}")
_spdlog_check_version()
set(Spdlog_FOUND ${Spdlog_VERSION_OK})
else(EXISTS "${Spdlog_INCLUDE_DIR}")
# search first if an Eigen3Config.cmake is available in the system,
# if successful this would set EIGEN3_INCLUDE_DIR and the rest of
# search first if an SpdlogConfig.cmake is available in the system,
# if successful this would set Spdlog_INCLUDE_DIR and the rest of
# the script will work as usual
find_package(Spdlog ${Spdlog_FIND_VERSION} NO_MODULE QUIET)
......@@ -93,11 +91,8 @@ else(EXISTS "${Spdlog_INCLUDE_DIR}")
DOC "spdlog library header files"
PATH_SUFFIXES spdlog
)
message(DEBUG " spdlog dir ${Spdlog_INCLUDE_DIR}")
endif(NOT Spdlog_INCLUDE_DIR)
message(DEBUG " spdlog dir ${Spdlog_INCLUDE_DIR}")
if(Spdlog_INCLUDE_DIR)
_spdlog_check_version()
endif(Spdlog_INCLUDE_DIR)
......
......@@ -2,7 +2,7 @@
function(InstallElsaModule ELSA_MODULE_NAME ELSA_MODULE_TARGET_NAME ELSA_MODULE_EXPORT_TARGET)
if(ELSA_INSTALL)
#This is required so that the exported target has the name core and not elsa_core
# This is required so that the exported target has the name core and not elsa_core
set_target_properties(${ELSA_MODULE_TARGET_NAME} PROPERTIES EXPORT_NAME ${ELSA_MODULE_NAME})
include(GNUInstallDirs)
......@@ -16,7 +16,7 @@ function(InstallElsaModule ELSA_MODULE_NAME ELSA_MODULE_TARGET_NAME ELSA_MODULE_
)
# install the header files
install(FILES ${MODULE_HEADERS}
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${ELSA_MODULE_NAME}
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/elsa/${ELSA_MODULE_NAME}
)
# create the config file for the module
install(EXPORT ${ELSA_MODULE_EXPORT_TARGET}
......
# setup sanitizers
if(ELSA_SANITIZE_THREAD AND ELSA_SANITIZE_ADDRESS)
message(FATAL_ERROR "AddressSanitizer is not compatible with ThreadSanitizer.")
......
......@@ -10,7 +10,7 @@ if(GIT_FOUND AND EXISTS "${PROJECT_SOURCE_DIR}/.git")
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
RESULT_VARIABLE GIT_SUBMODULE_RESULT)
if(NOT GIT_SUBMODULE_RESULT EQUAL "0")
message(FATAL_ERROR "git submodule update --init failed with ${GIT_SUBMODULE_RESULT}, please check out submodules")
message(WARNING "git submodule update --init failed with ${GIT_SUBMODULE_RESULT}")
endif()
endif()
endif()
......
......@@ -2,14 +2,23 @@
include(CMakeFindDependencyMacro)
find_dependency(Eigen3 3.3 NO_MODULE REQUIRED)
find_dependency(Spdlog REQUIRED)
set(_supported_components @ELSA_REGISTERED_COMPONENTS@)
message(STATUS "elsa components found: ${_supported_components}")
foreach(_comp ${elsa_FIND_COMPONENTS})
if (NOT _comp IN_LIST _supported_components)
set(elsa_FOUND False)
set(elsa_NOT_FOUND_MESSAGE "Unsupported component: ${_comp}")
endif()
include(${CMAKE_CURRENT_LIST_DIR}/elsa_${_comp}Targets.cmake)
endforeach()
# if no specific components requested, include all
if(NOT elsa_FIND_COMPONENTS)
foreach(_comp ${_supported_components})
include(${CMAKE_CURRENT_LIST_DIR}/elsa_${_comp}Targets.cmake)
endforeach()
message(STATUS "elsa found, using all modules")
else()
foreach(_comp ${elsa_FIND_COMPONENTS})
if (NOT _comp IN_LIST _supported_components)
set(elsa_FOUND False)
set(elsa_NOT_FOUND_MESSAGE "Unsupported component: ${_comp}")
endif()
include(${CMAKE_CURRENT_LIST_DIR}/elsa_${_comp}Targets.cmake)
endforeach()
message(STATUS "elsa found, using components: ${elsa_FIND_COMPONENTS}")
endif()
......@@ -7,7 +7,7 @@ macro(registerComponent name)
endmacro()
# macro for the unit tests
MACRO (ELSA_TEST NAME)
macro(ELSA_TEST NAME)
# create the test executable
add_executable(test_${NAME} test_${NAME}.cpp test_main.cpp)
# add catch and the corresponding elsa library
......@@ -18,19 +18,21 @@ MACRO (ELSA_TEST NAME)
# if we use JUnit reporter handle arguments
if(${ELSA_CREATE_JUNIT_REPORTS})
file(MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/test_reports)
set(ELSA_JUNIT_ARGUMENTS "-r junit" "-o ${PROJECT_BINARY_DIR}/test_reports/test_${NAME}.xml")
endif(${ELSA_CREATE_JUNIT_REPORTS})
# let Catch discover and register all the test cases
catch_discover_tests(test_${NAME} TEST_SPEC ${ELSA_JUNIT_ARGUMENTS})
ENDMACRO (ELSA_TEST)
endmacro(ELSA_TEST)
# add sanitizers if in debug mode
if(${CMAKE_BUILD_TYPE} MATCHES "Debug")
include(${PROJECT_SOURCE_DIR}/cmake/Sanitizers.cmake)
endif()
# add a general custom target "elsa" that includes everything
add_custom_target(elsa)
# add the elsa modules
add_subdirectory(core)
add_subdirectory(logging)
......@@ -46,22 +48,17 @@ endif(ELSA_BUILD_CUDA_PROJECTORS)
add_subdirectory(generators)
#---------------------------------------------------------------------------------------
# Turn on compiler warnings and sanitizers for all components on, if wanted
#---------------------------------------------------------------------------------------
if(${ELSA_MASTER_PROJECT})
foreach (_component ${ELSA_REGISTERED_COMPONENTS})
# add warnings if enabled
if(${ELSA_BUILD_WITH_MORE_WARNINGS})
if (CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang|AppleClang")
target_compile_options( elsa_${_component} PUBLIC -Wall -Wextra -Wconversion -pedantic -Wfatal-errors)
endif()
if (CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
target_compile_options( elsa_${_component} PUBLIC /W3 /WX )
endif()
endif(${ELSA_BUILD_WITH_MORE_WARNINGS})
endforeach (_component ELSA_REGISTERED_COMPONENTS)
endif(${ELSA_MASTER_PROJECT})
# if stand-alone and option set, turn on all warnings for all components
if(${ELSA_MASTER_PROJECT} AND ${ELSA_BUILD_WITH_MORE_WARNINGS})
foreach(_component ${ELSA_REGISTERED_COMPONENTS})
if (CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang|AppleClang")
target_compile_options(elsa_${_component} PUBLIC -Wall -Wextra -Wconversion -pedantic -Wfatal-errors)
endif()
if (CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
target_compile_options(elsa_${_component} PUBLIC /W3 /WX)
endif()
endforeach(_component ELSA_REGISTERED_COMPONENTS)
endif()
# propogate the variable to the parent scope
set(ELSA_REGISTERED_COMPONENTS "${ELSA_REGISTERED_COMPONENTS};" PARENT_SCOPE)
......@@ -29,27 +29,30 @@ set(MODULE_SOURCES
# build the module library
add_library(${ELSA_MODULE_TARGET_NAME} ${MODULE_HEADERS} ${MODULE_SOURCES})
add_library(elsa::${ELSA_MODULE_NAME} ALIAS ${ELSA_MODULE_TARGET_NAME})
add_dependencies(elsa ${ELSA_MODULE_TARGET_NAME})
target_link_libraries(${ELSA_MODULE_TARGET_NAME} PUBLIC Eigen3::Eigen)
# use OpenMP is available
find_package(OpenMP REQUIRED)
find_package(OpenMP)
if(OpenMP_CXX_FOUND)
target_link_libraries(${ELSA_MODULE_TARGET_NAME} PRIVATE OpenMP::OpenMP_CXX)
endif()
target_include_directories(${ELSA_MODULE_TARGET_NAME}
PUBLIC
$<INSTALL_INTERFACE:include/${ELSA_MODULE_NAME}>
$<INSTALL_INTERFACE:include/elsa/${ELSA_MODULE_NAME}>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
)
target_link_libraries(${ELSA_MODULE_TARGET_NAME} PUBLIC Eigen3::Eigen)
# require C++17
target_compile_features(${ELSA_MODULE_TARGET_NAME} PUBLIC cxx_std_17)
# set -fPIC
set_target_properties(${ELSA_MODULE_TARGET_NAME} PROPERTIES POSITION_INDEPENDENT_CODE ON)
# build the tests (if enabled)
if(ELSA_TESTING)
add_subdirectory(tests)
......
......@@ -40,12 +40,13 @@ set(MODULE_SOURCES
# build the module library
add_library(${ELSA_MODULE_TARGET_NAME} ${MODULE_HEADERS} ${MODULE_SOURCES})
add_library(elsa::${ELSA_MODULE_NAME} ALIAS ${ELSA_MODULE_TARGET_NAME})
add_dependencies(elsa ${ELSA_MODULE_TARGET_NAME})
target_link_libraries(${ELSA_MODULE_TARGET_NAME} PUBLIC elsa_core elsa_logging elsa_operators)
target_include_directories(${ELSA_MODULE_TARGET_NAME}
PUBLIC
$<INSTALL_INTERFACE:include/${ELSA_MODULE_NAME}>
$<INSTALL_INTERFACE:include/elsa/${ELSA_MODULE_NAME}>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
)
......
......@@ -22,12 +22,13 @@ set(MODULE_SOURCES
# build the module library
add_library(${ELSA_MODULE_TARGET_NAME} ${MODULE_HEADERS} ${MODULE_SOURCES})
add_library(elsa::${ELSA_MODULE_NAME} ALIAS ${ELSA_MODULE_TARGET_NAME})
add_dependencies(elsa ${ELSA_MODULE_TARGET_NAME})
target_link_libraries(${ELSA_MODULE_TARGET_NAME} PUBLIC elsa_core elsa_logging elsa_projectors)
target_include_directories(${ELSA_MODULE_TARGET_NAME}
PUBLIC
$<INSTALL_INTERFACE:include/${ELSA_MODULE_NAME}>
$<INSTALL_INTERFACE:include/elsa/${ELSA_MODULE_NAME}>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
)
......
......@@ -22,12 +22,13 @@ set(MODULE_SOURCES
# build the module library
add_library(${ELSA_MODULE_TARGET_NAME} ${MODULE_HEADERS} ${MODULE_SOURCES})
add_library(elsa::${ELSA_MODULE_NAME} ALIAS ${ELSA_MODULE_TARGET_NAME})
add_dependencies(elsa ${ELSA_MODULE_TARGET_NAME})
target_link_libraries(${ELSA_MODULE_TARGET_NAME} PUBLIC elsa_core elsa_logging)
target_include_directories(${ELSA_MODULE_TARGET_NAME}
PUBLIC
$<INSTALL_INTERFACE:include/${ELSA_MODULE_NAME}>
$<INSTALL_INTERFACE:include/elsa/${ELSA_MODULE_NAME}>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
)
......
......@@ -22,10 +22,11 @@ set(MODULE_SOURCES
# build the module library
add_library(${ELSA_MODULE_TARGET_NAME} ${MODULE_HEADERS} ${MODULE_SOURCES})
add_library(elsa::${ELSA_MODULE_NAME} ALIAS ${ELSA_MODULE_TARGET_NAME})
add_dependencies(elsa ${ELSA_MODULE_TARGET_NAME})
target_include_directories(${ELSA_MODULE_TARGET_NAME}
PUBLIC
$<INSTALL_INTERFACE:include/${ELSA_MODULE_NAME}>
$<INSTALL_INTERFACE:include/elsa/${ELSA_MODULE_NAME}>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
)
......
......@@ -22,6 +22,7 @@ set(MODULE_SOURCES
# build the module library
add_library(${ELSA_MODULE_TARGET_NAME} ${MODULE_HEADERS} ${MODULE_SOURCES})
add_library(elsa::${ELSA_MODULE_NAME} ALIAS ${ELSA_MODULE_TARGET_NAME})
add_dependencies(elsa ${ELSA_MODULE_TARGET_NAME})
target_link_libraries(${ELSA_MODULE_TARGET_NAME} PUBLIC elsa_core elsa_logging)
......@@ -34,7 +35,7 @@ endif()
target_include_directories(${ELSA_MODULE_TARGET_NAME}
PUBLIC
$<INSTALL_INTERFACE:include/${ELSA_MODULE_NAME}>
$<INSTALL_INTERFACE:include/elsa/${ELSA_MODULE_NAME}>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
)
......
......@@ -24,12 +24,13 @@ set(MODULE_SOURCES
# build the module library
add_library(${ELSA_MODULE_TARGET_NAME} ${MODULE_HEADERS} ${MODULE_SOURCES})
add_library(elsa::${ELSA_MODULE_NAME} ALIAS ${ELSA_MODULE_TARGET_NAME})
add_dependencies(elsa ${ELSA_MODULE_TARGET_NAME})
target_link_libraries(${ELSA_MODULE_TARGET_NAME} PUBLIC elsa_core elsa_logging elsa_operators elsa_functionals)
target_include_directories(${ELSA_MODULE_TARGET_NAME}
PUBLIC
$<INSTALL_INTERFACE:include/${ELSA_MODULE_NAME}>
$<INSTALL_INTERFACE:include/elsa/${ELSA_MODULE_NAME}>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
)
......
......@@ -32,6 +32,7 @@ set(MODULE_SOURCES
# build the module library
add_library(${ELSA_MODULE_TARGET_NAME} ${MODULE_HEADERS} ${MODULE_SOURCES})
add_library(elsa::${ELSA_MODULE_NAME} ALIAS ${ELSA_MODULE_TARGET_NAME})
add_dependencies(elsa ${ELSA_MODULE_TARGET_NAME})
target_link_libraries(${ELSA_MODULE_TARGET_NAME} PUBLIC elsa_core elsa_logging)
......@@ -44,7 +45,7 @@ endif()
target_include_directories(${ELSA_MODULE_TARGET_NAME}
PUBLIC
$<INSTALL_INTERFACE:include/${ELSA_MODULE_NAME}>
$<INSTALL_INTERFACE:include/elsa/${ELSA_MODULE_NAME}>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
)
......
......@@ -32,12 +32,13 @@ if (CMAKE_CUDA_COMPILER)
# build the module library
add_library(${ELSA_MODULE_TARGET_NAME} ${MODULE_HEADERS} ${MODULE_SOURCES})
add_library(elsa::${ELSA_MODULE_NAME} ALIAS ${ELSA_MODULE_TARGET_NAME})
add_dependencies(elsa ${ELSA_MODULE_TARGET_NAME})
target_link_libraries(${ELSA_MODULE_TARGET_NAME} PUBLIC elsa_core elsa_logging elsa_projectors elsa_projector_kernels)
target_include_directories(${ELSA_MODULE_TARGET_NAME}
PUBLIC
$<INSTALL_INTERFACE:include/${ELSA_MODULE_NAME}>
$<INSTALL_INTERFACE:include/elsa/${ELSA_MODULE_NAME}>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
)
target_include_directories(${ELSA_MODULE_TARGET_NAME}
......
......@@ -20,12 +20,13 @@ set(MODULE_SOURCES
# build the module library
add_library(${ELSA_MODULE_TARGET_NAME} ${MODULE_HEADERS} ${MODULE_SOURCES})
add_library(elsa::${ELSA_MODULE_NAME} ALIAS ${ELSA_MODULE_TARGET_NAME})
add_dependencies(elsa ${ELSA_MODULE_TARGET_NAME})
target_link_libraries(${ELSA_MODULE_TARGET_NAME} PUBLIC elsa_core elsa_logging elsa_problems)
target_include_directories(${ELSA_MODULE_TARGET_NAME}
PUBLIC
$<INSTALL_INTERFACE:include/${ELSA_MODULE_NAME}>
$<INSTALL_INTERFACE:include/elsa/${ELSA_MODULE_NAME}>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
)
......
cmake_minimum_required(VERSION 3.9)
# define a target for all examples
add_custom_target(examples)
# build the 2d example program
add_executable(example2d example2d.cpp)
target_link_libraries(example2d elsa_core elsa_projectors elsa_generators elsa_io elsa_solvers)
target_compile_features(example2d PUBLIC cxx_std_17)
add_dependencies(examples example2d)
if (BUILD_ELSA_PROJECTORS_CUDA)
if(ELSA_BUILD_CUDA_PROJECTORS)
check_language(CUDA)
if (CMAKE_CUDA_COMPILER)
if(CMAKE_CUDA_COMPILER)
enable_language(CUDA)
# build the 3d example program
add_executable(example3d example3d.cpp)
target_link_libraries(example3d elsa_core elsa_projectors_cuda elsa_generators elsa_io elsa_solvers)
target_compile_features(example3d PUBLIC cxx_std_17)
add_dependencies(examples example3d)
# build the GPU projector speed test program
add_executable(speed_test speed_test.cpp)
target_link_libraries(speed_test elsa_generators elsa_projectors_cuda elsa_logging)
target_compile_features(speed_test PUBLIC cxx_std_17)
add_dependencies(examples speed_test)
endif()
endif()
\ No newline at end of file
Markdown is supported
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