-
Notifications
You must be signed in to change notification settings - Fork 23
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
executable file
·70 lines (54 loc) · 1.94 KB
/
CMakeLists.txt
File metadata and controls
executable file
·70 lines (54 loc) · 1.94 KB
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
68
69
70
# Attempt to find pre-installed Google Benchmark
set(MEMILIO_BENCHMARK_VERSION "v1.9.2" CACHE STRING "GoogleTest version to use")
# Configure Google Benchmark build options BEFORE MakeAvailable
set(BENCHMARK_ENABLE_TESTING OFF CACHE BOOL "" FORCE) # Don't build benchmark's tests
set(BENCHMARK_ENABLE_INSTALL OFF CACHE BOOL "" FORCE) # Don't install benchmark
set(BENCHMARK_ENABLE_GTEST_TESTS OFF CACHE BOOL "" FORCE) # Don't require gtest
FetchContent_Declare(google_benchmark
GIT_REPOSITORY https://github.com/google/benchmark.git
GIT_TAG ${MEMILIO_BENCHMARK_VERSION}
GIT_SHALLOW TRUE
)
FetchContent_MakeAvailable(google_benchmark)
if(TARGET benchmark::benchmark)
set(MEMILIO_BENCHMARK_LIBRARY benchmark::benchmark)
else()
message(FATAL_ERROR "FetchContent for Google Benchmark did not provide target 'benchmark::benchmark'.")
endif()
# Helper function to add benchmark executables
function(add_memilio_benchmark NAME SOURCES)
set(MEMILIO_DEPS ${ARGN})
add_executable(${NAME} ${SOURCES})
target_link_libraries(${NAME} PRIVATE
memilio
${MEMILIO_DEPS}
${MEMILIO_BENCHMARK_LIBRARY}
)
endfunction()
# Define benchmark executables
add_memilio_benchmark(memilio_abm_benchmark
abm.cpp
abm
)
if(MEMILIO_HAS_JSONCPP)
add_memilio_benchmark(memilio_graph_simulation_benchmark
graph_simulation.cpp
ode_secirvvs
)
add_memilio_benchmark(memilio_flow_simulation_ode_seir_benchmark
flow_simulation_ode_seir.cpp
ode_seir
)
add_memilio_benchmark(memilio_flow_simulation_ode_secirvvs_benchmark
flow_simulation_ode_secirvvs.cpp
ode_secirvvs
)
add_memilio_benchmark(integrator_secir_benchmark
integrator_secir_sim.cpp
ode_secir
)
add_memilio_benchmark(memilio_integrator_step_benchmark
integrator_step.cpp
ode_secir
)
endif()