aboutsummaryrefslogtreecommitdiff
path: root/examples/sdl2_mixer/CMakeLists.txt
diff options
context:
space:
mode:
authorWohlstand <admin@wohlnet.ru>2023-03-19 15:29:47 +0300
committerWohlstand <admin@wohlnet.ru>2023-03-19 15:29:47 +0300
commitdeed64ed4732d09a92f5e286982c903101d1dafb (patch)
treed016d52e490cafd955053df45fe47701ad01c006 /examples/sdl2_mixer/CMakeLists.txt
parent0d8ad03297bec4c8ee1f83944003265a2c765bca (diff)
downloadlibADLMIDI-deed64ed4732d09a92f5e286982c903101d1dafb.tar.gz
libADLMIDI-deed64ed4732d09a92f5e286982c903101d1dafb.tar.bz2
libADLMIDI-deed64ed4732d09a92f5e286982c903101d1dafb.zip
Added SDL2 Mixer example over Mix_HookMusic()
Diffstat (limited to 'examples/sdl2_mixer/CMakeLists.txt')
-rw-r--r--examples/sdl2_mixer/CMakeLists.txt48
1 files changed, 48 insertions, 0 deletions
diff --git a/examples/sdl2_mixer/CMakeLists.txt b/examples/sdl2_mixer/CMakeLists.txt
new file mode 100644
index 0000000..caaa4ca
--- /dev/null
+++ b/examples/sdl2_mixer/CMakeLists.txt
@@ -0,0 +1,48 @@
+if(POLICY CMP0111)
+ cmake_policy(SET CMP0111 NEW)
+endif()
+
+find_package(SDL2 REQUIRED)
+find_package(SDL2_MIXER REQUIRED)
+
+add_library(ADLMIDIEXAMPLE_SDL2 INTERFACE)
+
+if(TARGET SDL2_mixer::SDL2_mixer)
+ target_include_directories(ADLMIDIEXAMPLE_SDL2 INTERFACE ${SDL2_MIXER_INCLUDE_DIRS})
+else()
+ string(STRIP ${SDL2_MIXER_LIBRARIES} SDL2_MIXER_LIBRARIES)
+ target_include_directories(ADLMIDIEXAMPLE_SDL2 INTERFACE ${SDL2_MIXER_INCLUDE_DIRS})
+ target_link_libraries(ADLMIDIEXAMPLE_SDL2 INTERFACE ${SDL2_MIXER_LIBRARIES})
+endif()
+
+if(TARGET SDL2::SDL2)
+ if(MINGW)
+ target_link_libraries(ADLMIDIEXAMPLE_SDL2 INTERFACE mingw32 SDL2::SDL2main SDL2::SDL2)
+ else()
+ target_link_libraries(ADLMIDIEXAMPLE_SDL2 INTERFACE SDL2::SDL2)
+ endif()
+ target_include_directories(ADLMIDIEXAMPLE_SDL2 INTERFACE ${SDL2_INCLUDE_DIRS})
+else()
+ string(STRIP ${SDL2_LIBRARIES} SDL2_LIBRARIES)
+ target_include_directories(ADLMIDIEXAMPLE_SDL2 INTERFACE ${SDL2_INCLUDE_DIRS})
+ target_link_libraries(ADLMIDIEXAMPLE_SDL2 INTERFACE ${SDL2_LIBRARIES})
+endif()
+
+add_executable(adlmidi_sdl2_mixer_demo sdl2_mixer_example.c)
+target_link_libraries(adlmidi_sdl2_mixer_demo PRIVATE ADLMIDI ADLMIDIEXAMPLE_SDL2)
+
+set_nopie(adlmidi_sdl2_mixer_demo)
+
+if(NOT MSVC)
+ target_link_libraries(adlmidi_sdl2_mixer_demo PRIVATE pthread)
+endif()
+if(NOT WIN32)
+ target_link_libraries(adlmidi_sdl2_mixer_demo PRIVATE dl m)
+endif()
+
+if(TARGET ADLMIDI_shared)
+ set_target_properties(adlmidi_sdl2_mixer_demo PROPERTIES INSTALL_RPATH "$ORIGIN/../lib")
+endif()
+
+install(TARGETS adlmidi_sdl2_mixer_demo
+ RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}")