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