2016-05-19 23:28:12 +02:00
|
|
|
##############################################################################
|
|
|
|
# Unit Tests
|
|
|
|
##############################################################################
|
|
|
|
|
2017-02-17 01:17:50 +01:00
|
|
|
find_package(Boost COMPONENTS filesystem unit_test_framework REQUIRED)
|
2016-05-19 23:28:12 +02:00
|
|
|
|
2016-04-15 02:06:10 +02:00
|
|
|
set(TEST_SOURCES
|
|
|
|
"main.cpp"
|
2017-02-20 18:07:54 +01:00
|
|
|
"test_globals.cpp"
|
2016-04-15 02:06:10 +02:00
|
|
|
"test_animation.cpp"
|
|
|
|
"test_archive.cpp"
|
|
|
|
"test_buoyancy.cpp"
|
|
|
|
"test_character.cpp"
|
|
|
|
"test_chase.cpp"
|
|
|
|
"test_cutscene.cpp"
|
2016-05-20 03:09:22 +02:00
|
|
|
"test_config.cpp"
|
2016-04-15 02:06:10 +02:00
|
|
|
"test_data.cpp"
|
|
|
|
"test_FileIndex.cpp"
|
|
|
|
"test_GameData.cpp"
|
|
|
|
"test_GameWorld.cpp"
|
|
|
|
"test_globals.hpp"
|
|
|
|
"test_items.cpp"
|
2016-11-18 01:56:42 +01:00
|
|
|
"test_Input.cpp"
|
2016-04-15 02:06:10 +02:00
|
|
|
"test_lifetime.cpp"
|
|
|
|
"test_loaderdff.cpp"
|
2017-01-18 00:57:20 +01:00
|
|
|
"test_LoaderIPL.cpp"
|
2016-04-15 02:06:10 +02:00
|
|
|
"test_Logger.cpp"
|
|
|
|
"test_menu.cpp"
|
|
|
|
"test_object.cpp"
|
|
|
|
"test_object_data.cpp"
|
|
|
|
"test_pickup.cpp"
|
|
|
|
"test_renderer.cpp"
|
|
|
|
"test_rwbstream.cpp"
|
|
|
|
"test_SaveGame.cpp"
|
|
|
|
"test_scriptmachine.cpp"
|
|
|
|
"test_state.cpp"
|
|
|
|
"test_text.cpp"
|
|
|
|
"test_trafficdirector.cpp"
|
|
|
|
"test_vehicle.cpp"
|
|
|
|
"test_VisualFX.cpp"
|
|
|
|
"test_weapon.cpp"
|
|
|
|
"test_world.cpp"
|
2017-01-18 00:57:20 +01:00
|
|
|
"test_ZoneData.cpp"
|
2016-05-20 03:09:22 +02:00
|
|
|
|
|
|
|
# Hack in rwgame sources until there's a per-target test suite
|
|
|
|
"${CMAKE_SOURCE_DIR}/rwgame/GameConfig.cpp"
|
2016-06-22 12:29:39 +02:00
|
|
|
"${CMAKE_SOURCE_DIR}/rwgame/GameWindow.cpp"
|
2016-11-18 01:56:42 +01:00
|
|
|
"${CMAKE_SOURCE_DIR}/rwgame/GameInput.cpp"
|
2016-04-15 02:06:10 +02:00
|
|
|
)
|
2013-09-11 13:10:42 +02:00
|
|
|
|
2016-04-15 02:06:10 +02:00
|
|
|
add_executable(run_tests ${TEST_SOURCES})
|
2013-09-11 13:10:42 +02:00
|
|
|
|
2017-10-26 00:44:45 +02:00
|
|
|
target_compile_definitions(run_tests
|
|
|
|
PRIVATE
|
|
|
|
"RW_TEST_WITH_DATA=$<NOT:$<BOOL:${TESTS_NODATA}>>"
|
|
|
|
"BOOST_TEST_DYN_LINK"
|
|
|
|
)
|
2013-09-11 13:10:42 +02:00
|
|
|
|
2017-10-26 00:44:45 +02:00
|
|
|
target_include_directories(run_tests
|
|
|
|
SYSTEM
|
|
|
|
PRIVATE
|
|
|
|
${BULLET_INCLUDE_DIR}
|
|
|
|
${SDL2_INCLUDE_DIR}
|
|
|
|
)
|
|
|
|
|
|
|
|
target_include_directories(run_tests
|
|
|
|
PRIVATE
|
|
|
|
"${CMAKE_SOURCE_DIR}/tests"
|
|
|
|
"${CMAKE_SOURCE_DIR}/rwgame"
|
|
|
|
)
|
2013-09-11 13:10:42 +02:00
|
|
|
|
2014-08-17 00:02:34 +02:00
|
|
|
target_link_libraries(run_tests
|
|
|
|
rwengine
|
|
|
|
${OPENGL_LIBRARIES}
|
2016-05-19 23:28:12 +02:00
|
|
|
${BULLET_LIBRARIES}
|
2016-06-22 23:28:05 +02:00
|
|
|
${SDL2_LIBRARY}
|
2016-06-22 12:29:39 +02:00
|
|
|
${PNG_LIBRARIES}
|
2014-08-17 00:02:34 +02:00
|
|
|
${Boost_UNIT_TEST_FRAMEWORK_LIBRARY})
|
2013-09-11 13:10:42 +02:00
|
|
|
|
|
|
|
add_test(UnitTests run_tests)
|