In January 2021 we will introduce a 10 GB quota for project repositories. Higher limits for individual projects will be available on request. Please see https://doku.lrz.de/display/PUBLIC/GitLab for more information.

CMakeLists.txt 3.19 KB
Newer Older
Tobias Lasser's avatar
Tobias Lasser committed
1 2 3 4 5 6 7 8 9 10
cmake_minimum_required(VERSION 3.9)

# set the name of the module
set(ELSA_MODULE_NAME core)
set(ELSA_MODULE_TARGET_NAME elsa_core)
set(ELSA_MODULE_EXPORT_TARGET elsa_${ELSA_MODULE_NAME}Targets)


# list all the headers of the module
set(MODULE_HEADERS
11
        elsaDefines.h
Tobias Lasser's avatar
Tobias Lasser committed
12
        Cloneable.h
13 14 15 16 17 18 19
        Descriptors/DataDescriptor.h
        Descriptors/DescriptorUtils.h
        Descriptors/VolumeDescriptor.h
        Descriptors/BlockDescriptor.h
        Descriptors/IdenticalBlocksDescriptor.h
        Descriptors/PartitionDescriptor.h
        Descriptors/RandomBlocksDescriptor.h
Tobias Lasser's avatar
Tobias Lasser committed
20
        DataContainer.h
21
        DataContainerIterator.h
22 23 24
        Handlers/DataHandler.h
        Handlers/DataHandlerCPU.h
        Handlers/DataHandlerMapCPU.h
Jens Petit's avatar
Jens Petit committed
25 26
        LinearOperator.h
        Expression.h
27 28 29
        ExpressionPredicates.h
        Geometry.h
        StrongTypes.h)
Tobias Lasser's avatar
Tobias Lasser committed
30 31 32

# list all the code files of the module
set(MODULE_SOURCES
33 34 35 36 37 38
        Descriptors/DataDescriptor.cpp
        Descriptors/VolumeDescriptor.cpp
        Descriptors/RandomBlocksDescriptor.cpp
        Descriptors/DescriptorUtils.cpp
        Descriptors/IdenticalBlocksDescriptor.cpp
        Descriptors/PartitionDescriptor.cpp
Tobias Lasser's avatar
Tobias Lasser committed
39
        DataContainer.cpp
40 41
        Handlers/DataHandlerCPU.cpp
        Handlers/DataHandlerMapCPU.cpp
42 43 44
        LinearOperator.cpp
        Geometry.cpp
        StrongTypes.cpp)
Tobias Lasser's avatar
Tobias Lasser committed
45

46 47 48
if(${ELSA_CUDA_VECTOR})
    set(MODULE_HEADERS
        ${MODULE_HEADERS}
49 50
        Handlers/DataHandlerGPU.h
        Handlers/DataHandlerMapGPU.h)
51 52 53

    set(MODULE_SOURCES
        ${MODULE_SOURCES}
54 55
        Handlers/DataHandlerGPU.cpp
        Handlers/DataHandlerMapGPU.cpp)
56
endif()
Tobias Lasser's avatar
Tobias Lasser committed
57 58 59 60

# 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})
61 62

target_link_libraries(${ELSA_MODULE_TARGET_NAME} PUBLIC Eigen3::Eigen)
Tobias Lasser's avatar
Tobias Lasser committed
63

Jens Petit's avatar
Jens Petit committed
64
# use OpenMP is available
65
find_package(OpenMP)
Jens Petit's avatar
Jens Petit committed
66 67 68 69
if(OpenMP_CXX_FOUND)
    target_link_libraries(${ELSA_MODULE_TARGET_NAME} PRIVATE OpenMP::OpenMP_CXX)
endif()

70 71 72
# link Quickvec for DataHandlerGPU
if(ELSA_CUDA_VECTOR AND Quickvec_FOUND)
    target_link_libraries(${ELSA_MODULE_TARGET_NAME} PUBLIC Quickvec::quickvec)
73
    target_compile_definitions(${ELSA_MODULE_TARGET_NAME} PUBLIC ELSA_ENABLE_CUDA_VECTOR)
74
endif()
75

Tobias Lasser's avatar
Tobias Lasser committed
76 77
target_include_directories(${ELSA_MODULE_TARGET_NAME}
        PUBLIC
78
        $<INSTALL_INTERFACE:include/elsa/${ELSA_MODULE_NAME}>
79 80
        $<INSTALL_INTERFACE:include/elsa/${ELSA_MODULE_NAME}/Descriptors>
        $<INSTALL_INTERFACE:include/elsa/${ELSA_MODULE_NAME}/Handlers>
Tobias Lasser's avatar
Tobias Lasser committed
81
        $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
82 83
        $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/Descriptors>
        $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/Handlers>
Tobias Lasser's avatar
Tobias Lasser committed
84 85 86 87 88
        )


# require C++17
target_compile_features(${ELSA_MODULE_TARGET_NAME} PUBLIC cxx_std_17)
89 90
# set -fPIC
set_target_properties(${ELSA_MODULE_TARGET_NAME} PROPERTIES POSITION_INDEPENDENT_CODE ON)
Tobias Lasser's avatar
Tobias Lasser committed
91

92

Tobias Lasser's avatar
Tobias Lasser committed
93 94 95 96 97 98 99 100 101 102
# build the tests (if enabled)
if(ELSA_TESTING)
    add_subdirectory(tests)
endif(ELSA_TESTING)


# register the module
registerComponent(${ELSA_MODULE_NAME})

# install the module
103
InstallElsaModuleDir(${ELSA_MODULE_NAME} ${ELSA_MODULE_TARGET_NAME} ${ELSA_MODULE_EXPORT_TARGET} "${CMAKE_CURRENT_SOURCE_DIR}/")