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

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

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


# list all the headers of the module
set(MODULE_HEADERS
        Solver.h
12 13
        GradientDescent.h
        CG.h)
Tobias Lasser's avatar
Tobias Lasser committed
14 15 16 17

# list all the code files of the module
set(MODULE_SOURCES
        Solver.cpp
18 19
        GradientDescent.cpp
        CG.cpp)
Tobias Lasser's avatar
Tobias Lasser committed
20 21 22 23 24 25


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

26
target_link_libraries(${ELSA_MODULE_TARGET_NAME} PUBLIC elsa_core elsa_logging elsa_problems)
Tobias Lasser's avatar
Tobias Lasser committed
27 28 29

target_include_directories(${ELSA_MODULE_TARGET_NAME}
        PUBLIC
30
        $<INSTALL_INTERFACE:include/elsa/${ELSA_MODULE_NAME}>
Tobias Lasser's avatar
Tobias Lasser committed
31 32 33 34 35 36
        $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
        )


# require C++17
target_compile_features(${ELSA_MODULE_TARGET_NAME} PUBLIC cxx_std_17)
37 38
# set -fPIC
set_target_properties(${ELSA_MODULE_TARGET_NAME} PROPERTIES POSITION_INDEPENDENT_CODE ON)
Tobias Lasser's avatar
Tobias Lasser committed
39 40 41 42 43 44 45


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

Nikola Dinev's avatar
Nikola Dinev committed
46 47 48 49 50 51
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
52 53 54 55 56 57

# register the module
registerComponent(${ELSA_MODULE_NAME})

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