Commit 5249f02a authored by Adam Simpkins's avatar Adam Simpkins Committed by Facebook Github Bot

cmake: split Benchmark.cpp into a separate library

Summary:
Move Benchmark.cpp out of the main libfolly library and into its own
libfollybenchmark library.

This more closely follows the build artifacts produced by the autoconf build,
and will help avoid breaking downstream projects that depend on folly and
expect to find libfollybenchmark.  The code in Benchmark.cpp is also normally
only needed by test programs.

Reviewed By: yfeldblum

Differential Revision: D6793538

fbshipit-source-id: fd273c11fc9f199a159b9e5d14badaf805480db0
parent b36f00f6
......@@ -86,7 +86,12 @@ configure_file(
${CMAKE_CURRENT_BINARY_DIR}/folly/folly-config.h
)
# Main folly library files
# We currently build the main libfolly library by finding all sources
# and header files. We then exclude specific files below.
#
# In the future it would perhaps be nicer to explicitly list the files we want
# to include, and to move the source lists in to separate per-subdirectory
# CMakeLists.txt files.
auto_sources(files "*.cpp" "RECURSE" "${FOLLY_DIR}")
auto_sources(hfiles "*.h" "RECURSE" "${FOLLY_DIR}")
......@@ -103,14 +108,11 @@ REMOVE_MATCHES_FROM_LISTS(files hfiles
"/tools/"
"Benchmark.cpp$"
"Test.cpp$"
IGNORE_MATCHES
"/Benchmark.cpp$"
)
list(REMOVE_ITEM files
${FOLLY_DIR}/experimental/JSONSchemaTester.cpp
${FOLLY_DIR}/experimental/io/HugePageUtil.cpp
${FOLLY_DIR}/experimental/symbolizer/ElfUtil.cpp
${FOLLY_DIR}/futures/test/Benchmark.cpp
)
list(REMOVE_ITEM hfiles
${FOLLY_DIR}/detail/SlowFingerprint.h
......@@ -336,6 +338,7 @@ if (BUILD_TESTS)
target_link_libraries(folly_test_support
PUBLIC
Boost::thread
follybenchmark
folly
${LIBGMOCK_LIBRARY}
)
......@@ -675,3 +678,5 @@ if (BUILD_TESTS)
TEST varint_test SOURCES VarintTest.cpp
)
endif()
add_subdirectory(folly)
add_library(
follybenchmark
Benchmark.cpp
)
target_link_libraries(follybenchmark PUBLIC folly)
apply_folly_compile_options_to_target(follybenchmark)
install(TARGETS follybenchmark
EXPORT folly
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment