From fd0f1940d4b11f582fc237ff5ccf2c385eaa0e7d Mon Sep 17 00:00:00 2001 From: Michael Wallner Date: Tue, 24 Nov 2020 17:08:49 +0100 Subject: [PATCH] memaslap: mv src/bin/contrib => contrib/bin --- CMake/_Include.cmake | 11 ------- CMakeLists.txt | 1 + contrib/CMakeLists.txt | 1 + contrib/bin/CMakeLists.txt | 1 + contrib/bin/memaslap/CMakeLists.txt | 32 +++++++++++++++++++ .../bin}/memaslap/ms_atomic.h | 0 .../bin}/memaslap/ms_conn.c | 0 .../bin}/memaslap/ms_conn.h | 0 .../bin/memaslap/ms_main.c | 0 .../bin}/memaslap/ms_memslap.h | 0 .../bin}/memaslap/ms_setting.c | 0 .../bin}/memaslap/ms_setting.h | 0 .../bin}/memaslap/ms_sigsegv.c | 0 .../bin}/memaslap/ms_sigsegv.h | 0 .../bin}/memaslap/ms_stats.c | 0 .../bin}/memaslap/ms_stats.h | 0 .../bin}/memaslap/ms_task.c | 0 .../bin}/memaslap/ms_task.h | 0 .../bin}/memaslap/ms_thread.c | 0 .../bin}/memaslap/ms_thread.h | 0 src/bin/CMakeLists.txt | 4 --- src/bin/contrib/CMakeLists.txt | 24 -------------- test/CMakeLists.txt | 6 ++-- test/tests/bin/memaslap.cpp | 2 +- 24 files changed, 40 insertions(+), 42 deletions(-) create mode 100644 contrib/CMakeLists.txt create mode 100644 contrib/bin/CMakeLists.txt create mode 100644 contrib/bin/memaslap/CMakeLists.txt rename {src/bin/contrib => contrib/bin}/memaslap/ms_atomic.h (100%) rename {src/bin/contrib => contrib/bin}/memaslap/ms_conn.c (100%) rename {src/bin/contrib => contrib/bin}/memaslap/ms_conn.h (100%) rename src/bin/contrib/memaslap.c => contrib/bin/memaslap/ms_main.c (100%) rename {src/bin/contrib => contrib/bin}/memaslap/ms_memslap.h (100%) rename {src/bin/contrib => contrib/bin}/memaslap/ms_setting.c (100%) rename {src/bin/contrib => contrib/bin}/memaslap/ms_setting.h (100%) rename {src/bin/contrib => contrib/bin}/memaslap/ms_sigsegv.c (100%) rename {src/bin/contrib => contrib/bin}/memaslap/ms_sigsegv.h (100%) rename {src/bin/contrib => contrib/bin}/memaslap/ms_stats.c (100%) rename {src/bin/contrib => contrib/bin}/memaslap/ms_stats.h (100%) rename {src/bin/contrib => contrib/bin}/memaslap/ms_task.c (100%) rename {src/bin/contrib => contrib/bin}/memaslap/ms_task.h (100%) rename {src/bin/contrib => contrib/bin}/memaslap/ms_thread.c (100%) rename {src/bin/contrib => contrib/bin}/memaslap/ms_thread.h (100%) delete mode 100644 src/bin/contrib/CMakeLists.txt diff --git a/CMake/_Include.cmake b/CMake/_Include.cmake index b4f2dbd1..9dbd3dfa 100644 --- a/CMake/_Include.cmake +++ b/CMake/_Include.cmake @@ -25,7 +25,6 @@ include(CheckDependency) include(CheckHeader) include(CheckCompiles) include(CheckType) -include(CheckAtomics) include(TestBigEndian) include(CheckByteswap) @@ -34,16 +33,6 @@ include(CheckByteswap) ## debug check_debug() -## memaslap -if(ENABLE_MEMASLAP) - check_atomics() - check_dependency(LIBEVENT event event.h) - check_decl(getline stdio.h) - if(HAVE_LIBEVENT AND HAVE_C_STDATOMIC) - set(HAVE_MEMASLAP 1) - endif() -endif() - ## dtrace include(EnableDtrace) if(ENABLE_DTRACE) diff --git a/CMakeLists.txt b/CMakeLists.txt index 19755ffd..cab79f2c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -37,6 +37,7 @@ if(NOT BUILD_DOCSONLY) ) add_subdirectory(src) + add_subdirectory(contrib) add_subdirectory(include) add_subdirectory(support) add_subdirectory(test) diff --git a/contrib/CMakeLists.txt b/contrib/CMakeLists.txt new file mode 100644 index 00000000..ad1ab41a --- /dev/null +++ b/contrib/CMakeLists.txt @@ -0,0 +1 @@ +add_subdirectory(bin) diff --git a/contrib/bin/CMakeLists.txt b/contrib/bin/CMakeLists.txt new file mode 100644 index 00000000..0cc3ab2a --- /dev/null +++ b/contrib/bin/CMakeLists.txt @@ -0,0 +1 @@ +add_subdirectory(memaslap) diff --git a/contrib/bin/memaslap/CMakeLists.txt b/contrib/bin/memaslap/CMakeLists.txt new file mode 100644 index 00000000..648b7687 --- /dev/null +++ b/contrib/bin/memaslap/CMakeLists.txt @@ -0,0 +1,32 @@ +if(ENABLE_MEMASLAP) + include(CheckAtomics) + check_atomics() + check_dependency(LIBEVENT event event.h) + check_decl(getline stdio.h) + + if(HAVE_LIBEVENT AND HAVE_ATOMICS) + add_executable(memaslap + ms_main.c + ms_conn.c + ms_setting.c + ms_sigsegv.c + ms_stats.c + ms_task.c + ms_thread.c) + target_include_directories(memaslap PRIVATE + ${CMAKE_SOURCE_DIR}/include + ${CMAKE_BINARY_DIR}/include + ${CMAKE_SOURCE_DIR}/src + ${CMAKE_BINARY_DIR}/src + ${CMAKE_BINARY_DIR}) + target_link_libraries(memaslap PUBLIC libmemcached Threads::Threads ${LIBEVENT} m) + set_property(TARGET memaslap PROPERTY C_STANDARD 11) + if(CMAKE_INSTALL_RPATH) + set_target_properties(${CLIENT} PROPERTIES + INSTALL_RPATH ${CMAKE_INSTALL_RPATH}/../${CMAKE_INSTALL_LIBDIR}) + endif() + install(TARGETS memaslap + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) + endif() + +endif() diff --git a/src/bin/contrib/memaslap/ms_atomic.h b/contrib/bin/memaslap/ms_atomic.h similarity index 100% rename from src/bin/contrib/memaslap/ms_atomic.h rename to contrib/bin/memaslap/ms_atomic.h diff --git a/src/bin/contrib/memaslap/ms_conn.c b/contrib/bin/memaslap/ms_conn.c similarity index 100% rename from src/bin/contrib/memaslap/ms_conn.c rename to contrib/bin/memaslap/ms_conn.c diff --git a/src/bin/contrib/memaslap/ms_conn.h b/contrib/bin/memaslap/ms_conn.h similarity index 100% rename from src/bin/contrib/memaslap/ms_conn.h rename to contrib/bin/memaslap/ms_conn.h diff --git a/src/bin/contrib/memaslap.c b/contrib/bin/memaslap/ms_main.c similarity index 100% rename from src/bin/contrib/memaslap.c rename to contrib/bin/memaslap/ms_main.c diff --git a/src/bin/contrib/memaslap/ms_memslap.h b/contrib/bin/memaslap/ms_memslap.h similarity index 100% rename from src/bin/contrib/memaslap/ms_memslap.h rename to contrib/bin/memaslap/ms_memslap.h diff --git a/src/bin/contrib/memaslap/ms_setting.c b/contrib/bin/memaslap/ms_setting.c similarity index 100% rename from src/bin/contrib/memaslap/ms_setting.c rename to contrib/bin/memaslap/ms_setting.c diff --git a/src/bin/contrib/memaslap/ms_setting.h b/contrib/bin/memaslap/ms_setting.h similarity index 100% rename from src/bin/contrib/memaslap/ms_setting.h rename to contrib/bin/memaslap/ms_setting.h diff --git a/src/bin/contrib/memaslap/ms_sigsegv.c b/contrib/bin/memaslap/ms_sigsegv.c similarity index 100% rename from src/bin/contrib/memaslap/ms_sigsegv.c rename to contrib/bin/memaslap/ms_sigsegv.c diff --git a/src/bin/contrib/memaslap/ms_sigsegv.h b/contrib/bin/memaslap/ms_sigsegv.h similarity index 100% rename from src/bin/contrib/memaslap/ms_sigsegv.h rename to contrib/bin/memaslap/ms_sigsegv.h diff --git a/src/bin/contrib/memaslap/ms_stats.c b/contrib/bin/memaslap/ms_stats.c similarity index 100% rename from src/bin/contrib/memaslap/ms_stats.c rename to contrib/bin/memaslap/ms_stats.c diff --git a/src/bin/contrib/memaslap/ms_stats.h b/contrib/bin/memaslap/ms_stats.h similarity index 100% rename from src/bin/contrib/memaslap/ms_stats.h rename to contrib/bin/memaslap/ms_stats.h diff --git a/src/bin/contrib/memaslap/ms_task.c b/contrib/bin/memaslap/ms_task.c similarity index 100% rename from src/bin/contrib/memaslap/ms_task.c rename to contrib/bin/memaslap/ms_task.c diff --git a/src/bin/contrib/memaslap/ms_task.h b/contrib/bin/memaslap/ms_task.h similarity index 100% rename from src/bin/contrib/memaslap/ms_task.h rename to contrib/bin/memaslap/ms_task.h diff --git a/src/bin/contrib/memaslap/ms_thread.c b/contrib/bin/memaslap/ms_thread.c similarity index 100% rename from src/bin/contrib/memaslap/ms_thread.c rename to contrib/bin/memaslap/ms_thread.c diff --git a/src/bin/contrib/memaslap/ms_thread.h b/contrib/bin/memaslap/ms_thread.h similarity index 100% rename from src/bin/contrib/memaslap/ms_thread.h rename to contrib/bin/memaslap/ms_thread.h diff --git a/src/bin/CMakeLists.txt b/src/bin/CMakeLists.txt index 0dea2a88..187b9cef 100644 --- a/src/bin/CMakeLists.txt +++ b/src/bin/CMakeLists.txt @@ -22,7 +22,3 @@ target_sources(memcapable PRIVATE ../libmemcached/byteorder.cc) target_link_libraries(memcapable PRIVATE Threads::Threads) target_link_libraries(memping PRIVATE libmemcachedutil) target_link_libraries(memslap PRIVATE Threads::Threads) - -# contrib - -add_subdirectory(contrib) diff --git a/src/bin/contrib/CMakeLists.txt b/src/bin/contrib/CMakeLists.txt deleted file mode 100644 index adc7af8a..00000000 --- a/src/bin/contrib/CMakeLists.txt +++ /dev/null @@ -1,24 +0,0 @@ -if(HAVE_MEMASLAP) - add_executable(memaslap memaslap.c - memaslap/ms_conn.c - memaslap/ms_setting.c - memaslap/ms_sigsegv.c - memaslap/ms_stats.c - memaslap/ms_task.c - memaslap/ms_thread.c) - target_include_directories(memaslap PRIVATE - memaslap - ${CMAKE_SOURCE_DIR}/include - ${CMAKE_BINARY_DIR}/include - ${CMAKE_SOURCE_DIR}/src - ${CMAKE_BINARY_DIR}/src - ${CMAKE_BINARY_DIR}) - target_link_libraries(memaslap PUBLIC libmemcached Threads::Threads ${LIBEVENT} m) - set_property(TARGET memaslap PROPERTY C_STANDARD 11) - if(CMAKE_INSTALL_RPATH) - set_target_properties(${CLIENT} PROPERTIES - INSTALL_RPATH ${CMAKE_INSTALL_RPATH}/../${CMAKE_INSTALL_LIBDIR}) - endif() - install(TARGETS memaslap - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) -endif() diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 6f8230fb..19330d39 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -23,7 +23,6 @@ file(GLOB_RECURSE TESTING_SRC RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.cpp) set(TESTING_ROOT ${CMAKE_CURRENT_BINARY_DIR}) set(SOURCES_ROOT ${CMAKE_SOURCE_DIR}) set_source_files_properties(main.cpp PROPERTIES SKIP_UNITY_BUILD_INCLUSION ON) -configure_file(conf.h.in conf.h @ONLY) add_executable(runtests ${TESTING_SRC}) set_target_properties(runtests PROPERTIES CXX_STANDARD 17) target_include_directories(runtests PRIVATE @@ -41,10 +40,13 @@ if(NOT (thread IN_LIST ENABLE_SANITIZERS)) endif() add_dependencies(runtests ${CLIENTS}) -if(HAVE_MEMASLAP) +if(TARGET memaslap) + set(HAVE_MEMASLAP 1) add_dependencies(runtests memaslap) endif() +configure_file(conf.h.in conf.h @ONLY) + catch_discover_tests(runtests TEST_SPEC "lib*") catch_discover_tests(runtests diff --git a/test/tests/bin/memaslap.cpp b/test/tests/bin/memaslap.cpp index bcf79de6..0656a510 100644 --- a/test/tests/bin/memaslap.cpp +++ b/test/tests/bin/memaslap.cpp @@ -7,7 +7,7 @@ using Catch::Matchers::Contains; TEST_CASE("bin/memaslap") { - Shell sh{string{TESTING_ROOT "/../src/bin/contrib"}}; + Shell sh{string{TESTING_ROOT "/../contrib/bin/memaslap"}}; SECTION("no servers provided") { string output; -- 2.30.2