CMakeLists.txt 4.71 KB
Newer Older
Tobias Lasser's avatar
Tobias Lasser committed
1
2
# list all the headers of the module
set(MODULE_HEADERS
3
4
5
6
    elsaDefines.h
    Backtrace.h
    Cloneable.h
    Utilities/Badge.hpp
7
    Utilities/CartesianIndices.h
8
    Utilities/DataContainerFormatter.hpp
9
    Utilities/FormatConfig.h
10
    Utilities/Math.hpp
11
    Utilities/Statistics.hpp
12
    Utilities/TypeCasts.hpp
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
    Descriptors/DataDescriptor.h
    Descriptors/DescriptorUtils.h
    Descriptors/VolumeDescriptor.h
    Descriptors/DetectorDescriptor.h
    Descriptors/PlanarDetectorDescriptor.h
    Descriptors/BlockDescriptor.h
    Descriptors/IdenticalBlocksDescriptor.h
    Descriptors/PartitionDescriptor.h
    Descriptors/RandomBlocksDescriptor.h
    DataContainer.h
    DataContainerIterator.h
    Error.h
    Handlers/DataHandler.h
    Handlers/DataHandlerCPU.h
    Handlers/DataHandlerMapCPU.h
    LinearOperator.h
    Expression.h
    ExpressionPredicates.h
    Geometry.h
    StrongTypes.h
)
Tobias Lasser's avatar
Tobias Lasser committed
34
35
36

# list all the code files of the module
set(MODULE_SOURCES
37
    elsaDefines.cpp
38
    Backtrace.cpp
39
    Utilities/CartesianIndices.cpp
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
    Descriptors/DataDescriptor.cpp
    Descriptors/VolumeDescriptor.cpp
    Descriptors/PlanarDetectorDescriptor.cpp
    Descriptors/RandomBlocksDescriptor.cpp
    Descriptors/DescriptorUtils.cpp
    Descriptors/IdenticalBlocksDescriptor.cpp
    Descriptors/DetectorDescriptor.cpp
    Descriptors/PartitionDescriptor.cpp
    DataContainer.cpp
    Error.cpp
    Handlers/DataHandlerCPU.cpp
    Handlers/DataHandlerMapCPU.cpp
    LinearOperator.cpp
    Geometry.cpp
    StrongTypes.cpp
)
Tobias Lasser's avatar
Tobias Lasser committed
56

David Frank's avatar
David Frank committed
57
if(${ELSA_BUILD_WITH_QUICKVEC})
58
59
    set(MODULE_HEADERS ${MODULE_HEADERS} Handlers/DataHandlerGPU.h Handlers/DataHandlerMapGPU.h)
    set(MODULE_SOURCES ${MODULE_SOURCES} Handlers/DataHandlerGPU.cpp Handlers/DataHandlerMapGPU.cpp)
60
endif()
Tobias Lasser's avatar
Tobias Lasser committed
61

62
list(APPEND MODULE_PUBLIC_DEPS "Eigen3::Eigen" elsa_logging)
63
list(APPEND MODULE_PRIVATE_DEPS)
64

65
# use OpenMP if available
66
find_package(OpenMP)
Jens Petit's avatar
Jens Petit committed
67
if(OpenMP_CXX_FOUND)
68
    list(APPEND MODULE_PUBLIC_DEPS "OpenMP::OpenMP_CXX")
Jens Petit's avatar
Jens Petit committed
69
70
endif()

71
# link Quickvec for DataHandlerGPU
David Frank's avatar
David Frank committed
72
if(${ELSA_BUILD_WITH_QUICKVEC})
73
    list(APPEND MODULE_PUBLIC_DEPS "elsa_quickvec")
74
endif()
75

Jonas Jelten's avatar
Jonas Jelten committed
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96

# use FFTW if available
option(WITH_FFTW "Build elsa using fftw for faster fourier transforms" ON)

# workaround for
# https://github.com/FFTW/fftw3/issues/130
# better would be find_package(fftw3)
# fftw3f: float, fftw3: double, fftw3l: 128bit, _omp: OpenMP
if(WITH_FFTW)
    find_package(PkgConfig)
    if(PKG_CONFIG_FOUND)
        pkg_check_modules(FFTW3d IMPORTED_TARGET "fftw3")
        pkg_check_modules(FFTW3f IMPORTED_TARGET "fftw3f")
        if(FFTW3d_FOUND AND FFTW3f_FOUND)
            set(FFTW3_FOUND TRUE)
            list(APPEND MODULE_PUBLIC_DEPS "PkgConfig::FFTW3d" "PkgConfig::FFTW3f")
            # TODO: also add fftw3_omp if supported
        endif()
    endif()
endif()

97
ADD_ELSA_MODULE(
98
99
100
    core "${MODULE_HEADERS}" "${MODULE_SOURCES}" INSTALL_DIR PUBLIC_DEPS ${MODULE_PUBLIC_DEPS}
    PRIVATE_DEPS ${MODULE_PRIVATE_DEPS}
)
Tobias Lasser's avatar
Tobias Lasser committed
101

102
103
# CMAKE_DL_LIBS is a weird name, so I can't figure out now, how to pass it via argument, so add it later...
target_link_libraries(${ELSA_MODULE_TARGET_NAME} PRIVATE ${CMAKE_DL_LIBS})
Tobias Lasser's avatar
Tobias Lasser committed
104

105
106
107
108
109
110
111
112
113
114
115
# Add additional folders for core
target_include_directories(
    ${ELSA_MODULE_TARGET_NAME}
    PUBLIC $<INSTALL_INTERFACE:include/elsa/${ELSA_MODULE_NAME}/Descriptors>
           $<INSTALL_INTERFACE:include/elsa/${ELSA_MODULE_NAME}/Handlers>
           $<INSTALL_INTERFACE:include/elsa/${ELSA_MODULE_NAME}/Utilities>
           $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/Descriptors>
           $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/Handlers>
           $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/Utilities>
)

Jonas Jelten's avatar
Jonas Jelten committed
116
117
118
119
120
if(WITH_FFTW AND FFTW3_FOUND)
    target_compile_definitions("${ELSA_MODULE_TARGET_NAME}" PRIVATE WITH_FFTW)
endif()


121
122
123
if(ELSA_BUILD_PYTHON_BINDINGS)
    set(BINDINGS_SOURCES
        ${MODULE_SOURCES}
Nikola Dinev's avatar
Nikola Dinev committed
124
125
126
127
128
129
130
        Descriptors/DataDescriptor.h
        Descriptors/DescriptorUtils.h
        Descriptors/VolumeDescriptor.h
        Descriptors/BlockDescriptor.h
        Descriptors/IdenticalBlocksDescriptor.h
        Descriptors/PartitionDescriptor.h
        Descriptors/RandomBlocksDescriptor.h
131
132
        Descriptors/DetectorDescriptor.h
        Descriptors/PlanarDetectorDescriptor.h
133
134
135
        Geometry.h
    )

Nikola Dinev's avatar
Nikola Dinev committed
136
137
138
139
140
    list(FILTER BINDINGS_SOURCES EXCLUDE REGEX DataHandler.*.cpp)
    list(FILTER BINDINGS_SOURCES EXCLUDE REGEX .*Descriptor.*.cpp)
    list(FILTER BINDINGS_SOURCES EXCLUDE REGEX Geometry.cpp)
    list(FILTER BINDINGS_SOURCES EXCLUDE REGEX StrongTypes.cpp)

141
    GENERATE_BINDINGS(
142
143
144
        ${ELSA_MODULE_TARGET_NAME} bind_${ELSA_MODULE_NAME}.cpp
        ${PROJECT_SOURCE_DIR}/tools/bindings_generation/hints/${ELSA_MODULE_NAME}_hints.cpp ${BINDINGS_SOURCES}
    )
Nikola Dinev's avatar
Nikola Dinev committed
145
endif()
146

147
write_module_config(${ELSA_MODULE_NAME} DEPENDENCIES elsa_logging)