Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Utilize globally installed benchmark if available #152

Merged
merged 1 commit into from
Feb 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions cpp/cmake/benchmark.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,16 @@ if(BENCHMARKS)
benchmark
GIT_REPOSITORY https://github.com/google/benchmark
GIT_TAG v1.7.1
FIND_PACKAGE_ARGS
)

FetchContent_GetProperties(benchmark)
if(NOT benchmark_POPULATED)
fetchcontent_populate(benchmark)
set(BENCHMARK_ENABLE_TESTING OFF CACHE BOOL "Benchmark tests off")
add_subdirectory(${benchmark_SOURCE_DIR} ${benchmark_BINARY_DIR} EXCLUDE_FROM_ALL)
set(BENCHMARK_ENABLE_TESTING OFF CACHE BOOL "Benchmark tests off")

FetchContent_MakeAvailable(benchmark)
if(NOT benchmark_FOUND)
# FetchContent_MakeAvailable calls FetchContent_Populate if `find_package` is unsuccessful
# so these variables will be available if we reach this case
set_property(DIRECTORY ${benchmark_SOURCE_DIR} PROPERTY EXCLUDE_FROM_ALL)
set_property(DIRECTORY ${benchmark_BINARY_DIR} PROPERTY EXCLUDE_FROM_ALL)
endif()
endif()
4 changes: 2 additions & 2 deletions cpp/cmake/module.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ function(barretenberg_module MODULE_NAME)
target_link_libraries(
${MODULE_NAME}_bench_objects
PRIVATE
benchmark
benchmark::benchmark
${TBB_IMPORTED_TARGETS}
)

Expand All @@ -162,7 +162,7 @@ function(barretenberg_module MODULE_NAME)
PRIVATE
${MODULE_LINK_NAME}
${ARGN}
benchmark
benchmark::benchmark
${TBB_IMPORTED_TARGETS}
)

Expand Down
2 changes: 1 addition & 1 deletion cpp/src/aztec/benchmark/honk_bench/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ target_link_libraries(
honk_bench
stdlib_primitives
env
benchmark
benchmark::benchmark
)

add_custom_target(
Expand Down
2 changes: 1 addition & 1 deletion cpp/src/aztec/benchmark/plonk_bench/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ target_link_libraries(
plonk_bench
stdlib_primitives
env
benchmark
benchmark::benchmark
)

add_custom_target(
Expand Down