CMakeLists.txt 1.98 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 13 14
        Cloneable.h
        DataDescriptor.h
        BlockDescriptor.h
15 16 17
        IdenticalBlocksDescriptor.h
        PartitionDescriptor.h
        RandomBlocksDescriptor.h
Tobias Lasser's avatar
Tobias Lasser committed
18
        DataContainer.h
19
        DataContainerIterator.h
Tobias Lasser's avatar
Tobias Lasser committed
20 21
        DataHandler.h
        DataHandlerCPU.h
22
        DataHandlerMapCPU.h
Jens Petit's avatar
Jens Petit committed
23 24 25
        LinearOperator.h
        Expression.h
        ExpressionPredicates.h)
Tobias Lasser's avatar
Tobias Lasser committed
26 27 28 29

# list all the code files of the module
set(MODULE_SOURCES
        DataDescriptor.cpp
30 31 32
        RandomBlocksDescriptor.cpp
        IdenticalBlocksDescriptor.cpp
        PartitionDescriptor.cpp
Tobias Lasser's avatar
Tobias Lasser committed
33 34
        DataContainer.cpp
        DataHandlerCPU.cpp
35
        DataHandlerMapCPU.cpp
Tobias Lasser's avatar
Tobias Lasser committed
36 37 38 39 40 41
        LinearOperator.cpp)


# 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})
42 43

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

Jens Petit's avatar
Jens Petit committed
45
# use OpenMP is available
46
find_package(OpenMP)
Jens Petit's avatar
Jens Petit committed
47 48 49 50
if(OpenMP_CXX_FOUND)
    target_link_libraries(${ELSA_MODULE_TARGET_NAME} PRIVATE OpenMP::OpenMP_CXX)
endif()

51

Tobias Lasser's avatar
Tobias Lasser committed
52 53
target_include_directories(${ELSA_MODULE_TARGET_NAME}
        PUBLIC
54
        $<INSTALL_INTERFACE:include/elsa/${ELSA_MODULE_NAME}>
Tobias Lasser's avatar
Tobias Lasser committed
55 56 57 58 59 60
        $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
        )


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

64

Tobias Lasser's avatar
Tobias Lasser committed
65 66 67 68 69 70 71 72 73 74
# build the tests (if enabled)
if(ELSA_TESTING)
    add_subdirectory(tests)
endif(ELSA_TESTING)


# register the module
registerComponent(${ELSA_MODULE_NAME})

# install the module
Jens Petit's avatar
Jens Petit committed
75
InstallElsaModule(${ELSA_MODULE_NAME} ${ELSA_MODULE_TARGET_NAME} ${ELSA_MODULE_EXPORT_TARGET})