build: only build benchmark if necessary

This commit is contained in:
Marcus Holland-Moritz 2024-05-15 18:09:48 +02:00
parent c547bf1dfe
commit a44ba74993

View File

@ -502,15 +502,6 @@ add_library(folly_light
${CMAKE_CURRENT_SOURCE_DIR}/folly/folly/ext/test_ext.cpp ${CMAKE_CURRENT_SOURCE_DIR}/folly/folly/ext/test_ext.cpp
) )
set_property(TARGET folly_light PROPERTY CXX_STANDARD 20)
target_include_directories(
folly_light SYSTEM PUBLIC
${CMAKE_CURRENT_BINARY_DIR}/folly
${CMAKE_CURRENT_SOURCE_DIR}/folly
)
apply_folly_compile_options_to_target(folly_light)
target_link_libraries(folly_light folly_deps)
list(APPEND FOLLY_BENCHMARK_LITE_SRC list(APPEND FOLLY_BENCHMARK_LITE_SRC
${CMAKE_CURRENT_SOURCE_DIR}/folly/folly/Benchmark.cpp ${CMAKE_CURRENT_SOURCE_DIR}/folly/folly/Benchmark.cpp
${CMAKE_CURRENT_SOURCE_DIR}/folly/folly/Format.cpp ${CMAKE_CURRENT_SOURCE_DIR}/folly/folly/Format.cpp
@ -550,10 +541,14 @@ if(NOT WIN32)
) )
endif() endif()
add_library(follybenchmark_lite ${FOLLY_BENCHMARK_LITE_SRC}) set_property(TARGET folly_light PROPERTY CXX_STANDARD 20)
set_property(TARGET follybenchmark_lite PROPERTY CXX_STANDARD 20) target_include_directories(
apply_folly_compile_options_to_target(follybenchmark_lite) folly_light SYSTEM PUBLIC
target_link_libraries(follybenchmark_lite folly_light) ${CMAKE_CURRENT_BINARY_DIR}/folly
${CMAKE_CURRENT_SOURCE_DIR}/folly
)
apply_folly_compile_options_to_target(folly_light)
target_link_libraries(folly_light folly_deps)
set(ZSTD_LIBRARY_RELEASE set(ZSTD_LIBRARY_RELEASE
"ZSTD_LIBRARY_RELEASE-NOTFOUND" "ZSTD_LIBRARY_RELEASE-NOTFOUND"
@ -961,6 +956,11 @@ if(WITH_BENCHMARKS)
list(APPEND BINARY_TARGETS multiversioning_benchmark) list(APPEND BINARY_TARGETS multiversioning_benchmark)
endif() endif()
add_library(follybenchmark_lite ${FOLLY_BENCHMARK_LITE_SRC})
set_property(TARGET follybenchmark_lite PROPERTY CXX_STANDARD 20)
apply_folly_compile_options_to_target(follybenchmark_lite)
target_link_libraries(follybenchmark_lite folly_light)
# TODO: migrate to benchmark? # TODO: migrate to benchmark?
add_executable(segmenter_benchmark test/segmenter_benchmark.cpp) add_executable(segmenter_benchmark test/segmenter_benchmark.cpp)
target_link_libraries(segmenter_benchmark follybenchmark_lite test_helpers) target_link_libraries(segmenter_benchmark follybenchmark_lite test_helpers)