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