diff --git a/libc/benchmarks/CMakeLists.txt b/libc/benchmarks/CMakeLists.txt --- a/libc/benchmarks/CMakeLists.txt +++ b/libc/benchmarks/CMakeLists.txt @@ -1,38 +1,7 @@ find_package(Threads) -include(ExternalProject) - set(LLVM_LINK_COMPONENTS Support) -#============================================================================== -# Build Google Benchmark -#============================================================================== -set(GOOGLE_BENCHMARK_TARGET_FLAGS ${BENCHMARK_DIALECT_FLAG}) -if (LIBCXX_BENCHMARK_GCC_TOOLCHAIN) - set(GOOGLE_BENCHMARK_TARGET_FLAGS - --gcc-toolchain=${LIBCXX_BENCHMARK_GCC_TOOLCHAIN}) -endif() -string(REPLACE ";" " " GOOGLE_BENCHMARK_TARGET_FLAGS "${GOOGLE_BENCHMARK_TARGET_FLAGS}") - -ExternalProject_Add(google-benchmark - EXCLUDE_FROM_ALL ON - PREFIX google-benchmark - SOURCE_DIR ${LLVM_THIRD_PARTY_DIR}/benchmark - INSTALL_DIR ${CMAKE_CURRENT_BINARY_DIR}/google-benchmark - CMAKE_CACHE_ARGS - -DBUILD_SHARED_LIBS:BOOL=OFF - -DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=ON - -DCMAKE_C_COMPILER:STRING=${CMAKE_C_COMPILER} - -DCMAKE_CXX_COMPILER:STRING=${CMAKE_CXX_COMPILER} - -DCMAKE_CXX_FLAGS:STRING=${GOOGLE_BENCHMARK_TARGET_FLAGS} - -DCMAKE_CXX_STANDARD:STRING=14 - -DCMAKE_BUILD_TYPE:STRING=RELEASE - -DCMAKE_INSTALL_PREFIX:PATH= - -DBENCHMARK_ENABLE_TESTING:BOOL=OFF) - -set(GOOGLE_BENCHMARK_LIBC_INSTALL ${CMAKE_CURRENT_BINARY_DIR}/google-benchmark) -set(GOOGLE_BENCHMARK_LINK_FLAGS -L${GOOGLE_BENCHMARK_LIBC_INSTALL}/lib/) - #============================================================================== # Add Unit Testing Support #============================================================================== @@ -75,11 +44,6 @@ add_custom_target(libc-benchmark-util-tests) -function(fix_rtti target) - # TODO: Make this portable and inline with rtti mode from llvm/ - target_compile_options(${target} PUBLIC -fno-rtti) -endfunction() - # libc-benchmark add_library(libc-benchmark STATIC @@ -87,19 +51,13 @@ LibcBenchmark.cpp LibcBenchmark.h ) -add_dependencies(libc-benchmark google-benchmark) -target_include_directories(libc-benchmark - SYSTEM PUBLIC - "${GOOGLE_BENCHMARK_LIBC_INSTALL}/include" -) +add_dependencies(libc-benchmark benchmark) target_link_libraries(libc-benchmark PUBLIC - "${GOOGLE_BENCHMARK_LINK_FLAGS}" # FIXME: Move to `target_link_options` - -lbenchmark # FIXME: Move to `target_link_options` + benchmark LLVMSupport Threads::Threads ) -fix_rtti(libc-benchmark) add_libc_benchmark_unittest(libc-benchmark-test SRCS LibcBenchmarkTest.cpp @@ -124,7 +82,6 @@ PUBLIC libc-benchmark ) -fix_rtti(libc-memory-benchmark) add_libc_benchmark_unittest(libc-memory-benchmark-test SRCS LibcMemoryBenchmarkTest.cpp @@ -139,7 +96,6 @@ JSON.h ) target_link_libraries(json PUBLIC libc-memory-benchmark) -fix_rtti(json) add_libc_benchmark_unittest(json-test SRCS JSONTest.cpp