diff options
Diffstat (limited to 'contrib/SDL-3.2.8/test/testver.c')
| -rw-r--r-- | contrib/SDL-3.2.8/test/testver.c | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/contrib/SDL-3.2.8/test/testver.c b/contrib/SDL-3.2.8/test/testver.c new file mode 100644 index 0000000..b873038 --- /dev/null +++ b/contrib/SDL-3.2.8/test/testver.c | |||
| @@ -0,0 +1,41 @@ | |||
| 1 | /* | ||
| 2 | Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> | ||
| 3 | |||
| 4 | This software is provided 'as-is', without any express or implied | ||
| 5 | warranty. In no event will the authors be held liable for any damages | ||
| 6 | arising from the use of this software. | ||
| 7 | |||
| 8 | Permission is granted to anyone to use this software for any purpose, | ||
| 9 | including commercial applications, and to alter it and redistribute it | ||
| 10 | freely. | ||
| 11 | */ | ||
| 12 | |||
| 13 | /* Test program to compare the compile-time version of SDL with the linked | ||
| 14 | version of SDL | ||
| 15 | */ | ||
| 16 | #include <SDL3/SDL.h> | ||
| 17 | #include <SDL3/SDL_main.h> | ||
| 18 | #include <SDL3/SDL_revision.h> | ||
| 19 | |||
| 20 | int main(int argc, char *argv[]) | ||
| 21 | { | ||
| 22 | if (argc > 1) { | ||
| 23 | SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "USAGE: %s", argv[0]); | ||
| 24 | return 1; | ||
| 25 | } | ||
| 26 | |||
| 27 | #if SDL_VERSION_ATLEAST(3, 0, 0) | ||
| 28 | SDL_Log("Compiled with SDL 3.0 or newer"); | ||
| 29 | #else | ||
| 30 | SDL_Log("Compiled with SDL older than 3.0"); | ||
| 31 | #endif | ||
| 32 | SDL_Log("Compiled version: %d.%d.%d (%s)", | ||
| 33 | SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_MICRO_VERSION, | ||
| 34 | SDL_REVISION); | ||
| 35 | int version = SDL_GetVersion(); | ||
| 36 | SDL_Log("Runtime version: %d.%d.%d (%s)", | ||
| 37 | SDL_VERSIONNUM_MAJOR(version), SDL_VERSIONNUM_MINOR(version), SDL_VERSIONNUM_MICRO(version), | ||
| 38 | SDL_GetRevision()); | ||
| 39 | SDL_Quit(); | ||
| 40 | return 0; | ||
| 41 | } | ||
