Allow folly usages only if TD_TEST_FOLLY is defined.

This commit is contained in:
levlam 2022-02-23 15:01:53 +03:00
parent 408aa95f76
commit 1f12b0d8e8
2 changed files with 22 additions and 18 deletions

View File

@ -73,19 +73,21 @@ if (NOT WIN32 AND NOT CYGWIN)
target_link_libraries(bench_queue PRIVATE tdutils)
endif()
find_package(ABSL QUIET)
find_package(folly QUIET)
find_package(gflags QUIET)
if (TD_TEST_FOLLY)
find_package(ABSL QUIET)
find_package(folly QUIET)
find_package(gflags QUIET)
if (ABSL_FOUND AND folly_FOUND)
add_executable(memory-hashset-memprof EXCLUDE_FROM_ALL hashset_memory.cpp)
target_compile_definitions(memory-hashset-memprof PRIVATE USE_MEMPROF=1)
target_link_libraries(memory-hashset-memprof PRIVATE tdutils memprof_stat Folly::folly absl::flat_hash_map absl::hash)
if (ABSL_FOUND AND folly_FOUND)
add_executable(memory-hashset-memprof EXCLUDE_FROM_ALL hashset_memory.cpp)
target_compile_definitions(memory-hashset-memprof PRIVATE USE_MEMPROF=1)
target_link_libraries(memory-hashset-memprof PRIVATE tdutils memprof_stat Folly::folly absl::flat_hash_map absl::hash)
add_executable(memory-hashset-os hashset_memory.cpp)
target_compile_definitions(memory-hashset-os PRIVATE USE_MEMPROF=0)
target_link_libraries(memory-hashset-os PRIVATE tdutils Folly::folly absl::flat_hash_map absl::hash)
add_executable(memory-hashset-os hashset_memory.cpp)
target_compile_definitions(memory-hashset-os PRIVATE USE_MEMPROF=0)
target_link_libraries(memory-hashset-os PRIVATE tdutils Folly::folly absl::flat_hash_map absl::hash)
add_executable(hashmap-build hashmap_build.cpp)
target_link_libraries(hashmap-build PRIVATE tdutils Folly::folly absl::flat_hash_map absl::hash)
add_executable(hashmap-build hashmap_build.cpp)
target_link_libraries(hashmap-build PRIVATE tdutils Folly::folly absl::flat_hash_map absl::hash)
endif()
endif()

View File

@ -390,11 +390,13 @@ install(TARGETS tdutils EXPORT TdTargets
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
)
find_package(benchmark QUIET)
find_package(folly QUIET)
find_package(gflags QUIET)
if (TD_TEST_FOLLY)
find_package(benchmark QUIET)
find_package(folly QUIET)
find_package(gflags QUIET)
if (ABSL_FOUND AND benchmark_FOUND AND folly_FOUND)
add_executable(benchmark-hashset test/hashset_benchmark.cpp)
target_link_libraries(benchmark-hashset PRIVATE tdutils benchmark::benchmark Folly::folly absl::flat_hash_map absl::hash)
if (ABSL_FOUND AND benchmark_FOUND AND folly_FOUND)
add_executable(benchmark-hashset test/hashset_benchmark.cpp)
target_link_libraries(benchmark-hashset PRIVATE tdutils benchmark::benchmark Folly::folly absl::flat_hash_map absl::hash)
endif()
endif()