Remove SDL_config.h from the public headers

The SDL headers are no longer dependent on the build configuration.

Fixes https://github.com/libsdl-org/SDL/issues/6643 and https://github.com/libsdl-org/SDL/issues/6641
This commit is contained in:
Sam Lantinga
2022-11-26 04:48:36 -08:00
parent bc5677db95
commit 63f307fe1f
176 changed files with 448 additions and 712 deletions
+12 -1
View File
@@ -2,6 +2,7 @@ cmake_minimum_required(VERSION 3.0)
project(SDL3_test)
include(CheckCCompilerFlag)
include(CheckIncludeFile)
include(CMakeParseArguments)
include(CMakePushCheckState)
@@ -91,7 +92,17 @@ if(NOT MSVC OR NOT CMAKE_GENERATOR_PLATFORM STREQUAL "ARM64")
endif()
if (OPENGL_FOUND)
add_definitions(-DHAVE_OPENGL)
add_definitions(-DHAVE_OPENGL)
endif()
check_include_file(signal.h HAVE_SIGNAL_H)
if (HAVE_SIGNAL_H)
add_definitions(-DHAVE_SIGNAL_H)
endif()
check_include_file(libudev.h HAVE_LIBUDEV_H)
if (HAVE_LIBUDEV_H)
add_definitions(-DHAVE_LIBUDEV_H)
endif()
add_sdl_test_executable(checkkeys checkkeys.c)
-2
View File
@@ -15,9 +15,7 @@
pump the event loop and catch keystrokes.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#ifdef __EMSCRIPTEN__
#include <emscripten/emscripten.h>
-1
View File
@@ -17,7 +17,6 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#ifdef __EMSCRIPTEN__
#include <emscripten/emscripten.h>
-14
View File
@@ -15,13 +15,10 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "SDL.h"
#include "testutils.h"
#ifndef SDL_JOYSTICK_DISABLED
/* Define this for verbose output while mapping controllers */
#define DEBUG_CONTROLLERMAP
@@ -812,15 +809,4 @@ main(int argc, char *argv[])
return 0;
}
#else
int
main(int argc, char *argv[])
{
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "SDL compiled without Joystick support.\n");
return 1;
}
#endif
/* vi: set ts=4 sw=4 expandtab: */
-3
View File
@@ -15,9 +15,6 @@
/* loopwaves.c is much more robust in handling WAVE files --
This is only for simple WAVEs
*/
#include "SDL_config.h"
#include <stdio.h>
#include <stdlib.h>
#ifdef __EMSCRIPTEN__
-1
View File
@@ -12,7 +12,6 @@
/* Program to load a wave file and loop playing it using SDL sound queueing */
#include <stdio.h>
#include <stdlib.h>
#ifdef __EMSCRIPTEN__
-2
View File
@@ -9,8 +9,6 @@
including commercial applications, and to alter it and redistribute it
freely.
*/
#include <stdio.h>
#include "SDL.h"
/*
+3 -1
View File
@@ -9,10 +9,11 @@
including commercial applications, and to alter it and redistribute it
freely.
*/
#include "SDL.h"
#include <stdlib.h>
#include "SDL.h"
#ifdef __EMSCRIPTEN__
#include <emscripten/emscripten.h>
#endif
@@ -163,3 +164,4 @@ main(int argc, char **argv)
return 0;
}
/* vi: set ts=4 sw=4 expandtab: */
-3
View File
@@ -12,9 +12,6 @@
/* Program to test hotplugging of audio devices */
#include "SDL_config.h"
#include <stdio.h>
#include <stdlib.h>
#if HAVE_SIGNAL_H
+2 -1
View File
@@ -9,7 +9,6 @@
including commercial applications, and to alter it and redistribute it
freely.
*/
#include <stdio.h>
#include "SDL.h"
static void
@@ -102,3 +101,5 @@ main(int argc, char **argv)
SDL_Quit();
return 0;
}
/* vi: set ts=4 sw=4 expandtab: */
-2
View File
@@ -11,8 +11,6 @@
*/
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#include "SDL.h"
#include "SDL_test.h"
+2 -1
View File
@@ -9,7 +9,6 @@
#endif
#include <stdio.h>
#include <string.h>
#include "SDL.h"
#include "SDL_test.h"
@@ -1038,3 +1037,5 @@ SDLTest_TestSuiteReference audioTestSuite = {
audioTests,
_audioTearDown
};
/* vi: set ts=4 sw=4 expandtab: */
+2 -4
View File
@@ -1,10 +1,6 @@
/**
* New/updated tests: aschiffler at ferzkopp dot net
*/
#include <stdio.h>
#include <string.h>
#include "SDL.h"
#include "SDL_test.h"
@@ -334,3 +330,5 @@ SDLTest_TestSuiteReference clipboardTestSuite = {
clipboardTests,
NULL
};
/* vi: set ts=4 sw=4 expandtab: */
+2 -3
View File
@@ -1,9 +1,6 @@
/**
* Events test suite
*/
#include <stdio.h>
#include "SDL.h"
#include "SDL_test.h"
@@ -199,3 +196,5 @@ SDLTest_TestSuiteReference eventsTestSuite = {
eventsTests,
NULL
};
/* vi: set ts=4 sw=4 expandtab: */
+2
View File
@@ -148,3 +148,5 @@ SDLTest_TestSuiteReference guidTestSuite = {
guidTests,
NULL
};
/* vi: set ts=4 sw=4 expandtab: */
+2 -2
View File
@@ -2,8 +2,6 @@
* Hints test suite
*/
#include <stdio.h>
#include "SDL.h"
#include "SDL_test.h"
@@ -267,3 +265,5 @@ SDLTest_TestSuiteReference hintsTestSuite = {
hintsTests,
NULL
};
/* vi: set ts=4 sw=4 expandtab: */
+2
View File
@@ -88,3 +88,5 @@ SDLTest_TestSuiteReference joystickTestSuite = {
joystickTests,
NULL
};
/* vi: set ts=4 sw=4 expandtab: */
+2 -4
View File
@@ -2,10 +2,6 @@
* Keyboard test suite
*/
#include <stdio.h>
#include <limits.h>
#include "SDL_config.h"
#include "SDL.h"
#include "SDL_test.h"
@@ -709,3 +705,5 @@ SDLTest_TestSuiteReference keyboardTestSuite = {
keyboardTests,
NULL
};
/* vi: set ts=4 sw=4 expandtab: */
-16
View File
@@ -18,9 +18,6 @@
*/
static int main_testInitQuitJoystickHaptic (void *arg)
{
#if defined SDL_JOYSTICK_DISABLED || defined SDL_HAPTIC_DISABLED
return TEST_SKIPPED;
#else
int enabled_subsystems;
int initialized_subsystems = SDL_INIT_JOYSTICK | SDL_INIT_HAPTIC;
@@ -35,7 +32,6 @@ static int main_testInitQuitJoystickHaptic (void *arg)
SDLTest_AssertCheck( enabled_subsystems == 0, "SDL_Quit should shut down everything (%i)", enabled_subsystems );
return TEST_COMPLETED;
#endif
}
/* !
@@ -46,9 +42,6 @@ static int main_testInitQuitJoystickHaptic (void *arg)
*/
static int main_testInitQuitSubSystem (void *arg)
{
#if defined SDL_JOYSTICK_DISABLED || defined SDL_HAPTIC_DISABLED || defined SDL_GAMECONTROLLER_DISABLED
return TEST_SKIPPED;
#else
int i;
int subsystems[] = { SDL_INIT_JOYSTICK, SDL_INIT_HAPTIC, SDL_INIT_GAMECONTROLLER };
@@ -68,15 +61,11 @@ static int main_testInitQuitSubSystem (void *arg)
}
return TEST_COMPLETED;
#endif
}
const int joy_and_controller = SDL_INIT_JOYSTICK | SDL_INIT_GAMECONTROLLER;
static int main_testImpliedJoystickInit (void *arg)
{
#if defined SDL_JOYSTICK_DISABLED || defined SDL_GAMECONTROLLER_DISABLED
return TEST_SKIPPED;
#else
int initialized_system;
/* First initialize the controller */
@@ -94,14 +83,10 @@ static int main_testImpliedJoystickInit (void *arg)
SDLTest_AssertCheck( (initialized_system & joy_and_controller) == 0, "SDL_WasInit() should be false for joystick & controller (%x)", initialized_system );
return TEST_COMPLETED;
#endif
}
static int main_testImpliedJoystickQuit (void *arg)
{
#if defined SDL_JOYSTICK_DISABLED || defined SDL_GAMECONTROLLER_DISABLED
return TEST_SKIPPED;
#else
int initialized_system;
/* First initialize the controller and the joystick (explicitly) */
@@ -122,7 +107,6 @@ static int main_testImpliedJoystickQuit (void *arg)
SDL_QuitSubSystem(SDL_INIT_JOYSTICK);
return TEST_COMPLETED;
#endif
}
#if defined(__GNUC__) || defined(__clang__)
+8 -1
View File
@@ -3349,4 +3349,11 @@ static const SDLTest_TestCaseReference *mathTests[] = {
NULL
};
SDLTest_TestSuiteReference mathTestSuite = { "Math", NULL, mathTests, NULL };
SDLTest_TestSuiteReference mathTestSuite = {
"Math",
NULL,
mathTests,
NULL
};
/* vi: set ts=4 sw=4 expandtab: */
+2 -2
View File
@@ -1,8 +1,6 @@
/**
* Mouse test suite
*/
#include <stdio.h>
#include <limits.h>
#include "SDL.h"
@@ -655,3 +653,5 @@ SDLTest_TestSuiteReference mouseTestSuite = {
mouseTests,
NULL
};
/* vi: set ts=4 sw=4 expandtab: */
+2 -3
View File
@@ -1,9 +1,6 @@
/**
* Pixels test suite
*/
#include <stdio.h>
#include "SDL.h"
#include "SDL_test.h"
@@ -424,3 +421,5 @@ SDLTest_TestSuiteReference pixelsTestSuite = {
pixelsTests,
NULL
};
/* vi: set ts=4 sw=4 expandtab: */
+2 -3
View File
@@ -2,9 +2,6 @@
* Original code: automated SDL platform test written by Edgar Simo "bobbens"
* Extended and updated by aschiffler at ferzkopp dot net
*/
#include <stdio.h>
#include "SDL.h"
#include "SDL_test.h"
@@ -604,3 +601,5 @@ SDLTest_TestSuiteReference platformTestSuite = {
platformTests,
NULL
};
/* vi: set ts=4 sw=4 expandtab: */
+2 -3
View File
@@ -2,9 +2,6 @@
* Original code: automated SDL rect test written by Edgar Simo "bobbens"
* New/updated tests: aschiffler at ferzkopp dot net
*/
#include <stdio.h>
#include "SDL.h"
#include "SDL_test.h"
@@ -1790,3 +1787,5 @@ SDLTest_TestSuiteReference rectTestSuite = {
rectTests,
NULL
};
/* vi: set ts=4 sw=4 expandtab: */
+2 -3
View File
@@ -2,9 +2,6 @@
* Original code: automated SDL platform test written by Edgar Simo "bobbens"
* Extended and extensively updated by aschiffler at ferzkopp dot net
*/
#include <stdio.h>
#include "SDL.h"
#include "SDL_test.h"
@@ -1102,3 +1099,5 @@ SDLTest_TestSuiteReference renderTestSuite = {
renderTests,
CleanupDestroyRenderer
};
/* vi: set ts=4 sw=4 expandtab: */
+2
View File
@@ -644,3 +644,5 @@ SDLTest_TestSuiteReference rwopsTestSuite = {
rwopsTests,
RWopsTearDown
};
/* vi: set ts=4 sw=4 expandtab: */
+2 -14
View File
@@ -3,21 +3,7 @@
*/
#include <limits.h>
/* Visual Studio 2008 doesn't have stdint.h */
#if defined(_MSC_VER) && _MSC_VER <= 1500
#define UINT8_MAX _UI8_MAX
#define UINT16_MAX _UI16_MAX
#define UINT32_MAX _UI32_MAX
#define INT64_MIN _I64_MIN
#define INT64_MAX _I64_MAX
#define UINT64_MAX _UI64_MAX
#else
#include <stdint.h>
#endif
#include <stdio.h>
#include <float.h>
#include <ctype.h>
#include "SDL.h"
#include "SDL_test.h"
@@ -1316,3 +1302,5 @@ SDLTest_TestSuiteReference sdltestTestSuite = {
sdltestTests,
NULL
};
/* vi: set ts=4 sw=4 expandtab: */
+2 -3
View File
@@ -1,9 +1,6 @@
/**
* Standard C library routine test suite
*/
#include <stdio.h>
#include "SDL.h"
#include "SDL_test.h"
@@ -599,3 +596,5 @@ SDLTest_TestSuiteReference stdlibTestSuite = {
stdlibTests,
NULL
};
/* vi: set ts=4 sw=4 expandtab: */
+2
View File
@@ -824,3 +824,5 @@ SDLTest_TestSuiteReference surfaceTestSuite = {
_surfaceTearDown
};
/* vi: set ts=4 sw=4 expandtab: */
+2 -3
View File
@@ -1,9 +1,6 @@
/**
* SysWM test suite
*/
#include <stdio.h>
#include "SDL.h"
#include "SDL_syswm.h"
#include "SDL_test.h"
@@ -56,3 +53,5 @@ SDLTest_TestSuiteReference syswmTestSuite = {
syswmTests,
NULL
};
/* vi: set ts=4 sw=4 expandtab: */
+2 -3
View File
@@ -1,9 +1,6 @@
/**
* Timer test suite
*/
#include <stdio.h>
#include "SDL.h"
#include "SDL_test.h"
@@ -199,3 +196,5 @@ SDLTest_TestSuiteReference timerTestSuite = {
timerTests,
NULL
};
/* vi: set ts=4 sw=4 expandtab: */
+2 -14
View File
@@ -1,20 +1,6 @@
/**
* Video test suite
*/
#include <stdio.h>
#include <string.h>
/* Visual Studio 2008 doesn't have stdint.h */
#if defined(_MSC_VER) && _MSC_VER <= 1500
#define UINT8_MAX ~(Uint8)0
#define UINT16_MAX ~(Uint16)0
#define UINT32_MAX ~(Uint32)0
#define UINT64_MAX ~(Uint64)0
#else
#include <stdint.h>
#endif
#include "SDL.h"
#include "SDL_test.h"
@@ -1917,3 +1903,5 @@ SDLTest_TestSuiteReference videoTestSuite = {
videoTests,
NULL
};
/* vi: set ts=4 sw=4 expandtab: */
-1
View File
@@ -37,4 +37,3 @@ int main(int argc, char **argv)
}
/* vi: set ts=4 sw=4 expandtab: */
-2
View File
@@ -9,9 +9,7 @@
including commercial applications, and to alter it and redistribute it
freely.
*/
#include <stdlib.h>
#include <stdio.h>
#ifdef __EMSCRIPTEN__
#include <emscripten/emscripten.h>
+2 -4
View File
@@ -12,11 +12,10 @@
/* Program to test querying of display info */
#include "SDL.h"
#include <stdio.h>
#include <stdlib.h>
#include "SDL.h"
static void
print_mode(const char *prefix, const SDL_DisplayMode *mode)
{
@@ -93,4 +92,3 @@ main(int argc, char *argv[])
}
/* vi: set ts=4 sw=4 expandtab: */
-1
View File
@@ -13,7 +13,6 @@
/* Simple program: draw as many random objects on the screen as possible */
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#ifdef __EMSCRIPTEN__
+1 -3
View File
@@ -14,9 +14,6 @@
/* Sample program: Draw a Chess Board by using SDL_CreateSoftwareRenderer API */
#include <stdlib.h>
#include <stdio.h>
#ifdef __EMSCRIPTEN__
#include <emscripten/emscripten.h>
#endif
@@ -145,3 +142,4 @@ main(int argc, char *argv[])
return 0;
}
/* vi: set ts=4 sw=4 expandtab: */
-1
View File
@@ -11,7 +11,6 @@
*/
#include <stdlib.h>
#include <stdio.h>
#include "SDL_test_common.h"
+2 -1
View File
@@ -12,7 +12,6 @@
/* Simple test of the SDL threading code and error handling */
#include <stdio.h>
#include <stdlib.h>
#include "SDL.h"
@@ -80,3 +79,5 @@ main(int argc, char *argv[])
SDL_Quit();
return (0);
}
/* vi: set ts=4 sw=4 expandtab: */
+3
View File
@@ -18,6 +18,7 @@
static int run_test(void);
/* FIXME: Need CMake tests for this */
#if HAVE_LIBUDEV_H || defined(SDL_JOYSTICK_LINUX)
#include <stdint.h>
@@ -1039,3 +1040,5 @@ main(int argc, char *argv[])
{
return run_test() ? 0 : 1;
}
/* vi: set ts=4 sw=4 expandtab: */
+3 -2
View File
@@ -15,6 +15,7 @@
/* quiet windows compiler warnings */
#define _CRT_NONSTDC_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>
#ifndef _MSC_VER
@@ -24,8 +25,6 @@
#include "SDL.h"
#include <stdio.h>
/* WARNING ! those 2 files will be destroyed by this test program */
#ifdef __IOS__
@@ -281,3 +280,5 @@ main(int argc, char *argv[])
cleanup();
return 0; /* all ok */
}
/* vi: set ts=4 sw=4 expandtab: */
+2 -1
View File
@@ -11,7 +11,6 @@
*/
/* Simple test of filesystem functions. */
#include <stdio.h>
#include "SDL.h"
int
@@ -58,3 +57,5 @@ main(int argc, char *argv[])
SDL_Quit();
return 0;
}
/* vi: set ts=4 sw=4 expandtab: */
-17
View File
@@ -12,10 +12,6 @@
/* Simple program to test the SDL game controller routines */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "SDL.h"
#include "testutils.h"
@@ -23,8 +19,6 @@
#include <emscripten/emscripten.h>
#endif
#ifndef SDL_JOYSTICK_DISABLED
#define SCREEN_WIDTH 512
#define SCREEN_HEIGHT 320
@@ -962,15 +956,4 @@ main(int argc, char *argv[])
return 0;
}
#else
int
main(int argc, char *argv[])
{
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "SDL compiled without Joystick support.\n");
return 1;
}
#endif
/* vi: set ts=4 sw=4 expandtab: */
-1
View File
@@ -13,7 +13,6 @@
/* Simple program: draw a RGB triangle, with texture */
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#ifdef __EMSCRIPTEN__
+3 -1
View File
@@ -16,9 +16,10 @@
* l to load all touches from "./gestureSave"
*/
#include "SDL.h"
#include <stdlib.h> /* for exit() */
#include "SDL.h"
#ifdef __EMSCRIPTEN__
#include <emscripten/emscripten.h>
#endif
@@ -298,3 +299,4 @@ int main(int argc, char* argv[])
return 0;
}
/* vi: set ts=4 sw=4 expandtab: */
+4 -5
View File
@@ -9,15 +9,12 @@
including commercial applications, and to alter it and redistribute it
freely.
*/
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <math.h>
#include "SDL_test_common.h"
#ifdef HAVE_OPENGL
#include <stdlib.h>
#include "SDL_opengl.h"
typedef struct GL_Context
@@ -432,3 +429,5 @@ main(int argc, char *argv[])
}
#endif /* HAVE_OPENGL */
/* vi: set ts=4 sw=4 expandtab: */
-3
View File
@@ -10,9 +10,6 @@
freely.
*/
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <math.h>
#include "SDL_test_common.h"
-7
View File
@@ -10,9 +10,6 @@
freely.
*/
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <math.h>
#ifdef __EMSCRIPTEN__
#include <emscripten/emscripten.h>
@@ -21,10 +18,8 @@
#include "SDL_test_common.h"
#if defined(__IOS__) || defined(__ANDROID__) || defined(__EMSCRIPTEN__) || defined(__WINDOWS__) || defined(__LINUX__)
#ifndef HAVE_OPENGLES2
#define HAVE_OPENGLES2
#endif
#endif
#ifdef HAVE_OPENGLES2
@@ -240,7 +235,6 @@ process_shader(GLuint *shader, const char * source, GLint shader_type)
ctx.glGetShaderInfoLog(*shader, sizeof(buffer), &length, &buffer[0]);
buffer[length] = '\0';
SDL_Log("Shader compilation failed: %s", buffer);
fflush(stderr);
quit(-1);
}
}
@@ -261,7 +255,6 @@ link_program(struct shader_data *data)
ctx.glGetProgramInfoLog(data->shader_program, sizeof(buffer), &length, &buffer[0]);
buffer[length] = '\0';
SDL_Log("Program linking failed: %s", buffer);
fflush(stderr);
quit(-1);
}
}
-3
View File
@@ -10,9 +10,6 @@
freely.
*/
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <math.h>
#ifdef __EMSCRIPTEN__
#include <emscripten/emscripten.h>
+3 -12
View File
@@ -14,9 +14,9 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
/*
* includes
*/
#include "SDL.h"
#include <stdlib.h>
#ifndef SDL_HAPTIC_DISABLED
#include "SDL.h"
static SDL_Haptic *haptic;
@@ -353,13 +353,4 @@ HapticPrintSupported(SDL_Haptic * ptr)
SDL_Log(" status\n");
}
#else
int
main(int argc, char *argv[])
{
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "SDL compiled without Haptic support.\n");
return 1;
}
#endif
/* vi: set ts=4 sw=4 expandtab: */

Some files were not shown because too many files have changed in this diff Show More