File tree Expand file tree Collapse file tree 3 files changed +46
-0
lines changed Expand file tree Collapse file tree 3 files changed +46
-0
lines changed Original file line number Diff line number Diff line change @@ -116,6 +116,8 @@ jobs:
116116 -DSDLMIXER_VORBIS_VORBISFILE=ON \
117117 -DSDLMIXER_STRICT=ON \
118118 -DSDLMIXER_WERROR=ON \
119+ -DSDLMIXER_TESTS=ON \
120+ -DSDLMIXER_TESTS_INSTALL=ON \
119121 -DSDLMIXER_INSTALL_MAN=ON \
120122 -DCMAKE_INSTALL_PREFIX=prefix_cmake \
121123 ${NULL+}
Original file line number Diff line number Diff line change @@ -120,6 +120,9 @@ if(SDLMIXER_STRICT)
120120 set (fatal_error "FATAL_ERROR" )
121121endif ()
122122
123+ option (SDLMIXER_TESTS "Build unit tests?" OFF )
124+ option (SDLMIXER_TESTS_INSTALL "Install unit tests?" OFF )
125+
123126option (SDLMIXER_SAMPLES "Build the SDL3_mixer sample program(s)" ${SDLMIXER_SAMPLES_DEFAULT} )
124127cmake_dependent_option (SDLMIXER_SAMPLES_INSTALL "Install the SDL3_mixer sample program(s)" OFF "SDLMIXER_SAMPLES;SDLMIXER_INSTALL" OFF )
125128
@@ -1153,6 +1156,10 @@ if(SDLMIXER_SAMPLES)
11531156 add_sdl_mixer_example_executable (playwave examples/playwave.c )
11541157endif ()
11551158
1159+ if (SDLMIXER_TESTS )
1160+ add_subdirectory (test )
1161+ endif ()
1162+
11561163set (available_deps )
11571164set (unavailable_deps )
11581165foreach (dep IN LISTS SDLMIXER_BACKENDS )
Original file line number Diff line number Diff line change 1+ # CMake script for building SDL_mixer tests
2+
3+ set (CMAKE_POSITION_INDEPENDENT_CODE OFF )
4+
5+ set (RESOURCE_FILES
6+ )
7+
8+ function (add_sdl_mixer_test_executable TARGET )
9+ add_executable (${TARGET} ${ARGN} )
10+ target_compile_definitions (${TARGET}
11+ PRIVATE
12+ $< TARGET_PROPERTY:${sdl3_mixer_target_name} ,COMPILE_DEFINITIONS>
13+ )
14+ sdl_add_warning_options (${TARGET} WARNING_AS_ERROR ${SDLMIXER_WERROR} )
15+ target_link_libraries (${TARGET} PRIVATE SDL3_mixer::SDL3_mixer SDL3::SDL3 )
16+
17+ if (SDLMIXER_TESTS_INSTALL )
18+ install (
19+ TARGETS ${TARGET}
20+ DESTINATION "${CMAKE_INSTALL_LIBEXECDIR} /installed-tests/${PROJECT_NAME} "
21+ )
22+ if (MSVC )
23+ SDL_install_pdb ("${TARGET} " "${CMAKE_INSTALL_LIBEXECDIR} /installed-tests/${PROJECT_NAME} " )
24+ endif ()
25+ endif ()
26+ endfunction ()
27+
28+ add_sdl_mixer_test_executable (testaudiodecoder testaudiodecoder.c )
29+ add_sdl_mixer_test_executable (testmixer testmixer.c )
30+ add_sdl_mixer_test_executable (testspacialization testspatialization.c )
31+
32+ if (SDLMIXER_TESTS_INSTALL )
33+ install (
34+ FILES ${RESOURCE_FILES}
35+ DESTINATION "${CMAKE_INSTALL_LIBEXECDIR} /installed-tests/${PROJECT_NAME} "
36+ )
37+ endif ()
You can’t perform that action at this time.
0 commit comments