diff --git a/cmake/test/CMakeLists.txt b/cmake/test/CMakeLists.txt index f03590f20..d3fd8a09a 100644 --- a/cmake/test/CMakeLists.txt +++ b/cmake/test/CMakeLists.txt @@ -1,4 +1,4 @@ -# This cmake build script is meant for verifying the various CMake configuration script. +# This cmake build script is meant for verifying the various CMake configuration scripts. cmake_minimum_required(VERSION 3.12) project(sdl_test LANGUAGES C) @@ -35,9 +35,14 @@ add_feature_info("TEST_STATIC" TEST_STATIC "Test linking with static library") option(TEST_TEST "Test linking to SDL3_test library" ON) add_feature_info("TEST_TEST" TEST_STATIC "Test linking to SDL test library") +option(TEST_FULL "Run complete SDL test suite" OFF) +add_feature_info("TEST_FULL" TEST_FULL "Build full SDL testsuite") + find_package(SDL3 REQUIRED CONFIG COMPONENTS Headers) -add_library(headers_test OBJECT inc_sdl_slash.c inc_sdl_noslash.c) -target_link_libraries(headers_test PRIVATE SDL3::Headers) +add_library(headers_test_slash OBJECT inc_sdl_slash.c) +target_link_libraries(headers_test_slash PRIVATE SDL3::Headers) +add_library(headers_test_noslash OBJECT inc_sdl_noslash.c) +target_link_libraries(headers_test_noslash PRIVATE SDL3::Headers) if(TEST_SHARED) find_package(SDL3 REQUIRED CONFIG COMPONENTS SDL3-shared) @@ -93,6 +98,15 @@ find_package(SDL3 REQUIRED CONFIG COMPONENTS SDL3) add_executable(gui-whatever WIN32 main_gui.c) target_link_libraries(gui-whatever PRIVATE SDL3::SDL3) +if(TEST_FULL) + enable_testing() + set(SDL_TESTS_TIMEOUT_MULTIPLIER "1" CACHE STRING "Test timeout multiplier") + set(SDL_TESTS_LINK_SHARED ${TEST_SHARED}) + + add_definitions(-DNO_BUILD_CONFIG) + add_subdirectory("${CMAKE_CURRENT_LIST_DIR}/../../test" SDL_test) +endif() + if(ANDROID) find_package(SDL3 REQUIRED CONFIG COMPONENTS Jar) endif() diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index fea1130eb..abf1ec22f 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -2,7 +2,12 @@ # CMake script for building the SDL tests # +list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/../cmake") + +include(CheckIncludeFile) include(CheckStructHasMember) +include(CMakePushCheckState) +include(sdlcompilers) if(SDL_TESTS_LINK_SHARED) set(sdl_name_component SDL3-shared) @@ -220,7 +225,7 @@ if(HAVE_LIBUDEV_H) endif() set(FFmpeg_FIND_COMPONENTS AVCODEC AVFORMAT AVUTIL SWSCALE) -include("${SDL3_SOURCE_DIR}/cmake/FindFFmpeg.cmake") +include("${CMAKE_CURRENT_LIST_DIR}/../cmake/FindFFmpeg.cmake") if(FFmpeg_FOUND) cmake_push_check_state() list(APPEND CMAKE_REQUIRED_INCLUDES "${FFmpeg_AVUTIL_INCLUDE_DIRS}") diff --git a/test/testautomation_intrinsics.c b/test/testautomation_intrinsics.c index 8c1dc7a7a..98dabf0fb 100644 --- a/test/testautomation_intrinsics.c +++ b/test/testautomation_intrinsics.c @@ -2,8 +2,10 @@ * Intrinsics test suite */ +#ifndef NO_BUILD_CONFIG /* Disable intrinsics that are unsupported by the current compiler */ #include +#endif #include #include diff --git a/test/testautomation_pen.c b/test/testautomation_pen.c index f5c3bff98..67cdebb1a 100644 --- a/test/testautomation_pen.c +++ b/test/testautomation_pen.c @@ -19,6 +19,7 @@ 3. This notice may not be removed or altered from any source distribution. */ +#ifndef NO_BUILD_CONFIG #include /** @@ -1907,3 +1908,23 @@ SDLTest_TestSuiteReference penTestSuite = { penTests, NULL }; + +#else + +#include +#include "testautomation_suites.h" + +/* Sequence of Mouse test cases */ +static const SDLTest_TestCaseReference *penTests[] = { + NULL +}; + +/* Mouse test suite (global) */ +SDLTest_TestSuiteReference penTestSuite = { + "Pen", + NULL, + penTests, + NULL +}; + +#endif diff --git a/test/testevdev.c b/test/testevdev.c index a991d4838..d086e4545 100644 --- a/test/testevdev.c +++ b/test/testevdev.c @@ -22,7 +22,9 @@ #endif #define SDL_DYNAMIC_API 0 +#ifndef NO_BUILD_CONFIG #include "../src/SDL_internal.h" +#endif #include #include