basalt/test/CMakeLists.txt

40 lines
1.3 KiB
CMake
Raw Normal View History

cmake_minimum_required(VERSION 3.10...3.18)
2019-04-14 21:07:42 +02:00
ci and cmake improvements Changes along the line of https://gitlab.com/VladyslavUsenko/basalt-headers/merge_requests/1 and https://gitlab.com/VladyslavUsenko/basalt-headers/merge_requests/2, and more. Warning free builds on macos 10.11 - 10.14, Ubuntu Xenial & Bionic. (macOS 10.14 is not yet in CI, but tested locally.) Changes similar to basalt-headers: - cmake: raise minimum version to 3.10 - cmake: add workarounds to support macOS < 10.14 - cmake: set ccache only if not yet set and print info - cmake: add NDEBUG define (to disable asserts) for release build and EIGEN_INITIALIZE_MATRICES_BY_NAN for others. Add externally supplied CMAKE_CXX_FLAGS at the end to allow overriding the defaults. - tests: add enable_testing() in main CMakeLists.txt, such that we can call 'ctest' from build folder. - tests: simplify gtest / gtest_main linking - tests: use the newer gtest_discover_tests instead of add_test, which adds a separate cmake test for every gtest, even with multiple defined in a single executable. Its not only more reliable and less verbose in the CMakeLists.txt, but also allows to run 'ctest' without -V and still see status for every individual test. - ci: add build jobs for Debug/RelWithDebInfo on Bionic, as well as builds on Xenial and El Capitan. Use templates to simplify .gitlab-ci.yml - ci: clang-format job Additional changes: - cmake: unify formatting - cmake: various diagnostic warnings for situations that are unsupported (should help with gitlab issues). - cmake options to disable openmp, pass custom eigen root, compiler-launcher, additional CXX_FLAGS that can override default flags also for submodules (opengv etc), ... - cmake: moved configuration of submodule libs to `thirdparty/CMakeLists.txt`. This includes various fixes for limiatations of the thirdparty cmake definitions. In particular ensures that correct eigen is used, that opengv respects march and CXX_FLAGS passed from command line. - cmake: simplified linking of executables. Linking `basalt` is enough. - cmake: basalt sources now build with the minimal disabled warnings ("-Wall Wextra -Werror -Wno-unused-parameter -ftemplate-backtrace-limit=0", and additionally "-Wno-exceptions" for clang). Additional flags are now only set for the submodule targets in thirdparty. - tests: Running ctest in build folder now also runs the unit tests from basalt-headers. - ci: in addition to the additional compile jobs and there are now also 'test' jobs, that check that the executables in the deb's work (runs on all branches, not just master).
2019-04-24 14:21:24 +02:00
# Note: add_subdirectory(googletest ...) is called in basalt-headers
2019-04-14 21:07:42 +02:00
include_directories(../thirdparty/basalt-headers/test/include)
add_executable(test_spline_opt src/test_spline_opt.cpp)
target_link_libraries(test_spline_opt gtest gtest_main basalt_internal)
2019-04-14 21:07:42 +02:00
add_executable(test_vio src/test_vio.cpp)
target_link_libraries(test_vio gtest gtest_main basalt_internal)
2019-04-14 21:07:42 +02:00
add_executable(test_nfr src/test_nfr.cpp)
target_link_libraries(test_nfr gtest gtest_main basalt_internal)
2019-04-14 21:07:42 +02:00
add_executable(test_qr src/test_qr.cpp)
target_link_libraries(test_qr gtest gtest_main basalt_internal)
add_executable(test_linearization src/test_linearization.cpp)
target_link_libraries(test_linearization gtest gtest_main basalt_internal)
2019-04-14 21:07:42 +02:00
2022-01-22 09:00:13 +01:00
add_executable(test_patch src/test_patch.cpp)
target_link_libraries(test_patch gtest gtest_main basalt_internal)
2022-01-22 09:00:13 +01:00
2019-04-14 21:07:42 +02:00
enable_testing()
ci and cmake improvements Changes along the line of https://gitlab.com/VladyslavUsenko/basalt-headers/merge_requests/1 and https://gitlab.com/VladyslavUsenko/basalt-headers/merge_requests/2, and more. Warning free builds on macos 10.11 - 10.14, Ubuntu Xenial & Bionic. (macOS 10.14 is not yet in CI, but tested locally.) Changes similar to basalt-headers: - cmake: raise minimum version to 3.10 - cmake: add workarounds to support macOS < 10.14 - cmake: set ccache only if not yet set and print info - cmake: add NDEBUG define (to disable asserts) for release build and EIGEN_INITIALIZE_MATRICES_BY_NAN for others. Add externally supplied CMAKE_CXX_FLAGS at the end to allow overriding the defaults. - tests: add enable_testing() in main CMakeLists.txt, such that we can call 'ctest' from build folder. - tests: simplify gtest / gtest_main linking - tests: use the newer gtest_discover_tests instead of add_test, which adds a separate cmake test for every gtest, even with multiple defined in a single executable. Its not only more reliable and less verbose in the CMakeLists.txt, but also allows to run 'ctest' without -V and still see status for every individual test. - ci: add build jobs for Debug/RelWithDebInfo on Bionic, as well as builds on Xenial and El Capitan. Use templates to simplify .gitlab-ci.yml - ci: clang-format job Additional changes: - cmake: unify formatting - cmake: various diagnostic warnings for situations that are unsupported (should help with gitlab issues). - cmake options to disable openmp, pass custom eigen root, compiler-launcher, additional CXX_FLAGS that can override default flags also for submodules (opengv etc), ... - cmake: moved configuration of submodule libs to `thirdparty/CMakeLists.txt`. This includes various fixes for limiatations of the thirdparty cmake definitions. In particular ensures that correct eigen is used, that opengv respects march and CXX_FLAGS passed from command line. - cmake: simplified linking of executables. Linking `basalt` is enough. - cmake: basalt sources now build with the minimal disabled warnings ("-Wall Wextra -Werror -Wno-unused-parameter -ftemplate-backtrace-limit=0", and additionally "-Wno-exceptions" for clang). Additional flags are now only set for the submodule targets in thirdparty. - tests: Running ctest in build folder now also runs the unit tests from basalt-headers. - ci: in addition to the additional compile jobs and there are now also 'test' jobs, that check that the executables in the deb's work (runs on all branches, not just master).
2019-04-24 14:21:24 +02:00
include(GoogleTest)
2019-06-07 16:25:21 +02:00
#gtest_discover_tests(test_spline_opt DISCOVERY_TIMEOUT 60)
#gtest_discover_tests(test_vio DISCOVERY_TIMEOUT 60)
#gtest_discover_tests(test_nfr DISCOVERY_TIMEOUT 60)
gtest_add_tests(TARGET test_spline_opt AUTO)
gtest_add_tests(TARGET test_vio AUTO)
gtest_add_tests(TARGET test_nfr AUTO)
gtest_add_tests(TARGET test_qr AUTO)
gtest_add_tests(TARGET test_linearization AUTO)
2022-01-22 09:00:13 +01:00
gtest_add_tests(TARGET test_patch AUTO)