From f94de1c069ce4676a970ab1d2402a30833e3f25d Mon Sep 17 00:00:00 2001 From: Michele Caini Date: Wed, 18 Jan 2023 10:17:54 +0100 Subject: [PATCH] test: rework lib stuff to share common files --- test/CMakeLists.txt | 52 ++++++++++--------- .../plugin}/main.cpp | 0 .../plugin}/plugin.cpp | 0 .../plugin}/types.h | 0 test/lib/dispatcher/{ => shared}/lib.cpp | 0 test/lib/dispatcher/{ => shared}/main.cpp | 0 test/lib/dispatcher/{ => shared}/types.h | 0 .../plugin}/main.cpp | 0 .../plugin}/plugin.cpp | 0 .../plugin}/types.h | 0 test/lib/emitter/{ => shared}/lib.cpp | 0 test/lib/emitter/{ => shared}/main.cpp | 0 test/lib/emitter/{ => shared}/types.h | 0 .../plugin}/main.cpp | 0 .../plugin}/plugin.cpp | 0 .../plugin}/types.h | 0 test/lib/locator/{ => shared}/lib.cpp | 0 test/lib/locator/{ => shared}/main.cpp | 0 test/lib/locator/{ => shared}/types.h | 0 .../lib/{meta_plugin => meta/plugin}/main.cpp | 0 .../{meta_plugin => meta/plugin}/plugin.cpp | 0 test/lib/{meta_plugin => meta/plugin}/types.h | 0 .../plugin_std}/main.cpp | 0 .../plugin_std}/plugin.cpp | 0 .../plugin_std}/types.h | 0 test/lib/meta/{ => shared}/lib.cpp | 0 test/lib/meta/{ => shared}/main.cpp | 0 test/lib/meta/{ => shared}/types.h | 0 .../plugin}/main.cpp | 0 .../plugin}/plugin.cpp | 0 .../plugin}/types.h | 0 test/lib/registry/{ => shared}/lib.cpp | 0 test/lib/registry/{ => shared}/main.cpp | 0 test/lib/registry/{ => shared}/types.h | 0 34 files changed, 28 insertions(+), 24 deletions(-) rename test/lib/{dispatcher_plugin => dispatcher/plugin}/main.cpp (100%) rename test/lib/{dispatcher_plugin => dispatcher/plugin}/plugin.cpp (100%) rename test/lib/{dispatcher_plugin => dispatcher/plugin}/types.h (100%) rename test/lib/dispatcher/{ => shared}/lib.cpp (100%) rename test/lib/dispatcher/{ => shared}/main.cpp (100%) rename test/lib/dispatcher/{ => shared}/types.h (100%) rename test/lib/{emitter_plugin => emitter/plugin}/main.cpp (100%) rename test/lib/{emitter_plugin => emitter/plugin}/plugin.cpp (100%) rename test/lib/{emitter_plugin => emitter/plugin}/types.h (100%) rename test/lib/emitter/{ => shared}/lib.cpp (100%) rename test/lib/emitter/{ => shared}/main.cpp (100%) rename test/lib/emitter/{ => shared}/types.h (100%) rename test/lib/{locator_plugin => locator/plugin}/main.cpp (100%) rename test/lib/{locator_plugin => locator/plugin}/plugin.cpp (100%) rename test/lib/{locator_plugin => locator/plugin}/types.h (100%) rename test/lib/locator/{ => shared}/lib.cpp (100%) rename test/lib/locator/{ => shared}/main.cpp (100%) rename test/lib/locator/{ => shared}/types.h (100%) rename test/lib/{meta_plugin => meta/plugin}/main.cpp (100%) rename test/lib/{meta_plugin => meta/plugin}/plugin.cpp (100%) rename test/lib/{meta_plugin => meta/plugin}/types.h (100%) rename test/lib/{meta_plugin_std => meta/plugin_std}/main.cpp (100%) rename test/lib/{meta_plugin_std => meta/plugin_std}/plugin.cpp (100%) rename test/lib/{meta_plugin_std => meta/plugin_std}/types.h (100%) rename test/lib/meta/{ => shared}/lib.cpp (100%) rename test/lib/meta/{ => shared}/main.cpp (100%) rename test/lib/meta/{ => shared}/types.h (100%) rename test/lib/{registry_plugin => registry/plugin}/main.cpp (100%) rename test/lib/{registry_plugin => registry/plugin}/plugin.cpp (100%) rename test/lib/{registry_plugin => registry/plugin}/types.h (100%) rename test/lib/registry/{ => shared}/lib.cpp (100%) rename test/lib/registry/{ => shared}/main.cpp (100%) rename test/lib/registry/{ => shared}/types.h (100%) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 82512c318..91f9167bc 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -107,21 +107,23 @@ function(SETUP_BASIC_TEST TEST_NAME TEST_SOURCES) add_test(NAME ${TEST_NAME} COMMAND ${TEST_NAME}) endfunction() -function(SETUP_LIB_TEST TEST_NAME) - add_library(_${TEST_NAME} SHARED $ lib/${TEST_NAME}/lib.cpp) - SETUP_TARGET(_${TEST_NAME} ENTT_API_EXPORT) - SETUP_BASIC_TEST(lib_${TEST_NAME} lib/${TEST_NAME}/main.cpp ENTT_API_IMPORT) - target_link_libraries(lib_${TEST_NAME} PRIVATE _${TEST_NAME}) +function(SETUP_LIB_SHARED_TEST TEST_NAME SUB_PATH) + set(TARGET_NAME ${TEST_NAME}_${SUB_PATH}) + add_library(_${TARGET_NAME} SHARED $ lib/${TEST_NAME}/${SUB_PATH}/lib.cpp) + SETUP_TARGET(_${TARGET_NAME} ENTT_API_EXPORT) + SETUP_BASIC_TEST(lib_${TARGET_NAME} lib/${TEST_NAME}/${SUB_PATH}/main.cpp ENTT_API_IMPORT) + target_link_libraries(lib_${TARGET_NAME} PRIVATE _${TARGET_NAME}) endfunction() -function(SETUP_PLUGIN_TEST TEST_NAME) - add_library(_${TEST_NAME} MODULE $ lib/${TEST_NAME}/plugin.cpp) - SETUP_TARGET(_${TEST_NAME} ${ARGVN}) - SETUP_BASIC_TEST(lib_${TEST_NAME} lib/${TEST_NAME}/main.cpp PLUGIN="$" ${ARGVN}) - target_include_directories(_${TEST_NAME} PRIVATE ${cr_INCLUDE_DIR}) - target_include_directories(lib_${TEST_NAME} PRIVATE ${cr_INCLUDE_DIR}) - target_link_libraries(lib_${TEST_NAME} PRIVATE ${CMAKE_DL_LIBS}) - add_dependencies(lib_${TEST_NAME} _${TEST_NAME}) +function(SETUP_LIB_PLUGIN_TEST TEST_NAME SUB_PATH) + set(TARGET_NAME ${TEST_NAME}_${SUB_PATH}) + add_library(_${TARGET_NAME} MODULE $ lib/${TEST_NAME}/${SUB_PATH}/plugin.cpp) + SETUP_TARGET(_${TARGET_NAME} ${ARGVN}) + SETUP_BASIC_TEST(lib_${TARGET_NAME} lib/${TEST_NAME}/${SUB_PATH}/main.cpp PLUGIN="$" ${ARGVN}) + target_include_directories(_${TARGET_NAME} PRIVATE ${cr_INCLUDE_DIR}) + target_include_directories(lib_${TARGET_NAME} PRIVATE ${cr_INCLUDE_DIR}) + target_link_libraries(lib_${TARGET_NAME} PRIVATE ${CMAKE_DL_LIBS}) + add_dependencies(lib_${TARGET_NAME} _${TARGET_NAME}) endfunction() # Test benchmark @@ -155,19 +157,21 @@ if(ENTT_BUILD_LIB) set(cr_INCLUDE_DIR ${cr_SOURCE_DIR}) endif() - SETUP_LIB_TEST(dispatcher) - SETUP_LIB_TEST(emitter) - SETUP_LIB_TEST(locator) - SETUP_LIB_TEST(meta) - SETUP_LIB_TEST(registry) + SETUP_LIB_SHARED_TEST(dispatcher shared) + SETUP_LIB_PLUGIN_TEST(dispatcher plugin) - SETUP_PLUGIN_TEST(dispatcher_plugin) - SETUP_PLUGIN_TEST(emitter_plugin) - SETUP_PLUGIN_TEST(locator_plugin) - SETUP_PLUGIN_TEST(meta_plugin) - SETUP_PLUGIN_TEST(registry_plugin) + SETUP_LIB_SHARED_TEST(emitter shared) + SETUP_LIB_PLUGIN_TEST(emitter plugin) - SETUP_PLUGIN_TEST(meta_plugin_std ENTT_STANDARD_CPP) + SETUP_LIB_SHARED_TEST(locator shared) + SETUP_LIB_PLUGIN_TEST(locator plugin) + + SETUP_LIB_SHARED_TEST(meta shared) + SETUP_LIB_PLUGIN_TEST(meta plugin) + SETUP_LIB_PLUGIN_TEST(meta plugin_std ENTT_STANDARD_CPP) + + SETUP_LIB_SHARED_TEST(registry shared) + SETUP_LIB_PLUGIN_TEST(registry plugin) endif() # Test snapshot diff --git a/test/lib/dispatcher_plugin/main.cpp b/test/lib/dispatcher/plugin/main.cpp similarity index 100% rename from test/lib/dispatcher_plugin/main.cpp rename to test/lib/dispatcher/plugin/main.cpp diff --git a/test/lib/dispatcher_plugin/plugin.cpp b/test/lib/dispatcher/plugin/plugin.cpp similarity index 100% rename from test/lib/dispatcher_plugin/plugin.cpp rename to test/lib/dispatcher/plugin/plugin.cpp diff --git a/test/lib/dispatcher_plugin/types.h b/test/lib/dispatcher/plugin/types.h similarity index 100% rename from test/lib/dispatcher_plugin/types.h rename to test/lib/dispatcher/plugin/types.h diff --git a/test/lib/dispatcher/lib.cpp b/test/lib/dispatcher/shared/lib.cpp similarity index 100% rename from test/lib/dispatcher/lib.cpp rename to test/lib/dispatcher/shared/lib.cpp diff --git a/test/lib/dispatcher/main.cpp b/test/lib/dispatcher/shared/main.cpp similarity index 100% rename from test/lib/dispatcher/main.cpp rename to test/lib/dispatcher/shared/main.cpp diff --git a/test/lib/dispatcher/types.h b/test/lib/dispatcher/shared/types.h similarity index 100% rename from test/lib/dispatcher/types.h rename to test/lib/dispatcher/shared/types.h diff --git a/test/lib/emitter_plugin/main.cpp b/test/lib/emitter/plugin/main.cpp similarity index 100% rename from test/lib/emitter_plugin/main.cpp rename to test/lib/emitter/plugin/main.cpp diff --git a/test/lib/emitter_plugin/plugin.cpp b/test/lib/emitter/plugin/plugin.cpp similarity index 100% rename from test/lib/emitter_plugin/plugin.cpp rename to test/lib/emitter/plugin/plugin.cpp diff --git a/test/lib/emitter_plugin/types.h b/test/lib/emitter/plugin/types.h similarity index 100% rename from test/lib/emitter_plugin/types.h rename to test/lib/emitter/plugin/types.h diff --git a/test/lib/emitter/lib.cpp b/test/lib/emitter/shared/lib.cpp similarity index 100% rename from test/lib/emitter/lib.cpp rename to test/lib/emitter/shared/lib.cpp diff --git a/test/lib/emitter/main.cpp b/test/lib/emitter/shared/main.cpp similarity index 100% rename from test/lib/emitter/main.cpp rename to test/lib/emitter/shared/main.cpp diff --git a/test/lib/emitter/types.h b/test/lib/emitter/shared/types.h similarity index 100% rename from test/lib/emitter/types.h rename to test/lib/emitter/shared/types.h diff --git a/test/lib/locator_plugin/main.cpp b/test/lib/locator/plugin/main.cpp similarity index 100% rename from test/lib/locator_plugin/main.cpp rename to test/lib/locator/plugin/main.cpp diff --git a/test/lib/locator_plugin/plugin.cpp b/test/lib/locator/plugin/plugin.cpp similarity index 100% rename from test/lib/locator_plugin/plugin.cpp rename to test/lib/locator/plugin/plugin.cpp diff --git a/test/lib/locator_plugin/types.h b/test/lib/locator/plugin/types.h similarity index 100% rename from test/lib/locator_plugin/types.h rename to test/lib/locator/plugin/types.h diff --git a/test/lib/locator/lib.cpp b/test/lib/locator/shared/lib.cpp similarity index 100% rename from test/lib/locator/lib.cpp rename to test/lib/locator/shared/lib.cpp diff --git a/test/lib/locator/main.cpp b/test/lib/locator/shared/main.cpp similarity index 100% rename from test/lib/locator/main.cpp rename to test/lib/locator/shared/main.cpp diff --git a/test/lib/locator/types.h b/test/lib/locator/shared/types.h similarity index 100% rename from test/lib/locator/types.h rename to test/lib/locator/shared/types.h diff --git a/test/lib/meta_plugin/main.cpp b/test/lib/meta/plugin/main.cpp similarity index 100% rename from test/lib/meta_plugin/main.cpp rename to test/lib/meta/plugin/main.cpp diff --git a/test/lib/meta_plugin/plugin.cpp b/test/lib/meta/plugin/plugin.cpp similarity index 100% rename from test/lib/meta_plugin/plugin.cpp rename to test/lib/meta/plugin/plugin.cpp diff --git a/test/lib/meta_plugin/types.h b/test/lib/meta/plugin/types.h similarity index 100% rename from test/lib/meta_plugin/types.h rename to test/lib/meta/plugin/types.h diff --git a/test/lib/meta_plugin_std/main.cpp b/test/lib/meta/plugin_std/main.cpp similarity index 100% rename from test/lib/meta_plugin_std/main.cpp rename to test/lib/meta/plugin_std/main.cpp diff --git a/test/lib/meta_plugin_std/plugin.cpp b/test/lib/meta/plugin_std/plugin.cpp similarity index 100% rename from test/lib/meta_plugin_std/plugin.cpp rename to test/lib/meta/plugin_std/plugin.cpp diff --git a/test/lib/meta_plugin_std/types.h b/test/lib/meta/plugin_std/types.h similarity index 100% rename from test/lib/meta_plugin_std/types.h rename to test/lib/meta/plugin_std/types.h diff --git a/test/lib/meta/lib.cpp b/test/lib/meta/shared/lib.cpp similarity index 100% rename from test/lib/meta/lib.cpp rename to test/lib/meta/shared/lib.cpp diff --git a/test/lib/meta/main.cpp b/test/lib/meta/shared/main.cpp similarity index 100% rename from test/lib/meta/main.cpp rename to test/lib/meta/shared/main.cpp diff --git a/test/lib/meta/types.h b/test/lib/meta/shared/types.h similarity index 100% rename from test/lib/meta/types.h rename to test/lib/meta/shared/types.h diff --git a/test/lib/registry_plugin/main.cpp b/test/lib/registry/plugin/main.cpp similarity index 100% rename from test/lib/registry_plugin/main.cpp rename to test/lib/registry/plugin/main.cpp diff --git a/test/lib/registry_plugin/plugin.cpp b/test/lib/registry/plugin/plugin.cpp similarity index 100% rename from test/lib/registry_plugin/plugin.cpp rename to test/lib/registry/plugin/plugin.cpp diff --git a/test/lib/registry_plugin/types.h b/test/lib/registry/plugin/types.h similarity index 100% rename from test/lib/registry_plugin/types.h rename to test/lib/registry/plugin/types.h diff --git a/test/lib/registry/lib.cpp b/test/lib/registry/shared/lib.cpp similarity index 100% rename from test/lib/registry/lib.cpp rename to test/lib/registry/shared/lib.cpp diff --git a/test/lib/registry/main.cpp b/test/lib/registry/shared/main.cpp similarity index 100% rename from test/lib/registry/main.cpp rename to test/lib/registry/shared/main.cpp diff --git a/test/lib/registry/types.h b/test/lib/registry/shared/types.h similarity index 100% rename from test/lib/registry/types.h rename to test/lib/registry/shared/types.h