Skip to content

Commit

Permalink
Simply build
Browse files Browse the repository at this point in the history
  • Loading branch information
szmyd committed Aug 1, 2024
1 parent 522af9a commit 946677a
Show file tree
Hide file tree
Showing 14 changed files with 247 additions and 302 deletions.
7 changes: 2 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,8 @@ include (cmake/Flags.cmake)

set(CMAKE_CXX_STANDARD 20)

if (NOT BUILD_TESTING STREQUAL OFF)
set(ENABLE_TESTING ON)
enable_testing()
find_package(GTest QUIET REQUIRED)
endif()
enable_testing()
find_package(GTest QUIET REQUIRED)

if (DEFINED BUILD_COVERAGE)
if (${BUILD_COVERAGE})
Expand Down
46 changes: 21 additions & 25 deletions src/cache/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,30 +8,26 @@ target_link_libraries(sisl_cache PUBLIC
sisl_buffer
)

if (DEFINED ENABLE_TESTING)
if (${ENABLE_TESTING})
add_executable(test_range_hashmap)
target_sources(test_range_hashmap PRIVATE
tests/test_range_hashmap.cpp
)
target_include_directories(test_range_hashmap BEFORE PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
target_link_libraries(test_range_hashmap sisl_cache GTest::gtest)
#add_test(NAME RangeHashMap COMMAND test_range_hashmap --num_iters 10000)
add_executable(test_range_hashmap)
target_sources(test_range_hashmap PRIVATE
tests/test_range_hashmap.cpp
)
target_include_directories(test_range_hashmap BEFORE PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
target_link_libraries(test_range_hashmap sisl_cache GTest::gtest)
#add_test(NAME RangeHashMap COMMAND test_range_hashmap --num_iters 10000)

add_executable(test_range_cache)
target_sources(test_range_cache PRIVATE
tests/test_range_cache.cpp
)
target_include_directories(test_range_cache BEFORE PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
target_link_libraries(test_range_cache sisl_cache GTest::gtest)
#add_test(NAME RangeCache COMMAND test_range_cache --num_iters 1000)
add_executable(test_range_cache)
target_sources(test_range_cache PRIVATE
tests/test_range_cache.cpp
)
target_include_directories(test_range_cache BEFORE PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
target_link_libraries(test_range_cache sisl_cache GTest::gtest)
#add_test(NAME RangeCache COMMAND test_range_cache --num_iters 1000)

add_executable(test_simple_cache)
target_sources(test_simple_cache PRIVATE
tests/test_simple_cache.cpp
)
target_include_directories(test_simple_cache BEFORE PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
target_link_libraries(test_simple_cache sisl_cache GTest::gtest)
add_test(NAME SimpleCache COMMAND test_simple_cache --num_iters 1000)
endif()
endif()
add_executable(test_simple_cache)
target_sources(test_simple_cache PRIVATE
tests/test_simple_cache.cpp
)
target_include_directories(test_simple_cache BEFORE PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
target_link_libraries(test_simple_cache sisl_cache GTest::gtest)
add_test(NAME SimpleCache COMMAND test_simple_cache --num_iters 1000)
168 changes: 82 additions & 86 deletions src/fds/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,104 +9,100 @@ target_link_libraries(sisl_buffer PUBLIC
folly::folly
)

if (DEFINED ENABLE_TESTING)
if (${ENABLE_TESTING})
include_directories(BEFORE ${CMAKE_CURRENT_SOURCE_DIR})
include_directories(BEFORE ${CMAKE_CURRENT_SOURCE_DIR})

add_executable(test_stream_tracker)
target_sources(test_stream_tracker PRIVATE
tests/test_stream_tracker.cpp
)
target_link_libraries(test_stream_tracker sisl_buffer GTest::gtest)
add_test(NAME StreamTracker COMMAND test_stream_tracker)
add_executable(test_stream_tracker)
target_sources(test_stream_tracker PRIVATE
tests/test_stream_tracker.cpp
)
target_link_libraries(test_stream_tracker sisl_buffer GTest::gtest)
add_test(NAME StreamTracker COMMAND test_stream_tracker)

add_executable(test_atomic_status_counter)
target_sources(test_atomic_status_counter PRIVATE
tests/test_atomic_status_counter.cpp
)
target_link_libraries(test_atomic_status_counter sisl_logging GTest::gtest atomic)
add_test(NAME AtomicStatusCounter COMMAND test_atomic_status_counter)
add_executable(test_atomic_status_counter)
target_sources(test_atomic_status_counter PRIVATE
tests/test_atomic_status_counter.cpp
)
target_link_libraries(test_atomic_status_counter sisl_logging GTest::gtest atomic)
add_test(NAME AtomicStatusCounter COMMAND test_atomic_status_counter)

add_executable(test_bitset)
target_sources(test_bitset PRIVATE
tests/test_bitset.cpp
)
target_link_libraries(test_bitset sisl_buffer GTest::gtest)
add_test(NAME Bitset COMMAND test_bitset)
add_executable(test_bitset)
target_sources(test_bitset PRIVATE
tests/test_bitset.cpp
)
target_link_libraries(test_bitset sisl_buffer GTest::gtest)
add_test(NAME Bitset COMMAND test_bitset)

add_executable(test_bitword)
target_sources(test_bitword PRIVATE
tests/test_bitword.cpp
)
target_link_libraries(test_bitword sisl_logging GTest::gtest)
add_test(NAME Bitword COMMAND test_bitset)
add_executable(test_bitword)
target_sources(test_bitword PRIVATE
tests/test_bitword.cpp
)
target_link_libraries(test_bitword sisl_logging GTest::gtest)
add_test(NAME Bitword COMMAND test_bitset)

add_executable(test_compact_bitset)
target_sources(test_compact_bitset PRIVATE
tests/test_compact_bitset.cpp
)
target_link_libraries(test_compact_bitset sisl_buffer GTest::gtest)
add_test(NAME CompactBitset COMMAND test_compact_bitset)
add_executable(test_compact_bitset)
target_sources(test_compact_bitset PRIVATE
tests/test_compact_bitset.cpp
)
target_link_libraries(test_compact_bitset sisl_buffer GTest::gtest)
add_test(NAME CompactBitset COMMAND test_compact_bitset)

add_executable(test_concurrent_insert_vector)
target_sources(test_concurrent_insert_vector PRIVATE
tests/test_concurrent_insert_vector.cpp
)
target_link_libraries(test_concurrent_insert_vector sisl_buffer GTest::gtest)
add_test(NAME ConcurrentInsertVector COMMAND test_concurrent_insert_vector)
add_executable(test_concurrent_insert_vector)
target_sources(test_concurrent_insert_vector PRIVATE
tests/test_concurrent_insert_vector.cpp
)
target_link_libraries(test_concurrent_insert_vector sisl_buffer GTest::gtest)
add_test(NAME ConcurrentInsertVector COMMAND test_concurrent_insert_vector)

add_executable(concurrent_insert_vector_bench)
target_sources(concurrent_insert_vector_bench PRIVATE
tests/concurrent_insert_vector_bench.cpp
)
target_link_libraries(concurrent_insert_vector_bench sisl_buffer benchmark::benchmark)
add_test(NAME ConcurrentVectorBench COMMAND concurrent_insert_vector_bench)
add_executable(concurrent_insert_vector_bench)
target_sources(concurrent_insert_vector_bench PRIVATE
tests/concurrent_insert_vector_bench.cpp
)
target_link_libraries(concurrent_insert_vector_bench sisl_buffer benchmark::benchmark)
add_test(NAME ConcurrentVectorBench COMMAND concurrent_insert_vector_bench)

add_executable(obj_allocator_benchmark)
target_sources(obj_allocator_benchmark PRIVATE
tests/obj_allocator_benchmark.cpp
)
target_link_libraries(obj_allocator_benchmark sisl_buffer benchmark::benchmark)
add_test(NAME ObjAllocatorBenchmark COMMAND obj_allocator_benchmark)
add_executable(obj_allocator_benchmark)
target_sources(obj_allocator_benchmark PRIVATE
tests/obj_allocator_benchmark.cpp
)
target_link_libraries(obj_allocator_benchmark sisl_buffer benchmark::benchmark)
add_test(NAME ObjAllocatorBenchmark COMMAND obj_allocator_benchmark)

add_executable(test_obj_allocator)
target_sources(test_obj_allocator PRIVATE
tests/test_obj_allocator.cpp
)
target_link_libraries(test_obj_allocator sisl_buffer)
add_test(NAME ObjAlloc COMMAND test_obj_allocator)
add_executable(test_obj_allocator)
target_sources(test_obj_allocator PRIVATE
tests/test_obj_allocator.cpp
)
target_link_libraries(test_obj_allocator sisl_buffer)
add_test(NAME ObjAlloc COMMAND test_obj_allocator)

add_executable(test_cb_mutex)
target_sources(test_cb_mutex PRIVATE
tests/test_cb_mutex.cpp
)
target_link_libraries(test_cb_mutex sisl_logging folly::folly GTest::gtest)
#add_test(NAME TestCBMutex COMMAND test_cb_mutex)
add_executable(test_cb_mutex)
target_sources(test_cb_mutex PRIVATE
tests/test_cb_mutex.cpp
)
target_link_libraries(test_cb_mutex sisl_logging folly::folly GTest::gtest)
#add_test(NAME TestCBMutex COMMAND test_cb_mutex)

add_executable(test_sg_list)
target_sources(test_sg_list PRIVATE
tests/test_sg_list.cpp
)
target_link_libraries(test_sg_list sisl_buffer folly::folly GTest::gtest)
add_test(NAME SgList COMMAND test_sg_list)
add_executable(test_sg_list)
target_sources(test_sg_list PRIVATE
tests/test_sg_list.cpp
)
target_link_libraries(test_sg_list sisl_buffer folly::folly GTest::gtest)
add_test(NAME SgList COMMAND test_sg_list)


if (DEFINED MALLOC_IMPL)
if (${MALLOC_IMPL} STREQUAL "jemalloc")
add_executable(test_jemalloc)
target_sources(test_jemalloc PRIVATE
tests/test_jemalloc_helper.cpp
)
target_link_libraries(test_jemalloc sisl_buffer GTest::gtest jemalloc::jemalloc)
add_test(NAME TestJemalloc COMMAND test_jemalloc)
elseif (${MALLOC_IMPL} STREQUAL "tcmalloc")
add_executable(test_tcmalloc)
target_sources(test_tcmalloc PRIVATE
tests/test_tcmalloc_helper.cpp
)
target_link_libraries(test_tcmalloc sisl_buffer GTest::gtest gperftools::gperftools)
add_test(NAME TestTcmalloc COMMAND test_tcmalloc)
endif()
endif()
if (DEFINED MALLOC_IMPL)
if (${MALLOC_IMPL} STREQUAL "jemalloc")
add_executable(test_jemalloc)
target_sources(test_jemalloc PRIVATE
tests/test_jemalloc_helper.cpp
)
target_link_libraries(test_jemalloc sisl_buffer GTest::gtest jemalloc::jemalloc)
add_test(NAME TestJemalloc COMMAND test_jemalloc)
elseif (${MALLOC_IMPL} STREQUAL "tcmalloc")
add_executable(test_tcmalloc)
target_sources(test_tcmalloc PRIVATE
tests/test_tcmalloc_helper.cpp
)
target_link_libraries(test_tcmalloc sisl_buffer GTest::gtest gperftools::gperftools)
add_test(NAME TestTcmalloc COMMAND test_tcmalloc)
endif()
endif()
16 changes: 6 additions & 10 deletions src/file_watcher/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,9 @@ target_sources(sisl_file_watcher PRIVATE
target_link_libraries(sisl_file_watcher PUBLIC
sisl_logging)

if (DEFINED ENABLE_TESTING)
if (${ENABLE_TESTING})
add_executable(test_file_watcher)
target_sources(test_file_watcher PRIVATE
file_watcher_test.cpp
)
target_link_libraries(test_file_watcher sisl_file_watcher GTest::gtest GTest::gmock)
add_test(NAME FileWatcher COMMAND test_file_watcher)
endif()
endif()
add_executable(test_file_watcher)
target_sources(test_file_watcher PRIVATE
file_watcher_test.cpp
)
target_link_libraries(test_file_watcher sisl_file_watcher GTest::gtest GTest::gmock)
add_test(NAME FileWatcher COMMAND test_file_watcher)
38 changes: 17 additions & 21 deletions src/flip/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,26 +19,22 @@ target_link_libraries(flip PUBLIC
nlohmann_json::nlohmann_json
)

if (DEFINED ENABLE_TESTING)
if (${ENABLE_TESTING})
add_executable(test_flip)
target_sources(test_flip PRIVATE
lib/test_flip.cpp
)
target_link_libraries(test_flip flip cxxopts::cxxopts)
add_test(NAME Flip COMMAND test_flip)
add_executable(test_flip)
target_sources(test_flip PRIVATE
lib/test_flip.cpp
)
target_link_libraries(test_flip flip cxxopts::cxxopts)
add_test(NAME Flip COMMAND test_flip)

add_executable(test_flip_server)
target_sources(test_flip_server PRIVATE
lib/test_flip_server.cpp
)
target_link_libraries(test_flip_server flip cxxopts::cxxopts)
add_executable(test_flip_server)
target_sources(test_flip_server PRIVATE
lib/test_flip_server.cpp
)
target_link_libraries(test_flip_server flip cxxopts::cxxopts)

add_executable(test_flip_local_client)
target_sources(test_flip_local_client PRIVATE
client/local/test_flip_local_client.cpp
)
target_link_libraries(test_flip_local_client flip cxxopts::cxxopts)
add_test(NAME FlipLocalClient COMMAND test_flip_local_client)
endif()
endif()
add_executable(test_flip_local_client)
target_sources(test_flip_local_client PRIVATE
client/local/test_flip_local_client.cpp
)
target_link_libraries(test_flip_local_client flip cxxopts::cxxopts)
add_test(NAME FlipLocalClient COMMAND test_flip_local_client)
6 changes: 1 addition & 5 deletions src/grpc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,4 @@ target_link_libraries(sisl_grpc PUBLIC
gRPC::grpc++
)

if(DEFINED ENABLE_TESTING)
if(${ENABLE_TESTING})
add_subdirectory(tests)
endif()
endif()
add_subdirectory(tests)
14 changes: 5 additions & 9 deletions src/logging/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,8 @@ target_sources(sisl_logging PRIVATE
)
target_link_libraries(sisl_logging PUBLIC ${LOGGING_DEPS} -rdynamic)

if (DEFINED ENABLE_TESTING)
if (${ENABLE_TESTING})
add_executable(logging_example)
target_sources(logging_example PRIVATE
test/example.cpp
)
target_link_libraries(logging_example sisl_logging)
endif()
endif()
add_executable(logging_example)
target_sources(logging_example PRIVATE
test/example.cpp
)
target_link_libraries(logging_example sisl_logging)
42 changes: 19 additions & 23 deletions src/metrics/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,29 +15,25 @@ target_link_libraries(sisl_metrics PUBLIC
userspace-rcu::userspace-rcu
)

if (DEFINED ENABLE_TESTING)
if (${ENABLE_TESTING})
include_directories(BEFORE ${CMAKE_CURRENT_SOURCE_DIR})
include_directories(BEFORE ${CMAKE_CURRENT_SOURCE_DIR})

add_executable(metrics_farm_test)
target_sources(metrics_farm_test PRIVATE
tests/farm_test.cpp
)
target_link_libraries(metrics_farm_test sisl_metrics GTest::gtest)
add_test(NAME MetricsFarm COMMAND metrics_farm_test)
add_executable(metrics_farm_test)
target_sources(metrics_farm_test PRIVATE
tests/farm_test.cpp
)
target_link_libraries(metrics_farm_test sisl_metrics GTest::gtest)
add_test(NAME MetricsFarm COMMAND metrics_farm_test)

add_executable(metrics_wrapper_test)
target_sources(metrics_wrapper_test PRIVATE
tests/wrapper_test.cpp
)
target_link_libraries(metrics_wrapper_test sisl_metrics GTest::gtest)
add_test(NAME MetricsWrapper COMMAND metrics_wrapper_test)
add_executable(metrics_wrapper_test)
target_sources(metrics_wrapper_test PRIVATE
tests/wrapper_test.cpp
)
target_link_libraries(metrics_wrapper_test sisl_metrics GTest::gtest)
add_test(NAME MetricsWrapper COMMAND metrics_wrapper_test)

add_executable(metrics_benchmark)
target_sources(metrics_benchmark PRIVATE
tests/metrics_benchmark.cpp
)
target_link_libraries(metrics_benchmark sisl_metrics benchmark::benchmark)
add_test(NAME MetricsBenchmark COMMAND metrics_benchmark)
endif()
endif()
add_executable(metrics_benchmark)
target_sources(metrics_benchmark PRIVATE
tests/metrics_benchmark.cpp
)
target_link_libraries(metrics_benchmark sisl_metrics benchmark::benchmark)
add_test(NAME MetricsBenchmark COMMAND metrics_benchmark)
Loading

0 comments on commit 946677a

Please sign in to comment.