Build benchmark library as external project
This commit is contained in:
parent
888bae40d0
commit
525e51a756
|
@ -163,8 +163,6 @@ else()
|
|||
endif()
|
||||
add_subdirectory(fdbbackup)
|
||||
add_subdirectory(contrib)
|
||||
# TODO: Fix linking issues and build the performance directory
|
||||
# add_subdirectory(performance)
|
||||
add_subdirectory(tests)
|
||||
if(WITH_PYTHON)
|
||||
add_subdirectory(bindings)
|
||||
|
@ -179,6 +177,11 @@ else()
|
|||
include(CPack)
|
||||
endif()
|
||||
|
||||
set(BUILD_BENCHMARK OFF CACHE BOOL "Build microbenchmark program (builds google microbenchmark dependency)")
|
||||
if(BUILD_BENCHMARK)
|
||||
add_subdirectory(fdbbench)
|
||||
endif()
|
||||
|
||||
if(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
|
||||
add_link_options(-lexecinfo)
|
||||
endif()
|
||||
|
|
|
@ -0,0 +1,37 @@
|
|||
set(FDBBENCH_SRCS
|
||||
bench.cpp
|
||||
BenchPopulate.cpp)
|
||||
|
||||
project (fdbbench)
|
||||
# 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()
|
||||
add_subdirectory(
|
||||
${CMAKE_CURRENT_BINARY_DIR}/googlebenchmark-src
|
||||
${CMAKE_CURRENT_BINARY_DIR}/googlebenchmark-build
|
||||
EXCLUDE_FROM_ALL
|
||||
)
|
||||
include_directories(${CMAKE_CURRENT_BINARY_DIR}/googlebenchmark-src/include)
|
||||
add_executable(fdbbench ${FDBBENCH_SRCS})
|
||||
target_link_libraries(fdbbench benchmark)
|
||||
target_link_libraries(fdbbench pthread)
|
||||
target_link_libraries(fdbbench flow)
|
|
@ -0,0 +1,26 @@
|
|||
project(googlebenchmark-download NONE)
|
||||
|
||||
include(ExternalProject)
|
||||
ExternalProject_Add(googlebenchmark
|
||||
GIT_REPOSITORY https://github.com/google/benchmark.git
|
||||
GIT_TAG 8039b4030795b1c9b8cedb78e3a2a6fb89574b6e # v1.5.1
|
||||
SOURCE_DIR "${CMAKE_CURRENT_BINARY_DIR}/googlebenchmark-src"
|
||||
BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/googlebenchmark-build"
|
||||
CMAKE_ARGS "-DCMAKE_BUILD_TYPE=Release -DBENCHMARK_ENABLE_LTO=true"
|
||||
CONFIGURE_COMMAND ""
|
||||
BUILD_COMMAND ""
|
||||
INSTALL_COMMAND ""
|
||||
TEST_COMMAND ""
|
||||
)
|
||||
|
||||
include(ExternalProject)
|
||||
ExternalProject_Add(googletest DEPENDS googlebenchmark
|
||||
GIT_REPOSITORY https://github.com/google/googletest.git
|
||||
GIT_TAG 2fe3bd994b3189899d93f1d5a881e725e046fdc2 # release-1.8.1
|
||||
SOURCE_DIR "${CMAKE_CURRENT_BINARY_DIR}/googlebenchmark-src/googletest"
|
||||
BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/googlebenchmark-build/googletest"
|
||||
CONFIGURE_COMMAND ""
|
||||
BUILD_COMMAND ""
|
||||
INSTALL_COMMAND ""
|
||||
TEST_COMMAND ""
|
||||
)
|
|
@ -1,8 +0,0 @@
|
|||
set(PERF_SRCS
|
||||
bench.cpp
|
||||
BenchPopulate.cpp)
|
||||
|
||||
find_package(benchmark REQUIRED)
|
||||
|
||||
add_executable(bench ${PERF_SRCS})
|
||||
target_link_libraries(bench atomic flow benchmark::benchmark)
|
Loading…
Reference in New Issue