mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-08-08 14:34:04 -06:00
Catch2 test framework integration.
This commit is contained in:
parent
ffa544ade3
commit
fe7f2e4d95
14 changed files with 18205 additions and 20 deletions
|
@ -1,13 +1,50 @@
|
|||
# TODO Add individual tests as executables in separate directories
|
||||
# add_subirectory(<testcase>)
|
||||
|
||||
find_package(GTest REQUIRED)
|
||||
|
||||
set(TEST_DATA_DIR ${CMAKE_CURRENT_SOURCE_DIR}/data)
|
||||
file(TO_NATIVE_PATH "${TEST_DATA_DIR}" TEST_DATA_DIR)
|
||||
|
||||
add_library(test_common INTERFACE)
|
||||
target_compile_definitions(test_common INTERFACE TEST_DATA_DIR="${TEST_DATA_DIR}")
|
||||
target_link_libraries(test_common INTERFACE GTest::GTest GTest::Main)
|
||||
add_library(Catch2 INTERFACE)
|
||||
list (APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/modules/Catch2)
|
||||
target_include_directories(Catch2 INTERFACE ${CMAKE_CURRENT_LIST_DIR})
|
||||
add_library(Catch2::Catch2 ALIAS Catch2)
|
||||
include(Catch)
|
||||
|
||||
add_library(test_catch2_common INTERFACE)
|
||||
target_compile_definitions(test_catch2_common INTERFACE TEST_DATA_DIR="${TEST_DATA_DIR}")
|
||||
target_link_libraries(test_catch2_common INTERFACE Catch2::Catch2)
|
||||
|
||||
add_library(test_common INTERFACE)
|
||||
target_link_libraries(test_common INTERFACE test_catch2_common)
|
||||
|
||||
# DEPRECATED:
|
||||
find_package(GTest REQUIRED)
|
||||
add_library(test_gtest_common INTERFACE)
|
||||
target_compile_definitions(test_gtest_common INTERFACE TEST_DATA_DIR="${TEST_DATA_DIR}")
|
||||
target_link_libraries(test_gtest_common INTERFACE GTest::GTest GTest::Main)
|
||||
|
||||
function(prusaslicer_discover_tests TARGET)
|
||||
catch_discover_tests(${TARGET})
|
||||
endfunction()
|
||||
|
||||
macro(subdirlist result curdir)
|
||||
file(GLOB children RELATIVE ${curdir} ${curdir}/*)
|
||||
set(dirlist "")
|
||||
foreach(child ${children})
|
||||
if(IS_DIRECTORY ${curdir}/${child} AND NOT ${child} STREQUAL "catch2" )
|
||||
list(APPEND dirlist ${child})
|
||||
endif()
|
||||
endforeach()
|
||||
set(${result} ${dirlist})
|
||||
endmacro()
|
||||
|
||||
subdirlist(SUBDIRS ${CMAKE_CURRENT_LIST_DIR})
|
||||
message(STATUS ${SUBDIRS})
|
||||
|
||||
foreach(subdir ${SUBDIRS})
|
||||
add_subdirectory(${subdir})
|
||||
endforeach()
|
||||
|
||||
#add_subdirectory(timeutils)
|
||||
#add_subdirectory(example)
|
||||
|
||||
add_subdirectory(timeutils)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue