2015-04-29 03:54:03 +08:00
|
|
|
set(SRCROOT "${PROJECT_SOURCE_DIR}/test/src")
|
|
|
|
|
2018-08-19 07:30:53 +08:00
|
|
|
include_directories("${PROJECT_SOURCE_DIR}/include")
|
|
|
|
include_directories("${PROJECT_SOURCE_DIR}/extlibs/headers")
|
2018-08-20 15:51:42 +08:00
|
|
|
include_directories("${SRCROOT}/TestUtilities")
|
2018-08-19 07:30:53 +08:00
|
|
|
|
|
|
|
# System is always built
|
|
|
|
SET(SYSTEM_SRC
|
2018-08-20 15:51:42 +08:00
|
|
|
"${SRCROOT}/CatchMain.cpp"
|
|
|
|
"${SRCROOT}/System/Vector2.cpp"
|
|
|
|
"${SRCROOT}/System/Vector3.cpp"
|
|
|
|
"${SRCROOT}/TestUtilities/SystemUtil.hpp"
|
|
|
|
"${SRCROOT}/TestUtilities/SystemUtil.cpp"
|
2015-04-29 03:54:03 +08:00
|
|
|
)
|
2018-08-20 02:04:11 +08:00
|
|
|
add_executable(systemtest ${SYSTEM_SRC})
|
|
|
|
target_link_libraries(systemtest sfml-system)
|
2018-08-21 03:09:29 +08:00
|
|
|
add_test(System-module-tests systemtest)
|
2015-04-29 03:54:03 +08:00
|
|
|
|
2018-08-19 07:30:53 +08:00
|
|
|
if(SFML_BUILD_WINDOW)
|
|
|
|
SET(WINDOW_SRC
|
2018-08-20 15:51:42 +08:00
|
|
|
"${SRCROOT}/CatchMain.cpp"
|
|
|
|
"${SRCROOT}/TestUtilities/WindowUtil.hpp"
|
|
|
|
"${SRCROOT}/TestUtilities/WindowUtil.cpp"
|
2018-08-19 07:30:53 +08:00
|
|
|
)
|
2018-08-20 02:04:11 +08:00
|
|
|
add_executable(windowtest ${WINDOW_SRC})
|
|
|
|
target_link_libraries(windowtest sfml-window)
|
2018-08-21 03:09:29 +08:00
|
|
|
add_test(Window-module-tests windowtest)
|
2018-08-19 07:30:53 +08:00
|
|
|
endif()
|
|
|
|
|
|
|
|
if(SFML_BUILD_GRAPHICS)
|
|
|
|
SET(GRAPHICS_SRC
|
2018-08-20 15:51:42 +08:00
|
|
|
"${SRCROOT}/CatchMain.cpp"
|
|
|
|
"${SRCROOT}/Graphics/Rect.cpp"
|
|
|
|
"${SRCROOT}/TestUtilities/GraphicsUtil.hpp"
|
|
|
|
"${SRCROOT}/TestUtilities/GraphicsUtil.cpp"
|
2018-08-19 07:30:53 +08:00
|
|
|
)
|
2018-08-20 02:04:11 +08:00
|
|
|
add_executable(graphicstest ${GRAPHICS_SRC})
|
|
|
|
target_link_libraries(graphicstest sfml-graphics)
|
2018-08-21 03:09:29 +08:00
|
|
|
add_test(Graphics-module-tests graphicstest)
|
2018-08-19 07:30:53 +08:00
|
|
|
endif()
|
|
|
|
|
2018-08-20 02:04:11 +08:00
|
|
|
# Automatically run the tests at the end of the build
|
2018-08-21 05:49:56 +08:00
|
|
|
add_custom_target(runtests ALL
|
|
|
|
DEPENDS systemtest windowtest graphicstest
|
2018-08-19 07:30:53 +08:00
|
|
|
)
|
2018-08-20 02:04:11 +08:00
|
|
|
add_custom_command(TARGET runtests
|
|
|
|
COMMENT "Run tests"
|
|
|
|
POST_BUILD COMMAND ctest ARGS --output-on-failure
|
|
|
|
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
|
2015-04-29 03:54:03 +08:00
|
|
|
)
|