|
1 | 1 | # Re-compiling all the infrastructure all the time is a waste of time, so we |
2 | 2 | # pre-compile that part as a library. |
3 | 3 |
|
4 | | -# This part compiles 'just' the benchmark infrastructure and doesn't provide a main function. |
5 | | -add_library(benchmark infrastructure/Benchmark.cpp infrastructure/BenchmarkMeasurementContainer.cpp |
6 | | - infrastructure/BenchmarkToJson.cpp infrastructure/BenchmarkToString.cpp) |
7 | | -qlever_target_link_libraries(benchmark Boost::program_options absl::str_format parser util configManager) |
| 4 | +OPTION(_NO_BENCHMARK "Disable benchmark targets, for example when building with Emscripten." OFF) |
8 | 5 |
|
9 | | -# This provides the library of the benchmark infrastructure together with its default main function. |
10 | | -add_library(benchmarkWithMain infrastructure/BenchmarkMain.cpp) |
11 | | -qlever_target_link_libraries(benchmarkWithMain benchmark) |
| 6 | +if (NOT _NO_BENCHMARK) |
| 7 | + # This part compiles 'just' the benchmark infrastructure and doesn't provide a main function. |
| 8 | + add_library(benchmark infrastructure/Benchmark.cpp infrastructure/BenchmarkMeasurementContainer.cpp |
| 9 | + infrastructure/BenchmarkToJson.cpp infrastructure/BenchmarkToString.cpp) |
| 10 | + qlever_target_link_libraries(benchmark Boost::program_options absl::str_format parser util configManager) |
12 | 11 |
|
13 | | -# Link binary ${basename} against the benchmark library, |
14 | | -# and all libraries that are specified as additional arguments. |
15 | | -function (linkBenchmark basename) |
16 | | - qlever_target_link_libraries(${basename} benchmarkWithMain ${ARGN}) |
17 | | -endfunction() |
| 12 | + # This provides the library of the benchmark infrastructure together with its default main function. |
| 13 | + add_library(benchmarkWithMain infrastructure/BenchmarkMain.cpp) |
| 14 | + qlever_target_link_libraries(benchmarkWithMain benchmark) |
18 | 15 |
|
19 | | -# Compile the benchmark and link it. |
20 | | -# Usage: addAndLinkBenchmark(baseName, [additionalLibraries...]) |
21 | | -# - baseName: The name of the benchmark file without the .cpp ending. |
22 | | -function(addAndLinkBenchmark baseName) |
23 | | - add_executable(${baseName} "${baseName}.cpp") |
24 | | - linkBenchmark(${baseName} ${ARGN}) |
25 | | -endfunction() |
| 16 | + # Link binary ${basename} against the benchmark library, |
| 17 | + # and all libraries that are specified as additional arguments. |
| 18 | + function (linkBenchmark basename) |
| 19 | + qlever_target_link_libraries(${basename} benchmarkWithMain ${ARGN}) |
| 20 | + endfunction() |
26 | 21 |
|
27 | | -# Add benchmarks after here. |
28 | | -addAndLinkBenchmark(BenchmarkExamples) |
| 22 | + # Compile the benchmark and link it. |
| 23 | + # Usage: addAndLinkBenchmark(baseName, [additionalLibraries...]) |
| 24 | + # - baseName: The name of the benchmark file without the .cpp ending. |
| 25 | + function(addAndLinkBenchmark baseName) |
| 26 | + add_executable(${baseName} "${baseName}.cpp") |
| 27 | + linkBenchmark(${baseName} ${ARGN}) |
| 28 | + endfunction() |
29 | 29 |
|
30 | | -addAndLinkBenchmark(JoinAlgorithmBenchmark testUtil memorySize) |
| 30 | + # Add benchmarks after here. |
| 31 | + addAndLinkBenchmark(BenchmarkExamples) |
31 | 32 |
|
32 | | -addAndLinkBenchmark(ParallelMergeBenchmark testUtil) |
| 33 | + addAndLinkBenchmark(JoinAlgorithmBenchmark testUtil memorySize) |
33 | 34 |
|
34 | | -addAndLinkBenchmark(GroupByHashMapBenchmark engine testUtil gtest gmock) |
| 35 | + addAndLinkBenchmark(ParallelMergeBenchmark testUtil) |
| 36 | + |
| 37 | + addAndLinkBenchmark(GroupByHashMapBenchmark engine testUtil gtest gmock) |
| 38 | + |
| 39 | +endif() |
0 commit comments