CMakeLists.txt
author Sylvain Becker
Tue, 13 Aug 2019 15:51:57 +0200
changeset 933 8b275092fdbb
child 934 c251a3a6a2df
permissions -rw-r--r--
Android: add compilation with cmake (see bug 3918)
     1 cmake_minimum_required(VERSION 3.0)
     2 project(SDL_mixer C)
     3 
     4 
     5 if (ANDROID)
     6 
     7     # FIXME: there are missing CMakeLists.txt 
     8     option(SUPPORT_FLAC "Support loading FLAC music with libFLAC" OFF)
     9     option(SUPPORT_OGG "Support loading OGG Vorbis music via Tremor" OFF)
    10     option(SUPPORT_MP3_MPG123 "Support loading MP3 music via MPG123" OFF)
    11     option(SUPPORT_MOD_MODPLUG "Support loading MOD music via modplug" OFF)
    12     option(SUPPORT_MID_TIMIDITY "Support TiMidity" OFF)
    13 
    14     add_library(SDL_mixer SHARED)
    15 
    16     target_sources(SDL_mixer PRIVATE
    17             effect_position.c effects_internal.c
    18             effect_stereoreverse.c load_aiff.c load_voc.c mixer.c music.c
    19             music_cmd.c music_flac.c music_fluidsynth.c music_mad.c
    20             music_mikmod.c music_modplug.c music_mpg123.c music_nativemidi.c
    21             music_ogg.c music_opus.c music_timidity.c music_wav.c)
    22 
    23     if (SUPPORT_FLAC)
    24         add_definitions(-DMUSIC_FLAC)
    25         add_subdirectory(external/flac-1.3.2)
    26         target_link_libraries(SDL_mixer PRIVATE libFLAC)
    27     endif()
    28 
    29     if (SUPPORT_OGG)
    30         add_definitions(-DMUSIC_OGG -DOGG_USE_TREMOR -DOGG_HEADER="<ivorbisfile.h>")
    31         add_subdirectory(external/libogg-1.3.2)
    32         add_subdirectory(external/libvorbisidec-1.2.1)
    33         target_link_libraries(SDL_mixer PRIVATE ogg vorbisidec)
    34     endif()
    35 
    36     if (SUPPORT_MP3_MPG123)
    37         add_definitions(-DMUSIC_MP3_MPG123)
    38         add_subdirectory(external/mpg123-1.25.6)
    39         target_link_libraries(SDL_mixer PRIVATE mpg123)
    40     endif()
    41 
    42     if (SUPPORT_MOD_MODPLUG)
    43         add_definitions(-DMUSIC_MOD_MODPLUG -DMODPLUG_HEADER="<modplug.h>")
    44         add_subdirectory(external/libmodplug-0.8.9.0)
    45         target_link_libraries(SDL_mixer PRIVATE modplug)
    46     endif()
    47 
    48     if (SUPPORT_MID_TIMIDITY)
    49         add_definitions(-DMUSIC_MID_TIMIDITY)
    50         add_subdirectory(timidity)
    51         target_link_libraries(SDL_mixer PRIVATE timidity)
    52     endif()
    53 
    54     target_link_libraries(SDL_mixer PRIVATE SDL2)
    55 else()
    56 
    57 endif()