-
Notifications
You must be signed in to change notification settings - Fork 4
/
CMakeLists.txt
67 lines (56 loc) · 1.78 KB
/
CMakeLists.txt
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
cmake_minimum_required(VERSION 3.12)
file(STRINGS "VERSION" ver)
message("Version: ${ver}")
project(CppADCodeGenEigenPy LANGUAGES CXX VERSION ${ver})
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED True)
# Note that cmake 3.12+ is required to find Python
# find_package(Python3 COMPONENTS Interpreter Development REQUIRED)
find_package(Boost COMPONENTS filesystem REQUIRED)
find_package(Eigen3 3.3 REQUIRED)
# install project header files
install(DIRECTORY include/ DESTINATION include)
include(FetchContent)
# get googletest from github
FetchContent_Declare(
googletest
URL https://github.com/google/googletest/archive/609281088cfefc76f9d0ce82e1ff6c30cc3591e5.zip
)
# avoid installing googletest along with this project
option(INSTALL_GTEST "Enable installation of googletest." OFF)
FetchContent_MakeAvailable(googletest)
# build compiler for models used for the Python tests, then run it
add_executable(
python_test_model_compiler
tests/helpers/compile_models.cpp
)
target_include_directories(python_test_model_compiler PUBLIC include tests/include ${EIGEN3_INCLUDE_DIRS})
target_link_libraries(
python_test_model_compiler
dl
)
add_custom_target(
compile_python_test_models ALL
COMMAND python_test_model_compiler ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Compiling models for Python tests"
VERBATIM
)
# testing
enable_testing()
add_executable(
model_tests
tests/cpp_tests/MiscTest.cpp
tests/cpp_tests/BasicModelTest.cpp
tests/cpp_tests/ParameterizedModelTest.cpp
tests/cpp_tests/MathFunctionsModelTest.cpp
tests/cpp_tests/LowOrderModelTest.cpp
)
target_include_directories(model_tests PUBLIC include tests/include ${EIGEN3_INCLUDE_DIRS})
target_link_libraries(
model_tests
gtest_main
dl
${Boost_LIBRARIES}
)
include(GoogleTest)
gtest_discover_tests(model_tests)