🛠️🐜 Antkeeper superbuild with dependencies included https://antkeeper.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

129 lines
4.9 KiB

  1. #
  2. # Tests configuration
  3. #
  4. include_directories($<TARGET_PROPERTY:EnTT,INTERFACE_INCLUDE_DIRECTORIES>)
  5. add_compile_options($<TARGET_PROPERTY:EnTT,INTERFACE_COMPILE_OPTIONS>)
  6. macro(SETUP_LIBRARY_TARGET LIB_TARGET)
  7. set_target_properties(${LIB_TARGET} PROPERTIES CXX_EXTENSIONS OFF)
  8. target_compile_definitions(${LIB_TARGET} PRIVATE $<TARGET_PROPERTY:EnTT,INTERFACE_COMPILE_DEFINITIONS>)
  9. target_compile_features(${LIB_TARGET} PRIVATE $<TARGET_PROPERTY:EnTT,INTERFACE_COMPILE_FEATURES>)
  10. target_compile_options(${LIB_TARGET} PRIVATE $<$<NOT:$<CXX_COMPILER_ID:MSVC>>:-pedantic -Wall>)
  11. target_compile_options(${LIB_TARGET} PRIVATE $<$<CXX_COMPILER_ID:MSVC>:/EHsc>)
  12. endmacro()
  13. add_library(odr OBJECT odr.cpp)
  14. SETUP_LIBRARY_TARGET(odr)
  15. macro(SETUP_AND_ADD_TEST TEST_NAME TEST_SOURCE)
  16. add_executable(${TEST_NAME} $<TARGET_OBJECTS:odr> ${TEST_SOURCE})
  17. set_target_properties(${TEST_NAME} PROPERTIES CXX_EXTENSIONS OFF)
  18. target_link_libraries(${TEST_NAME} PRIVATE EnTT GTest::Main Threads::Threads)
  19. target_compile_definitions(${TEST_NAME} PRIVATE $<TARGET_PROPERTY:EnTT,INTERFACE_COMPILE_DEFINITIONS>)
  20. target_compile_features(${TEST_NAME} PRIVATE $<TARGET_PROPERTY:EnTT,INTERFACE_COMPILE_FEATURES>)
  21. target_compile_options(${TEST_NAME} PRIVATE $<$<NOT:$<CXX_COMPILER_ID:MSVC>>:-pedantic -Wall>)
  22. target_compile_options(${TEST_NAME} PRIVATE $<$<CXX_COMPILER_ID:MSVC>:/EHsc>)
  23. add_test(NAME ${TEST_NAME} COMMAND ${TEST_NAME})
  24. endmacro()
  25. # Test benchmark
  26. if(BUILD_BENCHMARK)
  27. SETUP_AND_ADD_TEST(benchmark benchmark/benchmark.cpp)
  28. endif()
  29. # Test lib
  30. if(BUILD_LIB)
  31. add_library(a_module_shared SHARED lib/a_module.cpp)
  32. add_library(a_module_static STATIC lib/a_module.cpp)
  33. add_library(another_module_shared SHARED lib/another_module.cpp)
  34. add_library(another_module_static STATIC lib/another_module.cpp)
  35. SETUP_LIBRARY_TARGET(a_module_shared)
  36. SETUP_LIBRARY_TARGET(a_module_static)
  37. SETUP_LIBRARY_TARGET(another_module_shared)
  38. SETUP_LIBRARY_TARGET(another_module_static)
  39. SETUP_AND_ADD_TEST(lib_shared lib/lib.cpp)
  40. target_link_libraries(lib_shared PRIVATE a_module_shared another_module_shared)
  41. SETUP_AND_ADD_TEST(lib_static lib/lib.cpp)
  42. target_link_libraries(lib_static PRIVATE a_module_static another_module_static)
  43. endif()
  44. # Test mod
  45. if(BUILD_MOD)
  46. set(DUKTAPE_DEPS_DIR ${EnTT_SOURCE_DIR}/deps/duktape)
  47. configure_file(${EnTT_SOURCE_DIR}/cmake/in/duktape.in ${DUKTAPE_DEPS_DIR}/CMakeLists.txt)
  48. execute_process(COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" . WORKING_DIRECTORY ${DUKTAPE_DEPS_DIR})
  49. execute_process(COMMAND ${CMAKE_COMMAND} --build . WORKING_DIRECTORY ${DUKTAPE_DEPS_DIR})
  50. set(DUKTAPE_SRC_DIR ${DUKTAPE_DEPS_DIR}/src/src)
  51. set(MOD_TEST_SOURCE ${DUKTAPE_SRC_DIR}/duktape.c mod/mod.cpp)
  52. SETUP_AND_ADD_TEST(mod "${MOD_TEST_SOURCE}")
  53. target_include_directories(mod PRIVATE ${DUKTAPE_SRC_DIR})
  54. endif()
  55. # Test snapshot
  56. if(BUILD_SNAPSHOT)
  57. set(CEREAL_DEPS_DIR ${EnTT_SOURCE_DIR}/deps/cereal)
  58. configure_file(${EnTT_SOURCE_DIR}/cmake/in/cereal.in ${CEREAL_DEPS_DIR}/CMakeLists.txt)
  59. execute_process(COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" . WORKING_DIRECTORY ${CEREAL_DEPS_DIR})
  60. execute_process(COMMAND ${CMAKE_COMMAND} --build . WORKING_DIRECTORY ${CEREAL_DEPS_DIR})
  61. set(CEREAL_SRC_DIR ${CEREAL_DEPS_DIR}/src/include)
  62. SETUP_AND_ADD_TEST(cereal snapshot/snapshot.cpp)
  63. target_include_directories(cereal PRIVATE ${CEREAL_SRC_DIR})
  64. endif()
  65. # Test core
  66. SETUP_AND_ADD_TEST(algorithm entt/core/algorithm.cpp)
  67. SETUP_AND_ADD_TEST(family entt/core/family.cpp)
  68. SETUP_AND_ADD_TEST(hashed_string entt/core/hashed_string.cpp)
  69. SETUP_AND_ADD_TEST(ident entt/core/ident.cpp)
  70. SETUP_AND_ADD_TEST(monostate entt/core/monostate.cpp)
  71. SETUP_AND_ADD_TEST(type_traits entt/core/type_traits.cpp)
  72. SETUP_AND_ADD_TEST(utility entt/core/utility.cpp)
  73. # Test entity
  74. SETUP_AND_ADD_TEST(actor entt/entity/actor.cpp)
  75. SETUP_AND_ADD_TEST(entity entt/entity/entity.cpp)
  76. SETUP_AND_ADD_TEST(group entt/entity/group.cpp)
  77. SETUP_AND_ADD_TEST(helper entt/entity/helper.cpp)
  78. SETUP_AND_ADD_TEST(prototype entt/entity/prototype.cpp)
  79. SETUP_AND_ADD_TEST(registry entt/entity/registry.cpp)
  80. SETUP_AND_ADD_TEST(runtime_view entt/entity/runtime_view.cpp)
  81. SETUP_AND_ADD_TEST(snapshot entt/entity/snapshot.cpp)
  82. SETUP_AND_ADD_TEST(sparse_set entt/entity/sparse_set.cpp)
  83. SETUP_AND_ADD_TEST(storage entt/entity/storage.cpp)
  84. SETUP_AND_ADD_TEST(view entt/entity/view.cpp)
  85. # Test locator
  86. SETUP_AND_ADD_TEST(locator entt/locator/locator.cpp)
  87. # Test meta
  88. SETUP_AND_ADD_TEST(meta entt/meta/meta.cpp)
  89. # Test process
  90. SETUP_AND_ADD_TEST(process entt/process/process.cpp)
  91. SETUP_AND_ADD_TEST(scheduler entt/process/scheduler.cpp)
  92. # Test resource
  93. SETUP_AND_ADD_TEST(resource entt/resource/resource.cpp)
  94. # Test signal
  95. SETUP_AND_ADD_TEST(delegate entt/signal/delegate.cpp)
  96. SETUP_AND_ADD_TEST(dispatcher entt/signal/dispatcher.cpp)
  97. SETUP_AND_ADD_TEST(emitter entt/signal/emitter.cpp)
  98. SETUP_AND_ADD_TEST(sigh entt/signal/sigh.cpp)