24.09., 9:00 - 11:00: Due to updates GitLab will be unavailable for some minutes between 09:00 and 11:00.

CMakeLists.txt 2.01 KB
Newer Older
Tobias Lasser's avatar
Tobias Lasser committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
cmake_minimum_required(VERSION 3.9)

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


# list all the headers of the module
set(MODULE_HEADERS
        Residual.h
        LinearResidual.h
        Functional.h
        L1Norm.h
        L2NormPow2.h
        WeightedL2NormPow2.h
        LInfNorm.h
        Huber.h
        PseudoHuber.h
        Quadric.h
        EmissionLogLikelihood.h
        TransmissionLogLikelihood.h)

# list all the code files of the module
set(MODULE_SOURCES
        Residual.cpp
        LinearResidual.cpp
        Functional.cpp
        L1Norm.cpp
        L2NormPow2.cpp
        WeightedL2NormPow2.cpp
        LInfNorm.cpp
        Huber.cpp
        PseudoHuber.cpp
        Quadric.cpp
        EmissionLogLikelihood.cpp
        TransmissionLogLikelihood.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})

44
target_link_libraries(${ELSA_MODULE_TARGET_NAME} PUBLIC elsa_core elsa_logging elsa_operators)
Tobias Lasser's avatar
Tobias Lasser committed
45 46 47

target_include_directories(${ELSA_MODULE_TARGET_NAME}
        PUBLIC
48
        $<INSTALL_INTERFACE:include/elsa/${ELSA_MODULE_NAME}>
Tobias Lasser's avatar
Tobias Lasser committed
49 50 51 52 53 54
        $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
        )


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


# build the tests (if enabled)
if(ELSA_TESTING)
    add_subdirectory(tests)
endif(ELSA_TESTING)

Nikola Dinev's avatar
Nikola Dinev committed
64 65 66 67 68 69
if (ELSA_BUILD_PYTHON_BINDINGS)
        GENERATE_BINDINGS(${ELSA_MODULE_TARGET_NAME}
                ${CMAKE_CURRENT_BINARY_DIR}/bind_${ELSA_MODULE_NAME}.cpp
                ""
                ${MODULE_SOURCES})
endif()
Tobias Lasser's avatar
Tobias Lasser committed
70 71 72 73 74 75

# register the module
registerComponent(${ELSA_MODULE_NAME})

# install the module
InstallElsaModule(${ELSA_MODULE_NAME} ${ELSA_MODULE_TARGET_NAME} ${ELSA_MODULE_EXPORT_TARGET})