cmake: build tests against installed SDL prefix

This commit is contained in:
Anonymous Maarten
2023-08-02 16:03:32 +02:00
parent 7f888f98f7
commit 75a71bde4b
5 changed files with 48 additions and 4 deletions

View File

@@ -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}")

View File

@@ -2,8 +2,10 @@
* Intrinsics test suite
*/
#ifndef NO_BUILD_CONFIG
/* Disable intrinsics that are unsupported by the current compiler */
#include <build_config/SDL_build_config.h>
#endif
#include <SDL3/SDL.h>
#include <SDL3/SDL_intrin.h>

View File

@@ -19,6 +19,7 @@
3. This notice may not be removed or altered from any source distribution.
*/
#ifndef NO_BUILD_CONFIG
#include <stddef.h>
/**
@@ -1907,3 +1908,23 @@ SDLTest_TestSuiteReference penTestSuite = {
penTests,
NULL
};
#else
#include <SDL3/SDL_test.h>
#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

View File

@@ -22,7 +22,9 @@
#endif
#define SDL_DYNAMIC_API 0
#ifndef NO_BUILD_CONFIG
#include "../src/SDL_internal.h"
#endif
#include <stdio.h>
#include <string.h>