1
0
mirror of https://github.com/rwengine/openrw.git synced 2024-11-07 03:12:36 +01:00
openrw/tests/CMakeLists.txt

117 lines
2.3 KiB
CMake
Raw Normal View History

##############################################################################
# Unit Tests
##############################################################################
find_package(Boost COMPONENTS filesystem unit_test_framework system REQUIRED)
set(TESTS
Animation
Archive
Buoyancy
Character
Chase
Config
Cutscene
Data
FileIndex
GameData
GameWorld
Input
Items
Lifetime
LoaderDFF
LoaderIPL
Logger
Menu
Object
ObjectData
Pickup
Renderer
RWBStream
SaveGame
ScriptMachine
State
Text
TrafficDirector
Vehicle
VisualFX
Weapon
World
ZoneData
)
set(TEST_SOURCES
2017-10-26 01:03:15 +02:00
main.cpp
test_Globals.cpp
test_Globals.hpp
2017-10-26 01:03:15 +02:00
# Hack in rwgame sources until there's a per-target test suite
"${CMAKE_SOURCE_DIR}/rwgame/GameConfig.cpp"
"${CMAKE_SOURCE_DIR}/rwgame/GameWindow.cpp"
"${CMAKE_SOURCE_DIR}/rwgame/GameInput.cpp"
)
2013-09-11 13:10:42 +02:00
foreach(TEST ${TESTS})
list(APPEND TEST_SOURCES "test_${TEST}.cpp")
endforeach()
add_executable(rwtests
${TEST_SOURCES}
)
2013-09-11 13:10:42 +02:00
target_compile_definitions(rwtests
PRIVATE
"RW_TEST_WITH_DATA=$<NOT:$<BOOL:${TESTS_NODATA}>>"
)
2013-09-11 13:10:42 +02:00
if(NOT CMAKE_SYSTEM_NAME STREQUAL "Windows")
target_compile_definitions(rwtests
PRIVATE
"BOOST_TEST_DYN_LINK"
)
endif()
target_include_directories(rwtests
SYSTEM
PRIVATE
${Boost_INCLUDE_DIRS}
)
target_include_directories(rwtests
PRIVATE
2017-10-26 01:03:15 +02:00
"${CMAKE_SOURCE_DIR}/tests"
"${CMAKE_SOURCE_DIR}/rwgame"
)
2013-09-11 13:10:42 +02:00
target_link_libraries(rwtests
2017-10-26 01:03:15 +02:00
PRIVATE
rwengine
2017-10-26 01:47:29 +02:00
SDL2::SDL2
${Boost_FILESYSTEM_LIBRARY}
2017-10-26 01:03:15 +02:00
${Boost_UNIT_TEST_FRAMEWORK_LIBRARY}
${Boost_SYSTEM_LIBRARY}
2017-10-26 01:03:15 +02:00
)
2013-09-11 13:10:42 +02:00
openrw_target_apply_options(TARGET rwtests)
2017-11-03 23:59:02 +01:00
if(SEPARATE_TEST_SUITES)
foreach(TEST ${TESTS})
add_test(
NAME "${TEST}"
COMMAND "$<TARGET_FILE:rwtests>" "-t" "${TEST}Tests"
)
set_tests_properties("${TEST}"
PROPERTIES
TIMEOUT 300
)
endforeach()
else()
add_test(NAME UnitTests
COMMAND "$<TARGET_FILE:rwtests>"
)
set_tests_properties(UnitTests
PROPERTIES
TIMEOUT 300
)
endif()