From db367db7bb44c44842f3e5c768c35acb995af7cd Mon Sep 17 00:00:00 2001 From: Metehan Tuncbilek Date: Sun, 4 Aug 2024 14:49:28 +0200 Subject: [PATCH] Squash add tests --- CMakeLists.txt | 6 +++--- tests/CMakeLists.txt | 26 ++++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 3 deletions(-) create mode 100644 tests/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index 71e366b..92860e0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -26,7 +26,7 @@ SetOptimisationSettings() # ------------------------- CMAKE OPTIONS ------------------------- option(USE_ASSIMP "If assimp should be used" ON) option(TRACY_ENABLE "Enable Tracy Profiler" OFF) -option(ENABLE_TEST "Enable testing" OFF) +option(ENABLE_TEST "Enable testing" ON) option(ENABLE_EXAMPLE "Enable examples" ON) # ----------------------------------------------------------------- @@ -38,10 +38,10 @@ add_subdirectory(openVulkanoCpp) if(ENABLE_TEST) enable_testing() - add_subdirectory(unitTest) + add_subdirectory(tests) endif() # Finally generate the tests and examples if(ENABLE_EXAMPLE) add_subdirectory(examples) -endif() \ No newline at end of file +endif() diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt new file mode 100644 index 0000000..022d6f9 --- /dev/null +++ b/tests/CMakeLists.txt @@ -0,0 +1,26 @@ +cmake_minimum_required(VERSION 3.28 FATAL_ERROR) + +include(SetupVulkan) +include(Utils) + +file(GLOB_RECURSE SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/*.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/*.h" "${CMAKE_CURRENT_SOURCE_DIR}/*.hpp") +source_group(TREE "${CMAKE_CURRENT_SOURCE_DIR}" FILES ${SOURCES}) +add_executable(OpenVulkano_Tests ${SOURCES}) + +target_include_directories(OpenVulkano_Tests PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}) + +target_include_directories(OpenVulkano_Tests PRIVATE openVulkanoCpp) +target_link_libraries(OpenVulkano_Tests PRIVATE "$") + +# add catch2 +target_link_libraries(OpenVulkano_Tests PRIVATE Catch2::Catch2WithMain) +SetupVulkan(OpenVulkano_Tests) +SetGlmDefines(OpenVulkano_Tests) +SetWarningSettings(OpenVulkano_Tests) + +list(APPEND CMAKE_MODULE_PATH ${Catch2_SOURCE_DIR}/extras) +list(APPEND CMAKE_MODULE_PATH ${Catch2_SOURCE_DIR}/contrib) + +include(CTest) +include(Catch) +catch_discover_tests(OpenVulkano_Tests)