Skip to content

Commit 6988a40

Browse files
authored
Merge of #152
2 parents 68ddea7 + bed1188 commit 6988a40

7 files changed

Lines changed: 86 additions & 12 deletions

File tree

.gitmodules

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +0,0 @@
1-
[submodule "benchmark"]
2-
path = tests/benchmark
3-
url = https://github.com/google/benchmark

flake.lock

Lines changed: 75 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,13 @@
1212
{ pkgs-final, drv-prev, ... }:
1313
{
1414
src = lib.cleanSource ./.;
15-
nativeBuildInputs = drv-prev.nativeBuildInputs ++ [ pkgs-final.jrl-cmakemodules ];
15+
nativeBuildInputs = drv-prev.nativeBuildInputs ++ [
16+
pkgs-final.jrl-cmakemodules
17+
pkgs-final.gbenchmark
18+
];
19+
cmakeFlags = (drv-prev.cmakeFlags or [ ]) ++ [
20+
(lib.cmakeBool "BENCHMARKS" true)
21+
];
1622
};
1723
}
1824
);

tests/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ endmacro(addParserUnitTest)
4040

4141
macro(addBenchmark name)
4242
add_executable(${name} ${name}.cpp ${HEADERS})
43-
target_link_libraries(${name} PUBLIC RBDyn benchmark)
43+
target_link_libraries(${name} PRIVATE RBDyn benchmark::benchmark)
4444
# Adding a project configuration file (for MSVC only)
4545
generate_msvc_dot_user_file(${name})
4646
endmacro(addBenchmark)
@@ -64,12 +64,12 @@ addparserunittest("YAMLParserTest")
6464
addparserunittest("YAMLOutputTest")
6565

6666
if(${BENCHMARKS})
67+
find_package(benchmark REQUIRED)
6768
option(BENCHMARK_ENABLE_TESTING "Enable testing of the benchmark library."
6869
OFF)
6970
if(NOT WIN32)
7071
add_definitions(-Wno-error)
7172
endif()
72-
add_subdirectory(benchmark EXCLUDE_FROM_ALL)
7373
addbenchmark("JacobianBench")
7474
addbenchmark("DynamicsBench")
7575
endif()

tests/DynamicsBench.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,4 +74,4 @@ static void BM_Coriolis(benchmark::State & state)
7474
}
7575
BENCHMARK(BM_Coriolis);
7676

77-
BENCHMARK_MAIN()
77+
BENCHMARK_MAIN();

tests/JacobianBench.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,4 +233,4 @@ static void BM_MomentumJacobian_jacobianDot(benchmark::State & state)
233233
}
234234
BENCHMARK(BM_MomentumJacobian_jacobianDot);
235235

236-
BENCHMARK_MAIN()
236+
BENCHMARK_MAIN();

tests/benchmark

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)