forked from artivis/manif
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
61 lines (51 loc) · 1.82 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
find_package(benchmark QUIET)
if(NOT benchmark_FOUND)
# If not found, download it
include(FetchContent)
FetchContent_Declare(
googlebenchmark
GIT_REPOSITORY https://github.com/google/benchmark.git
GIT_TAG v1.5.2
)
set(BENCHMARK_ENABLE_TESTING OFF)
FetchContent_MakeAvailable(googlebenchmark)
endif()
# small helper function
function(manif_add_benchmark target)
add_executable(${target} ${ARGN})
# add_dependencies(${target} gtest)
target_link_libraries(${target} ${PROJECT_NAME} benchmark::benchmark)
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
# GCC is not strict enough by default, so enable most of the warnings.
target_compile_options(${target} PRIVATE
-Werror=all
-Werror=extra
# When the library is built using GCC it is necessary to link
# with the pthread library due to how GCC implements std::thread.
# See https://github.com/google/benchmark#platform-specific-build-instructions
-pthread
)
endif()
endfunction()
manif_add_benchmark(benchmark_so2 benchmark_so2.cpp)
manif_add_benchmark(benchmark_se2 benchmark_se2.cpp)
manif_add_benchmark(benchmark_so3 benchmark_so3.cpp)
manif_add_benchmark(benchmark_se3 benchmark_se3.cpp)
manif_add_benchmark(benchmark_se_2_3 benchmark_se_2_3.cpp)
manif_add_benchmark(benchmark_rn benchmark_rn.cpp)
manif_add_benchmark(benchmark_manif benchmark_manif.cpp)
manif_add_benchmark(benchmark_quat benchmark_quat.cpp)
set(CXX_17_TEST_TARGETS
benchmark_so2
benchmark_se2
benchmark_so3
benchmark_se3
benchmark_se_2_3
benchmark_rn
benchmark_manif
benchmark_quat
)
# Set required C++17 flag
set_property(TARGET ${CXX_17_TEST_TARGETS} PROPERTY CXX_STANDARD 17)
set_property(TARGET ${CXX_17_TEST_TARGETS} PROPERTY CXX_STANDARD_REQUIRED ON)
set_property(TARGET ${CXX_17_TEST_TARGETS} PROPERTY CXX_EXTENSIONS OFF)