mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-24 20:12:07 +00:00
Make tests work with CTest (#1539)
Adds option to disable non-free tests
This commit is contained in:
@@ -1,13 +1,18 @@
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
OPTION(USE_NONFREE_TESTS "run tests that build nonfree codebases" ON)
|
||||
|
||||
if(NOT USE_NONFREE_TESTS)
|
||||
set(ONLY_FREE "--only-free")
|
||||
endif()
|
||||
|
||||
add_executable(randtilegen gfx/randtilegen.cpp)
|
||||
add_executable(rgbgfx_test gfx/rgbgfx_test.cpp)
|
||||
set_target_properties(randtilegen rgbgfx_test PROPERTIES
|
||||
# hack for MSVC: no-op generator expression to stop generation of "per-configuration subdirectory"
|
||||
RUNTIME_OUTPUT_DIRECTORY $<1:${CMAKE_CURRENT_SOURCE_DIR}/gfx>)
|
||||
|
||||
install(TARGETS randtilegen rgbgfx_test
|
||||
DESTINATION ${rgbds_SOURCE_DIR}/test/gfx
|
||||
COMPONENT "Test support programs"
|
||||
EXCLUDE_FROM_ALL
|
||||
)
|
||||
configure_file(CTestCustom.cmake.in ${CMAKE_BINARY_DIR}/CTestCustom.cmake)
|
||||
|
||||
foreach(TARGET randtilegen rgbgfx_test)
|
||||
if(LIBPNG_FOUND) # pkg-config
|
||||
@@ -20,3 +25,8 @@ foreach(TARGET randtilegen rgbgfx_test)
|
||||
target_link_libraries(${TARGET} PRIVATE ${PNG_LIBRARIES})
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
add_test(NAME all
|
||||
COMMAND ./run-tests.sh ${ONLY_FREE}
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
)
|
||||
|
||||
1
test/CTestCustom.cmake.in
Normal file
1
test/CTestCustom.cmake.in
Normal file
@@ -0,0 +1 @@
|
||||
set(CTEST_CUSTOM_PRE_TEST "bash -c 'cd @CMAKE_CURRENT_SOURCE_DIR@\; ./fetch-test-deps.sh @ONLY_FREE@'")
|
||||
Reference in New Issue
Block a user