CMakeLists.txt
author Ozkan Sezer
Tue, 17 Dec 2019 21:56:50 +0300
changeset 1091 8a09f3c0c340
parent 1050 300088719593
permissions -rw-r--r--
add patch note for Mix_MusicDuration addition
     1 cmake_minimum_required(VERSION 2.8.11)
     2 project(SDL_mixer C)
     3 
     4 
     5 if (ANDROID)
     6 
     7     # FIXME: missing CMakeLists.txt for MPG123
     8     set(SUPPORT_MP3_MPG123 OFF CACHE BOOL "" FORCE)
     9 
    10     option(SUPPORT_FLAC "Support loading FLAC music with libFLAC" OFF)
    11     option(SUPPORT_OGG "Support loading OGG Vorbis music via Tremor" OFF)
    12     option(SUPPORT_MP3_MPG123 "Support loading MP3 music via MPG123" OFF)
    13     option(SUPPORT_MOD_MODPLUG "Support loading MOD music via modplug" OFF)
    14     option(SUPPORT_MID_TIMIDITY "Support TiMidity" OFF)
    15 
    16     include_directories(include src src/codecs)
    17 
    18     add_library(SDL2_mixer SHARED)
    19 
    20     target_sources(SDL2_mixer PRIVATE
    21             src/effect_position.c src/effects_internal.c src/effect_stereoreverse.c
    22             src/mixer.c src/music.c src/compat.c
    23             src/codecs/load_aiff.c src/codecs/load_voc.c
    24             src/codecs/music_cmd.c src/codecs/music_flac.c
    25             src/codecs/music_fluidsynth.c src/codecs/music_mad.c
    26             src/codecs/music_mikmod.c src/codecs/music_modplug.c
    27             src/codecs/music_mpg123.c src/codecs/music_nativemidi.c
    28             src/codecs/music_ogg.c src/codecs/music_opus.c
    29             src/codecs/music_timidity.c src/codecs/music_wav.c)
    30 
    31     if (SUPPORT_FLAC)
    32         add_definitions(-DMUSIC_FLAC)
    33         add_subdirectory(external/flac-1.3.3)
    34         include_directories(external/flac-1.3.3/include)
    35         target_link_libraries(SDL2_mixer PRIVATE FLAC)
    36     endif()
    37 
    38     if (SUPPORT_OGG)
    39         add_definitions(-DMUSIC_OGG -DOGG_USE_TREMOR -DOGG_HEADER=<ivorbisfile.h>)
    40         add_subdirectory(external/libogg-1.3.2)
    41         add_subdirectory(external/libvorbisidec-1.2.1)
    42         include_directories(external/libvorbisidec-1.2.1)
    43         target_link_libraries(SDL2_mixer PRIVATE vorbisfile vorbisidec ogg)
    44     endif()
    45 
    46     if (SUPPORT_MP3_MPG123)
    47         add_definitions(-DMUSIC_MP3_MPG123)
    48         add_subdirectory(external/mpg123-1.25.13)
    49         target_link_libraries(SDL2_mixer PRIVATE mpg123)
    50     endif()
    51 
    52     if (SUPPORT_MOD_MODPLUG)
    53         add_definitions(-DMUSIC_MOD_MODPLUG -DMODPLUG_HEADER=<modplug.h>)
    54         add_subdirectory(external/libmodplug-0.8.9.0)
    55         include_directories(external/libmodplug-0.8.9.0/src)
    56         target_link_libraries(SDL2_mixer PRIVATE modplug)
    57     endif()
    58 
    59     if (SUPPORT_MID_TIMIDITY)
    60         add_definitions(-DMUSIC_MID_TIMIDITY)
    61         add_subdirectory(timidity)
    62         target_link_libraries(SDL2_mixer PRIVATE timidity)
    63     endif()
    64 
    65     target_include_directories(SDL2_mixer PUBLIC .)
    66     target_link_libraries(SDL2_mixer PRIVATE SDL2)
    67 else()
    68 
    69 endif()