Add support for pre-built googlebenchmark

This commit is contained in:
Russell Sears
2023-02-08 01:07:37 +00:00
committed by Aaron Molitor
parent 7304e5cad0
commit f58d58ca77
2 changed files with 46 additions and 29 deletions

View File

@@ -2,36 +2,49 @@ project (flowbench)
fdb_find_sources(FLOWBENCH_SRCS)
# include the configurations from benchmark.cmake
configure_file(benchmark.cmake googlebenchmark-download/CMakeLists.txt)
# executing the configuration step
execute_process(
COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" .
RESULT_VARIABLE results
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/googlebenchmark-download
)
# checking if the configuration step passed
if(results)
message(FATAL_ERROR "Configuration step for Benchmark has Failed. ${results}")
# There is no good way to incorporate the recommended googlebenchmark download + build
# process with one that checks to see if googlebenchmark has already been downloaded
# and built.
if(EXISTS /opt/googlebenchmark-f91b6b)
add_flow_target(EXECUTABLE NAME flowbench SRCS ${FLOWBENCH_SRCS})
target_include_directories(flowbench PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/include" "${CMAKE_CURRENT_BINARY_DIR}/include" /opt/googlebenchmark-f91b6b/include)
target_link_directories(flowbench PRIVATE /opt/googlebenchmark-f91b6b/src)
else()
## This seems to be copy-pasted from the the google benchmark documentation.
## It breaks if you attempt to re-use a build of googlebenchmark across FDB
## builds.
# include the configurations from benchmark.cmake
configure_file(benchmark.cmake googlebenchmark-download/CMakeLists.txt)
# executing the configuration step
execute_process(
COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" .
RESULT_VARIABLE results
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/googlebenchmark-download
)
# checking if the configuration step passed
if(results)
message(FATAL_ERROR "Configuration step for Benchmark has Failed. ${results}")
endif()
# executing the build step
execute_process(
COMMAND ${CMAKE_COMMAND} --build . --config Release
RESULT_VARIABLE results
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/googlebenchmark-download
)
# checking if the build step passed
if(results)
message(FATAL_ERROR "Build step for Benchmark has Failed. ${results}")
endif()
set(BENCHMARK_ENABLE_TESTING OFF)
add_subdirectory(
${CMAKE_CURRENT_BINARY_DIR}/googlebenchmark-src
${CMAKE_CURRENT_BINARY_DIR}/googlebenchmark-build
EXCLUDE_FROM_ALL
)
add_flow_target(EXECUTABLE NAME flowbench SRCS ${FLOWBENCH_SRCS})
target_include_directories(flowbench PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/include" "${CMAKE_CURRENT_BINARY_DIR}/include" ${CMAKE_CURRENT_BINARY_DIR}/googlebenchmark-src/include)
endif()
# executing the build step
execute_process(
COMMAND ${CMAKE_COMMAND} --build . --config Release
RESULT_VARIABLE results
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/googlebenchmark-download
)
# checking if the build step passed
if(results)
message(FATAL_ERROR "Build step for Benchmark has Failed. ${results}")
endif()
set(BENCHMARK_ENABLE_TESTING OFF)
add_subdirectory(
${CMAKE_CURRENT_BINARY_DIR}/googlebenchmark-src
${CMAKE_CURRENT_BINARY_DIR}/googlebenchmark-build
EXCLUDE_FROM_ALL
)
add_flow_target(EXECUTABLE NAME flowbench SRCS ${FLOWBENCH_SRCS})
target_include_directories(flowbench PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/include" "${CMAKE_CURRENT_BINARY_DIR}/include" ${CMAKE_CURRENT_BINARY_DIR}/googlebenchmark-src/include)
if(FLOW_USE_ZSTD)
target_include_directories(flowbench PRIVATE ${ZSTD_LIB_INCLUDE_DIR})
endif()

View File

@@ -4,6 +4,8 @@ project(googlebenchmark-download NONE)
include(ExternalProject)
ExternalProject_Add(googlebenchmark
GIT_REPOSITORY https://github.com/google/benchmark.git
# If you change this, then be sure to also update the directory name (which contains this SHA) in flowbench/CMakeLists.txt,
# and the fdb-build-support Dockerfile (which downloads + compiles the prebuilt version)
GIT_TAG f91b6b42b1b9854772a90ae9501464a161707d1e # v1.6.0
GIT_SHALLOW ON
GIT_CONFIG advice.detachedHead=false
@@ -19,6 +21,8 @@ ExternalProject_Add(googlebenchmark
include(ExternalProject)
ExternalProject_Add(googletest DEPENDS googlebenchmark
GIT_REPOSITORY https://github.com/google/googletest.git
# If you change this, be sure to update the perl one-liner in the part of fdb-build-support Dockerfile that downloads
# googlebenchmark. That one-liner determines which SHA will be used in the pre-built version of googlebenchmark.
GIT_TAG 2fe3bd994b3189899d93f1d5a881e725e046fdc2 # release-1.8.1
GIT_SHALLOW ON
GIT_CONFIG advice.detachedHead=false