Squash add tests

This commit is contained in:
Metehan Tuncbilek
2024-08-04 14:49:28 +02:00
committed by Georg Hagen
parent 071ced8cb0
commit db367db7bb
2 changed files with 29 additions and 3 deletions

View File

@@ -26,7 +26,7 @@ SetOptimisationSettings()
# ------------------------- CMAKE OPTIONS ------------------------- # ------------------------- CMAKE OPTIONS -------------------------
option(USE_ASSIMP "If assimp should be used" ON) option(USE_ASSIMP "If assimp should be used" ON)
option(TRACY_ENABLE "Enable Tracy Profiler" OFF) 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) option(ENABLE_EXAMPLE "Enable examples" ON)
# ----------------------------------------------------------------- # -----------------------------------------------------------------
@@ -38,7 +38,7 @@ add_subdirectory(openVulkanoCpp)
if(ENABLE_TEST) if(ENABLE_TEST)
enable_testing() enable_testing()
add_subdirectory(unitTest) add_subdirectory(tests)
endif() endif()
# Finally generate the tests and examples # Finally generate the tests and examples

26
tests/CMakeLists.txt Normal file
View File

@@ -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 "$<LINK_LIBRARY:WHOLE_ARCHIVE,openVulkanoCpp>")
# 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)