Android: cmake compilation of external libs, thanks Vitaly Novichkov (bug 3918)
authorSylvain Becker
Wed, 14 Aug 2019 09:47:18 +0200
changeset 934c251a3a6a2df
parent 933 8b275092fdbb
child 935 c52db177a8bd
Android: cmake compilation of external libs, thanks Vitaly Novichkov (bug 3918)
CMakeLists.txt
external/audio_codec_common.cmake
external/flac-1.3.2/CMakeLists.txt
external/libmodplug-0.8.9.0/CMakeLists.txt
external/libogg-1.3.2/CMakeLists.txt
external/libvorbisidec-1.2.1/CMakeLists.txt
timidity/CMakeLists.txt
     1.1 --- a/CMakeLists.txt	Tue Aug 13 15:51:57 2019 +0200
     1.2 +++ b/CMakeLists.txt	Wed Aug 14 09:47:18 2019 +0200
     1.3 @@ -4,7 +4,10 @@
     1.4  
     1.5  if (ANDROID)
     1.6  
     1.7 -    # FIXME: there are missing CMakeLists.txt 
     1.8 +
     1.9 +    # FIXME: missing CMakeLists.txt for MPG123
    1.10 +    set(SUPPORT_MP3_MPG123 OFF CACHE BOOL "" FORCE)
    1.11 +
    1.12      option(SUPPORT_FLAC "Support loading FLAC music with libFLAC" OFF)
    1.13      option(SUPPORT_OGG "Support loading OGG Vorbis music via Tremor" OFF)
    1.14      option(SUPPORT_MP3_MPG123 "Support loading MP3 music via MPG123" OFF)
    1.15 @@ -23,14 +26,16 @@
    1.16      if (SUPPORT_FLAC)
    1.17          add_definitions(-DMUSIC_FLAC)
    1.18          add_subdirectory(external/flac-1.3.2)
    1.19 -        target_link_libraries(SDL_mixer PRIVATE libFLAC)
    1.20 +        include_directories(external/flac-1.3.2/include)
    1.21 +        target_link_libraries(SDL_mixer PRIVATE FLAC)
    1.22      endif()
    1.23  
    1.24      if (SUPPORT_OGG)
    1.25 -        add_definitions(-DMUSIC_OGG -DOGG_USE_TREMOR -DOGG_HEADER="<ivorbisfile.h>")
    1.26 +        add_definitions(-DMUSIC_OGG -DOGG_USE_TREMOR -DOGG_HEADER=<ivorbisfile.h>)
    1.27          add_subdirectory(external/libogg-1.3.2)
    1.28          add_subdirectory(external/libvorbisidec-1.2.1)
    1.29 -        target_link_libraries(SDL_mixer PRIVATE ogg vorbisidec)
    1.30 +        include_directories(external/libvorbisidec-1.2.1)
    1.31 +        target_link_libraries(SDL_mixer PRIVATE vorbisfile vorbisidec ogg)
    1.32      endif()
    1.33  
    1.34      if (SUPPORT_MP3_MPG123)
    1.35 @@ -40,8 +45,9 @@
    1.36      endif()
    1.37  
    1.38      if (SUPPORT_MOD_MODPLUG)
    1.39 -        add_definitions(-DMUSIC_MOD_MODPLUG -DMODPLUG_HEADER="<modplug.h>")
    1.40 +        add_definitions(-DMUSIC_MOD_MODPLUG -DMODPLUG_HEADER=<modplug.h>)
    1.41          add_subdirectory(external/libmodplug-0.8.9.0)
    1.42 +        include_directories(external/libmodplug-0.8.9.0/src)
    1.43          target_link_libraries(SDL_mixer PRIVATE modplug)
    1.44      endif()
    1.45  
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/external/audio_codec_common.cmake	Wed Aug 14 09:47:18 2019 +0200
     2.3 @@ -0,0 +1,79 @@
     2.4 +# If platform is Emscripten
     2.5 +if(${CMAKE_SYSTEM_NAME} STREQUAL "Emscripten")
     2.6 +    set(EMSCRIPTEN 1)
     2.7 +endif()
     2.8 +
     2.9 +# Strip garbage
    2.10 +if(APPLE)
    2.11 +    string(REGEX REPLACE "-O3" ""
    2.12 +        CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}")
    2.13 +    string(REGEX REPLACE "-O3" ""
    2.14 +        CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}")
    2.15 +    set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -O2")
    2.16 +    set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O2")
    2.17 +    set(LINK_FLAGS_RELEASE  "${LINK_FLAGS_RELEASE} -dead_strip")
    2.18 +elseif(NOT MSVC)
    2.19 +    if(EMSCRIPTEN)
    2.20 +        set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -Os -fdata-sections -ffunction-sections -Wl,--gc-sections -Wl,-s")
    2.21 +        set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -Os -fdata-sections -ffunction-sections -Wl,--gc-sections -Wl,-s")
    2.22 +        set(LINK_FLAGS_RELEASE  "${LINK_FLAGS_RELEASE} -Wl,--gc-sections -Wl,-s")
    2.23 +    else()
    2.24 +        string(REGEX REPLACE "-O3" "" CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}")
    2.25 +        string(REGEX REPLACE "-O3" "" CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}")
    2.26 +        set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -O2 -fdata-sections -ffunction-sections")
    2.27 +        set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O2 -fdata-sections -ffunction-sections")
    2.28 +        if(NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
    2.29 +            set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -s -Wl,--gc-sections -Wl,-s")
    2.30 +            set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -s -Wl,--gc-sections -Wl,-s")
    2.31 +            set(LINK_FLAGS_RELEASE  "${LINK_FLAGS_RELEASE} -Wl,--gc-sections -Wl,-s")
    2.32 +        endif()
    2.33 +    endif()
    2.34 +endif()
    2.35 +
    2.36 +# Global optimization flags
    2.37 +if(NOT MSVC)
    2.38 +    set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -fno-omit-frame-pointer")
    2.39 +    set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -fno-omit-frame-pointer")
    2.40 +endif()
    2.41 +
    2.42 +if(NOT CMAKE_BUILD_TYPE)
    2.43 +    set(CMAKE_BUILD_TYPE "Release")
    2.44 +endif()
    2.45 +
    2.46 +string(TOLOWER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE_LOWER)
    2.47 +
    2.48 +if(CMAKE_BUILD_TYPE_LOWER STREQUAL "release")
    2.49 +    add_definitions(-DNDEBUG)
    2.50 +endif()
    2.51 +
    2.52 +if(MSVC)
    2.53 +    # Force to always compile with W4
    2.54 +    if(CMAKE_CXX_FLAGS MATCHES "/W[0-4]")
    2.55 +        string(REGEX REPLACE "/W[0-4]" "/W4" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
    2.56 +    else()
    2.57 +        set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4")
    2.58 +        set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /W4")
    2.59 +    endif()
    2.60 +elseif(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX)
    2.61 +    # Update if necessary
    2.62 +    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -pedantic")
    2.63 +    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -pedantic")
    2.64 +endif()
    2.65 +
    2.66 +# Disable bogus MSVC warnings
    2.67 +if(MSVC)
    2.68 +    add_definitions(-D_CRT_SECURE_NO_WARNINGS)
    2.69 +endif()
    2.70 +
    2.71 +# -fPIC thing
    2.72 +if(NOT WIN32)
    2.73 +    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC")
    2.74 +    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
    2.75 +endif()
    2.76 +
    2.77 +# Prevent shared libraries has "lib" prefix on Windows DLL files
    2.78 +if(WIN32)
    2.79 +    set(CMAKE_SHARED_LIBRARY_PREFIX "")
    2.80 +endif()
    2.81 +
    2.82 +
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/external/flac-1.3.2/CMakeLists.txt	Wed Aug 14 09:47:18 2019 +0200
     3.3 @@ -0,0 +1,118 @@
     3.4 +cmake_minimum_required(VERSION 3.2)
     3.5 +project(libFLAC VERSION 1.3.2 LANGUAGES C)
     3.6 +
     3.7 +include(CheckIncludeFiles)
     3.8 +include(CheckFunctionExists)
     3.9 +
    3.10 +include(${CMAKE_CURRENT_SOURCE_DIR}/../audio_codec_common.cmake)
    3.11 +
    3.12 +if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX)
    3.13 +    # Turn on warnings and legacy C/C++ standards to support more compilers
    3.14 +    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99 -Wall -Wno-pedantic")
    3.15 +endif()
    3.16 +
    3.17 +if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
    3.18 +    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-shift-negative-value")
    3.19 +endif()
    3.20 +
    3.21 +if(MSVC)
    3.22 +    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4267 /wd4334 /wd4996 /wd4244")
    3.23 +endif()
    3.24 +
    3.25 +add_definitions(
    3.26 +    -DHAVE_CONFIG_H
    3.27 +    -DFLAC__NO_DLL
    3.28 +)
    3.29 +
    3.30 +set(FLAC_VERSION "${libFLAC_VERSION}")
    3.31 +
    3.32 +CHECK_FUNCTION_EXISTS(fseeko HAVE_FSEEKO)
    3.33 +if(HAVE_FSEEKO)
    3.34 +    add_definitions(-DHAVE_FSEEKO)
    3.35 +endif()
    3.36 +
    3.37 +if(WIN32)
    3.38 +    CHECK_FUNCTION_EXISTS(_wutime64 HAFE_WUTIME64)
    3.39 +    try_compile(HAFE_WUTIME64_BUILT
    3.40 +                ${CMAKE_BINARY_DIR}/compile_tests
    3.41 +                ${CMAKE_CURRENT_SOURCE_DIR}/config.tests/wutime64/wutime64_test.c
    3.42 +    )
    3.43 +    if(HAFE_WUTIME64 AND HAFE_WUTIME64_BUILT)
    3.44 +        message("TEST: _wutime64 found and compiling!")
    3.45 +        add_definitions(-DHAFE_WUTIME64)
    3.46 +    else()
    3.47 +        message("TEST: _wutime64 DISABLED: found: [${HAFE_WUTIME64}] compiling: [${HAFE_WUTIME64_BUILT}]")
    3.48 +    endif()
    3.49 +endif()
    3.50 +
    3.51 +set(FLAC_SRC)
    3.52 +
    3.53 +list(APPEND FLAC_SRC
    3.54 +    src/libFLAC/bitmath.c
    3.55 +    src/libFLAC/bitreader.c
    3.56 +    src/libFLAC/bitwriter.c
    3.57 +    src/libFLAC/cpu.c
    3.58 +    src/libFLAC/crc.c
    3.59 +    src/libFLAC/fixed.c
    3.60 +    src/libFLAC/format.c
    3.61 +    src/libFLAC/lpc.c
    3.62 +    src/libFLAC/md5.c
    3.63 +    src/libFLAC/memory.c
    3.64 +    src/libFLAC/metadata_iterators.c
    3.65 +    src/libFLAC/metadata_object.c
    3.66 +    src/libFLAC/ogg_decoder_aspect.c
    3.67 +    src/libFLAC/ogg_encoder_aspect.c
    3.68 +    src/libFLAC/ogg_helper.c
    3.69 +    src/libFLAC/ogg_mapping.c
    3.70 +    src/libFLAC/stream_decoder.c
    3.71 +    src/libFLAC/stream_encoder.c
    3.72 +    src/libFLAC/stream_encoder_framing.c
    3.73 +    src/libFLAC/window.c
    3.74 +)
    3.75 +
    3.76 +if(WIN32)
    3.77 +    add_definitions(-DUNICODE -D_UNICODE)
    3.78 +    list(APPEND FLAC_SRC
    3.79 +        src/share/win_utf8_io/win_utf8_io.c
    3.80 +        src/libFLAC/windows_unicode_filenames.c
    3.81 +    )
    3.82 +endif()
    3.83 +
    3.84 +add_library(FLAC STATIC
    3.85 +    ${FLAC_SRC}
    3.86 +)
    3.87 +
    3.88 +target_include_directories(FLAC PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include)
    3.89 +target_compile_definitions(FLAC PRIVATE
    3.90 +    -DVERSION="${FLAC_VERSION}"
    3.91 +    -DPACKAGE_VERSION="${FLAC_VERSION}"
    3.92 +)
    3.93 +target_include_directories(FLAC PUBLIC
    3.94 +    ${CMAKE_CURRENT_SOURCE_DIR}/../libogg-1.3.2/include
    3.95 +    ${CMAKE_CURRENT_SOURCE_DIR}/../libogg-1.3.2/android
    3.96 +)
    3.97 +target_include_directories(FLAC PRIVATE
    3.98 +    ${CMAKE_CURRENT_SOURCE_DIR}/include
    3.99 +    ${CMAKE_CURRENT_SOURCE_DIR}/include_p
   3.100 +    ${CMAKE_CURRENT_SOURCE_DIR}/src/libFLAC
   3.101 +    ${CMAKE_CURRENT_SOURCE_DIR}/src/libFLAC/include
   3.102 +    ${CMAKE_CURRENT_SOURCE_DIR}/android
   3.103 +)
   3.104 +
   3.105 +install(TARGETS FLAC
   3.106 +        LIBRARY DESTINATION "lib"
   3.107 +        ARCHIVE DESTINATION "lib"
   3.108 +        INCLUDES DESTINATION "include")
   3.109 +
   3.110 +install(FILES
   3.111 +        include/FLAC/all.h
   3.112 +        include/FLAC/assert.h
   3.113 +        include/FLAC/callback.h
   3.114 +        include/FLAC/export.h
   3.115 +        include/FLAC/format.h
   3.116 +        include/FLAC/metadata.h
   3.117 +        include/FLAC/ordinals.h
   3.118 +        include/FLAC/stream_decoder.h
   3.119 +        include/FLAC/stream_encoder.h
   3.120 +        DESTINATION include/FLAC/)
   3.121 +
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/external/libmodplug-0.8.9.0/CMakeLists.txt	Wed Aug 14 09:47:18 2019 +0200
     4.3 @@ -0,0 +1,104 @@
     4.4 +cmake_minimum_required(VERSION 3.2)
     4.5 +project(libModPlug VERSION 0.8.9.0 LANGUAGES CXX)
     4.6 +
     4.7 +include(CheckFunctionExists)
     4.8 +include(CheckIncludeFile)
     4.9 +include(${CMAKE_CURRENT_SOURCE_DIR}/../audio_codec_common.cmake)
    4.10 +
    4.11 +if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX)
    4.12 +    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -pedantic -std=gnu99")
    4.13 +    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wno-pedantic -std=gnu++98 -Wno-sequence-point")
    4.14 +    if(NOT APPLE)
    4.15 +        set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-but-set-variable")
    4.16 +    endif()
    4.17 +endif()
    4.18 +
    4.19 +if(MSVC)
    4.20 +    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4100 /wd4244 /wd4267 /wd4996 /wd4702 /wd4706 /wd4456")
    4.21 +endif()
    4.22 +
    4.23 +add_definitions(
    4.24 +    #-DMODPLUG_NO_FILESAVE
    4.25 +    #-DNO_MIDIFORMATS
    4.26 +    #-DNO_WAVFORMAT
    4.27 +    -DHAVE_CONFIG_H
    4.28 +    -DHAVE_CMAKE_CONFIG_H
    4.29 +    -DMODPLUG_STATIC
    4.30 +    -DMODPLUG_BUILD=1
    4.31 +    -D_REENTRANT
    4.32 +    -D_USE_MATH_DEFINES
    4.33 +)
    4.34 +
    4.35 +foreach(_FN
    4.36 +        setenv putenv
    4.37 +        )
    4.38 +    string(TOUPPER ${_FN} _UPPER)
    4.39 +    set(_HAVEVAR "HAVE_${_UPPER}")
    4.40 +    CHECK_FUNCTION_EXISTS("${_FN}" ${_HAVEVAR})
    4.41 +endforeach()
    4.42 +
    4.43 +CHECK_INCLUDE_FILE("malloc.h" HAVE_MALLOC_H)
    4.44 +CHECK_INCLUDE_FILE("memory.h" HAVE_MEMORY_H)
    4.45 +CHECK_INCLUDE_FILE("inttypes.h" HAVE_INTTYPES_H)
    4.46 +
    4.47 +CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/src/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config/config.h)
    4.48 +include_directories(${CMAKE_CURRENT_BINARY_DIR}/config/)
    4.49 +
    4.50 +add_library(modplug STATIC
    4.51 +    src/fastmix.cpp
    4.52 +    src/load_669.cpp
    4.53 +    src/load_abc.cpp
    4.54 +    src/load_amf.cpp
    4.55 +    src/load_ams.cpp
    4.56 +    src/load_dbm.cpp
    4.57 +    src/load_dmf.cpp
    4.58 +    src/load_dsm.cpp
    4.59 +    src/load_far.cpp
    4.60 +    src/load_it.cpp
    4.61 +    # src/load_j2b.cpp
    4.62 +    src/load_mdl.cpp
    4.63 +    src/load_med.cpp
    4.64 +    #src/load_mid.cpp
    4.65 +    src/load_mod.cpp
    4.66 +    src/load_mt2.cpp
    4.67 +    src/load_mtm.cpp
    4.68 +    src/load_okt.cpp
    4.69 +    src/load_pat.cpp
    4.70 +    src/load_psm.cpp
    4.71 +    src/load_ptm.cpp
    4.72 +    src/load_s3m.cpp
    4.73 +    src/load_stm.cpp
    4.74 +    src/load_ult.cpp
    4.75 +    src/load_umx.cpp
    4.76 +    #src/load_wav.cpp
    4.77 +    src/load_xm.cpp
    4.78 +    src/mmcmp.cpp
    4.79 +    src/modplug.cpp
    4.80 +    src/snd_dsp.cpp
    4.81 +    src/snd_flt.cpp
    4.82 +    src/snd_fx.cpp
    4.83 +    src/sndfile.cpp
    4.84 +    src/sndmix.cpp
    4.85 +)
    4.86 +
    4.87 +# include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include_p)
    4.88 +# include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src)
    4.89 +# include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../libogg/include)
    4.90 +
    4.91 +target_include_directories(modplug PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include)
    4.92 +target_include_directories(modplug PRIVATE
    4.93 +        ${CMAKE_CURRENT_SOURCE_DIR}/include/libmodplug
    4.94 +        ${CMAKE_CURRENT_SOURCE_DIR}/src
    4.95 +        ${CMAKE_CURRENT_SOURCE_DIR}/src/libmodplug
    4.96 +)
    4.97 +
    4.98 +install(TARGETS modplug
    4.99 +        LIBRARY DESTINATION "lib"
   4.100 +        ARCHIVE DESTINATION "lib"
   4.101 +        INCLUDES DESTINATION "include")
   4.102 +
   4.103 +install(FILES
   4.104 +        include/libmodplug/modplug.h
   4.105 +        DESTINATION include/libmodplug/)
   4.106 +
   4.107 +
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/external/libogg-1.3.2/CMakeLists.txt	Wed Aug 14 09:47:18 2019 +0200
     5.3 @@ -0,0 +1,26 @@
     5.4 +cmake_minimum_required(VERSION 3.2)
     5.5 +project(libOGG VERSION 1.3.3 LANGUAGES C)
     5.6 +
     5.7 +include(${CMAKE_CURRENT_SOURCE_DIR}/../audio_codec_common.cmake)
     5.8 +
     5.9 +add_library(ogg STATIC
    5.10 +    src/bitwise.c
    5.11 +    src/framing.c
    5.12 +)
    5.13 +
    5.14 +target_include_directories(ogg PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include)
    5.15 +target_include_directories(ogg PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/android)
    5.16 +
    5.17 +
    5.18 +install(TARGETS ogg
    5.19 +        LIBRARY DESTINATION "lib"
    5.20 +        ARCHIVE DESTINATION "lib"
    5.21 +        INCLUDES DESTINATION "include")
    5.22 +
    5.23 +install(FILES
    5.24 +        include/ogg/config_types.h
    5.25 +        include/ogg/ogg.h
    5.26 +        include/ogg/os_types.h
    5.27 +        DESTINATION include/ogg)
    5.28 +
    5.29 +
     6.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.2 +++ b/external/libvorbisidec-1.2.1/CMakeLists.txt	Wed Aug 14 09:47:18 2019 +0200
     6.3 @@ -0,0 +1,57 @@
     6.4 +cmake_minimum_required(VERSION 3.2)
     6.5 +project(libVorbis VERSION 1.3.6 LANGUAGES C)
     6.6 +
     6.7 +include(${CMAKE_CURRENT_SOURCE_DIR}/../audio_codec_common.cmake)
     6.8 +
     6.9 +add_definitions(
    6.10 +    -DHAVE_CONFIG_H
    6.11 +)
    6.12 +
    6.13 +add_definitions(-DFLOAT_LOOKUP -DINT_LOOKUP)
    6.14 +
    6.15 +if(MSVC)
    6.16 +    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4244 /wd4267 /wd4305")
    6.17 +endif()
    6.18 +
    6.19 +add_library(vorbisidec STATIC
    6.20 +    block.c
    6.21 +    codebook.c
    6.22 +    floor0.c
    6.23 +    floor1.c
    6.24 +    info.c
    6.25 +    mapping0.c
    6.26 +    mdct.c
    6.27 +    registry.c
    6.28 +    res012.c
    6.29 +    sharedbook.c
    6.30 +    synthesis.c
    6.31 +    window.c
    6.32 +)
    6.33 +
    6.34 +add_library(vorbisfile STATIC
    6.35 +    vorbisfile.c
    6.36 +)
    6.37 +
    6.38 +
    6.39 +include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
    6.40 +include_directories(${CMAKE_CURRENT_SOURCE_DIR}/lib)
    6.41 +include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../libogg-1.3.2/include)
    6.42 +
    6.43 +include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../libogg-1.3.2/android)
    6.44 + 
    6.45 +
    6.46 +
    6.47 +target_include_directories(vorbisidec PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include)
    6.48 +target_include_directories(vorbisfile PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include)
    6.49 +
    6.50 +install(TARGETS vorbisidec vorbisfile 
    6.51 +        LIBRARY DESTINATION "lib"
    6.52 +        ARCHIVE DESTINATION "lib"
    6.53 +        INCLUDES DESTINATION "include")
    6.54 +
    6.55 +install(FILES
    6.56 +        include/vorbis/codec.h
    6.57 +        include/vorbis/vorbisfile.h
    6.58 +        DESTINATION include/vorbis)
    6.59 +
    6.60 +
     7.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.2 +++ b/timidity/CMakeLists.txt	Wed Aug 14 09:47:18 2019 +0200
     7.3 @@ -0,0 +1,45 @@
     7.4 +cmake_minimum_required(VERSION 3.2)
     7.5 +project(libTimiditySDL VERSION 0.2 LANGUAGES C)
     7.6 +
     7.7 +include(${CMAKE_CURRENT_SOURCE_DIR}/../external/audio_codec_common.cmake)
     7.8 +
     7.9 +if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX)
    7.10 +    # Turn on warnings and legacy C/C++ standards to support more compilers
    7.11 +    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -pedantic -std=c90")
    7.12 +endif()
    7.13 +
    7.14 +add_library(timidity STATIC
    7.15 +    common.c
    7.16 +    instrum.c
    7.17 +    mix.c
    7.18 +    output.c
    7.19 +    playmidi.c
    7.20 +    readmidi.c
    7.21 +    resample.c
    7.22 +    tables.c
    7.23 +    timidity.c
    7.24 +)
    7.25 +
    7.26 +if(DOWNLOAD_SDL2_DEPENDENCY)
    7.27 +    add_dependencies(timidity SDL2HG)
    7.28 +elseif(SDL2_REPO_PATH)
    7.29 +    include_directories(${SDL2_REPO_PATH}/include)
    7.30 +else()
    7.31 +    find_library(SDL2_LIBRARY SDL2)
    7.32 +    message("Found ${SDL2_LIBRARY}")
    7.33 +endif()
    7.34 +
    7.35 +target_link_libraries(timidity SDL2)
    7.36 +
    7.37 +target_include_directories(timidity PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include)
    7.38 +
    7.39 +install(TARGETS timidity
    7.40 +        LIBRARY DESTINATION "lib"
    7.41 +        ARCHIVE DESTINATION "lib"
    7.42 +        INCLUDES DESTINATION "include")
    7.43 +
    7.44 +install(FILES
    7.45 +        include/timidity.h
    7.46 +        DESTINATION include/)
    7.47 +
    7.48 +