Require all modules are built before building tests
This commit is contained in:
parent
bc7ec1277a
commit
f3d98a9ebf
@ -282,9 +282,11 @@ endif()
|
|||||||
if(SFML_BUILD_TEST_SUITE)
|
if(SFML_BUILD_TEST_SUITE)
|
||||||
if (SFML_OS_IOS)
|
if (SFML_OS_IOS)
|
||||||
message( WARNING "Unit testing not supported on iOS")
|
message( WARNING "Unit testing not supported on iOS")
|
||||||
else()
|
elseif(SFML_BUILD_WINDOW AND SFML_BUILD_GRAPHICS AND SFML_BUILD_NETWORK AND SFML_BUILD_AUDIO)
|
||||||
enable_testing()
|
enable_testing()
|
||||||
add_subdirectory(test)
|
add_subdirectory(test)
|
||||||
|
else()
|
||||||
|
message(WARNING "Cannot build unit testing unless all modules are enabled")
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
@ -11,7 +11,6 @@ target_include_directories(sfml-test-main SYSTEM PUBLIC "${PROJECT_SOURCE_DIR}/e
|
|||||||
target_include_directories(sfml-test-main PUBLIC TestUtilities)
|
target_include_directories(sfml-test-main PUBLIC TestUtilities)
|
||||||
target_link_libraries(sfml-test-main PUBLIC SFML::System)
|
target_link_libraries(sfml-test-main PUBLIC SFML::System)
|
||||||
|
|
||||||
# System is always built
|
|
||||||
SET(SYSTEM_SRC
|
SET(SYSTEM_SRC
|
||||||
System/Angle.cpp
|
System/Angle.cpp
|
||||||
System/Clock.cpp
|
System/Clock.cpp
|
||||||
@ -22,40 +21,32 @@ SET(SYSTEM_SRC
|
|||||||
)
|
)
|
||||||
sfml_add_test(test-sfml-system "${SYSTEM_SRC}" SFML::System)
|
sfml_add_test(test-sfml-system "${SYSTEM_SRC}" SFML::System)
|
||||||
|
|
||||||
if(SFML_BUILD_WINDOW)
|
SET(WINDOW_SRC
|
||||||
SET(WINDOW_SRC
|
Window/ContextSettings.cpp
|
||||||
Window/ContextSettings.cpp
|
Window/VideoMode.cpp
|
||||||
Window/VideoMode.cpp
|
)
|
||||||
)
|
sfml_add_test(test-sfml-window "${WINDOW_SRC}" SFML::Window)
|
||||||
sfml_add_test(test-sfml-window "${WINDOW_SRC}" SFML::Window)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(SFML_BUILD_GRAPHICS)
|
SET(GRAPHICS_SRC
|
||||||
SET(GRAPHICS_SRC
|
Graphics/BlendMode.cpp
|
||||||
Graphics/BlendMode.cpp
|
Graphics/Color.cpp
|
||||||
Graphics/Color.cpp
|
Graphics/Rect.cpp
|
||||||
Graphics/Rect.cpp
|
Graphics/Transform.cpp
|
||||||
Graphics/Transform.cpp
|
Graphics/Transformable.cpp
|
||||||
Graphics/Transformable.cpp
|
Graphics/Vertex.cpp
|
||||||
Graphics/Vertex.cpp
|
Graphics/VertexArray.cpp
|
||||||
Graphics/VertexArray.cpp
|
)
|
||||||
)
|
sfml_add_test(test-sfml-graphics "${GRAPHICS_SRC}" SFML::Graphics)
|
||||||
sfml_add_test(test-sfml-graphics "${GRAPHICS_SRC}" SFML::Graphics)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(SFML_BUILD_NETWORK)
|
SET(NETWORK_SRC
|
||||||
SET(NETWORK_SRC
|
Network/Packet.cpp
|
||||||
Network/Packet.cpp
|
)
|
||||||
)
|
sfml_add_test(test-sfml-network "${NETWORK_SRC}" SFML::Network)
|
||||||
sfml_add_test(test-sfml-network "${NETWORK_SRC}" SFML::Network)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(SFML_BUILD_AUDIO)
|
SET(AUDIO_SRC
|
||||||
SET(AUDIO_SRC
|
Audio/Dummy.cpp # TODO: Remove when there are real tests
|
||||||
Audio/Dummy.cpp # TODO: Remove when there are real tests
|
)
|
||||||
)
|
sfml_add_test(test-sfml-audio "${AUDIO_SRC}" SFML::Audio)
|
||||||
sfml_add_test(test-sfml-audio "${AUDIO_SRC}" SFML::Audio)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# Automatically run the tests at the end of the build
|
# Automatically run the tests at the end of the build
|
||||||
add_custom_target(runtests ALL
|
add_custom_target(runtests ALL
|
||||||
|
Loading…
Reference in New Issue
Block a user