test: build testsprite as c++ application

This commit is contained in:
Anonymous Maarten
2026-05-15 02:35:10 +02:00
committed by Anonymous Maarten
parent bd146867e4
commit d1d54b8c56
3 changed files with 21 additions and 3 deletions

View File

@@ -13,10 +13,16 @@ set(SDL3_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/..")
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/../cmake")
include(CheckIncludeFile)
include(CheckLanguage)
include(CheckStructHasMember)
include(CMakePushCheckState)
include(sdlcompilers)
check_language(CXX)
if(CMAKE_CXX_COMPILER)
enable_language(CXX)
endif()
find_package(Python3 COMPONENTS Interpreter)
if(NOT PYTHON3_EXECUTABLE)
set(PYTHON3_EXECUTABLE "python3")
@@ -449,6 +455,9 @@ add_sdl_test_executable(testsoftwaretransparent SOURCES testsoftwaretransparent.
add_sdl_test_executable(testsprite MAIN_CALLBACKS NEEDS_RESOURCES TESTUTILS SOURCES testsprite.c NAME83 sprite)
add_sdl_test_executable(testspriteminimal SOURCES testspriteminimal.c ${icon_png_header} DEPENDS generate-icon_png_header NAME83 spritmin)
add_sdl_test_executable(testspritesurface SOURCES testspritesurface.c ${icon_png_header} DEPENDS generate-icon_png_header NAME83 spritsrf)
if(CMAKE_CXX_COMPILER)
add_sdl_test_executable(testspritecxx MAIN_CALLBACKS NEEDS_RESOURCES TESTUTILS SOURCES testsprite.cpp NAME83 spritexx)
endif()
add_sdl_test_executable(testpalette SOURCES testpalette.c NAME83 palette)
add_sdl_test_executable(testtimer NONINTERACTIVE NONINTERACTIVE_ARGS --no-interactive NONINTERACTIVE_TIMEOUT 60 SOURCES testtimer.c NAME83 timer)
add_sdl_test_executable(testurl SOURCES testurl.c NAME83 url)

1
test/testsprite.cpp Normal file
View File

@@ -0,0 +1 @@
#include "testsprite.c"

View File

@@ -16,8 +16,16 @@
#include <SDL3/SDL.h>
SDL_Texture *LoadTexture(SDL_Renderer *renderer, const char *file, bool transparent);
char *GetNearbyFilename(const char *file);
char *GetResourceFilename(const char *user_specified, const char *def);
#ifdef __cplusplus
extern "C" {
#endif
extern SDL_Texture *LoadTexture(SDL_Renderer *renderer, const char *file, bool transparent);
extern char *GetNearbyFilename(const char *file);
extern char *GetResourceFilename(const char *user_specified, const char *def);
#ifdef __cplusplus
}
#endif
#endif