Skip to content

Commit

Permalink
feat: Utilize globally installed benchmark if available (AztecProtoco…
Browse files Browse the repository at this point in the history
  • Loading branch information
phated authored Feb 17, 2023
1 parent 167c6a3 commit 8b700b9
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 9 deletions.
14 changes: 9 additions & 5 deletions circuits/cpp/barretenberg/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 circuits/cpp/barretenberg/cpp/cmake/module.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ function(barretenberg_module MODULE_NAME)
target_link_libraries(
${MODULE_NAME}_bench_objects
PRIVATE
benchmark
benchmark::benchmark
${TBB_IMPORTED_TARGETS}
)

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

Expand Down
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
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

0 comments on commit 8b700b9

Please sign in to comment.