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