speed-dreams-code/packaging/3rdParty-devel/patches/sdl2_mixer-2.0.4.CMakeLists.txt
beaglejoe dc4a08667a Add sdl2_mixer-2.0.4
git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@7629 30fe4595-0a0c-4342-8851-515496e4dcbd

Former-commit-id: 50715b0bcc7be0097c184053f34545c70ecb776c
Former-commit-id: 16fe4de17268b369f32c3dd51dcb97c916b7fadf
2021-08-21 13:00:42 +00:00

96 lines
3.2 KiB
Text

cmake_minimum_required(VERSION 3.1.0)
project(SDL_mixer C)
# FIXME: missing CMakeLists.txt for MPG123
set(SUPPORT_MP3_MPG123 OFF CACHE BOOL "" FORCE)
option(SUPPORT_FLAC "Support loading FLAC music with libFLAC" OFF)
option(SUPPORT_OGG "Support loading OGG Vorbis music via Tremor" OFF)
option(SUPPORT_MP3_MPG123 "Support loading MP3 music via MPG123" OFF)
option(SUPPORT_MOD_MODPLUG "Support loading MOD music via modplug" OFF)
option(SUPPORT_MID_TIMIDITY "Support TiMidity" OFF)
#include_directories(include src src/codecs)
add_library(SDL2_mixer SHARED)
target_sources(SDL2_mixer PRIVATE
effect_position.c effects_internal.c effect_stereoreverse.c
mixer.c music.c
load_aiff.c load_voc.c
music_cmd.c music_flac.c
music_fluidsynth.c music_mad.c
music_mikmod.c music_modplug.c
music_mpg123.c music_nativemidi.c
music_ogg.c music_opus.c
music_timidity.c music_wav.c)
if (ANDROID)
if (SUPPORT_FLAC)
add_definitions(-DMUSIC_FLAC)
add_subdirectory(external/flac-1.3.3)
include_directories(external/flac-1.3.3/include)
target_link_libraries(SDL2_mixer PRIVATE FLAC)
endif()
if (SUPPORT_OGG)
add_definitions(-DMUSIC_OGG -DOGG_USE_TREMOR -DOGG_HEADER=<ivorbisfile.h>)
add_subdirectory(external/libogg-1.3.2)
add_subdirectory(external/libvorbisidec-1.2.1)
include_directories(external/libvorbisidec-1.2.1)
target_link_libraries(SDL2_mixer PRIVATE vorbisidec ogg)
endif()
if (SUPPORT_MP3_MPG123)
add_definitions(-DMUSIC_MP3_MPG123)
add_subdirectory(external/mpg123-1.25.13)
target_link_libraries(SDL2_mixer PRIVATE mpg123)
endif()
if (SUPPORT_MOD_MODPLUG)
add_definitions(-DMUSIC_MOD_MODPLUG -DMODPLUG_HEADER=<modplug.h>)
add_subdirectory(external/libmodplug-0.8.9.0)
include_directories(external/libmodplug-0.8.9.0/src)
target_link_libraries(SDL2_mixer PRIVATE modplug)
endif()
if (SUPPORT_MID_TIMIDITY)
add_definitions(-DMUSIC_MID_TIMIDITY)
add_subdirectory(timidity)
target_link_libraries(SDL2_mixer PRIVATE timidity)
endif()
target_include_directories(SDL2_mixer PUBLIC include)
target_link_libraries(SDL2_mixer PRIVATE SDL2)
else()
Find_Package(SDL2 REQUIRED)
if (SUPPORT_OGG)
Find_Package(OGG REQUIRED)
Find_Package(VORBIS REQUIRED)
#add_definitions(-DMUSIC_OGG -DOGG_USE_TREMOR -DOGG_HEADER=<ivorbisfile.h>)
#add_definitions(-DMUSIC_OGG -DOGG_HEADER=<vorbis/vorbisfile.h>)
add_definitions(-DMUSIC_OGG)
target_link_libraries(SDL2_mixer PUBLIC Vorbis::vorbis Vorbis::vorbisenc Vorbis::vorbisfile Ogg::ogg)
endif()
if (WIN32)
add_definitions(-DDLL_EXPORT)
target_sources(SDL2_mixer PRIVATE version.rc)
endif()
target_include_directories(SDL2_mixer PUBLIC include)
target_link_libraries(SDL2_mixer PUBLIC SDL2::SDL2)
install(FILES SDL_mixer.h
DESTINATION include)
install(TARGETS SDL2_mixer
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib)
endif()