mirror of
https://github.com/vgmstream/vgmstream.git
synced 2025-01-31 04:13:47 +01:00
Cmake: Refactor dependency fetching
- Build maiatrac3plus on targets without ffmpeg
This commit is contained in:
parent
0dd8bdd763
commit
81ebcddd7b
420
CMakeLists.txt
420
CMakeLists.txt
@ -42,22 +42,11 @@ function(set_ffmpeg onoff useForce)
|
||||
set(USE_FFMPEG ${onoff} CACHE BOOL "Use FFmpeg for support of many codecs" ${USE_FORCE_})
|
||||
endfunction()
|
||||
|
||||
function(add_library_path lib_name static lib_path)
|
||||
if(static)
|
||||
add_library(${lib_name} STATIC IMPORTED)
|
||||
set_target_properties(${lib_name} PROPERTIES IMPORTED_LOCATION ${lib_path}.a)
|
||||
else()
|
||||
add_library(${lib_name} SHARED IMPORTED)
|
||||
set_target_properties(${lib_name} PROPERTIES IMPORTED_LOCATION ${lib_path}.so)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
# Options
|
||||
set_mpeg(ON FALSE)
|
||||
set_vorbis(ON FALSE)
|
||||
set_ffmpeg(ON FALSE)
|
||||
option(USE_MAIATRAC3PLUS "Use MAIATRAC3+ for support of ATRAC3+" OFF)
|
||||
set(MAIATRAC3PLUS_PATH CACHE PATH "Path to MAIATRAC3+")
|
||||
|
||||
option(USE_G7221 "Use G7221 for support of ITU-T G.722.1 annex C" ON)
|
||||
option(USE_G719 "Use libg719_decode for support ITU-T G.719" ON)
|
||||
option(USE_ATRAC9 "Use LibAtrac9 for support of ATRAC9" ON)
|
||||
@ -68,8 +57,12 @@ endif()
|
||||
option(USE_SPEEX "Use libspeex for support of SPEEX" ON)
|
||||
if(NOT WIN32)
|
||||
option(USE_JANSSON "Use jansson for JSON dumping" ON)
|
||||
|
||||
endif()
|
||||
|
||||
set(MAIATRAC3PLUS_PATH CACHE PATH "Path to MAIATRAC3+")
|
||||
if(NOT WIN32)
|
||||
set(MPEG_PATH CACHE PATH "Path to mpg123")
|
||||
set(OGG_PATH CACHE PATH "Path to Ogg")
|
||||
set(VORBIS_PATH CACHE PATH "Path to Vorbis")
|
||||
set(FFMPEG_PATH CACHE PATH "Path to FFmpeg")
|
||||
set(G719_PATH CACHE PATH "Path to G.719 decoder")
|
||||
@ -118,11 +111,6 @@ if(BUILD_STATIC)
|
||||
set(BUILD_SHARED_LIBS OFF)
|
||||
set(CMAKE_EXE_LINKER_FLAGS "-static-libgcc -static-libstdc++ -static")
|
||||
|
||||
if(USE_FFMPEG)
|
||||
find_package(PkgConfig REQUIRED)
|
||||
pkg_check_modules(PC_OPUS REQUIRED opus>=1.1)
|
||||
endif()
|
||||
|
||||
# Incompatible with static builds
|
||||
set(BUILD_AUDACIOUS OFF)
|
||||
endif()
|
||||
@ -150,74 +138,30 @@ else()
|
||||
endif()
|
||||
add_custom_target(version_h ALL DEPENDS ${VGM_SOURCE_DIR}/version_auto.h)
|
||||
|
||||
if(NOT WIN32)
|
||||
find_package(Git QUIET)
|
||||
if(Git_FOUND)
|
||||
include(FetchContent)
|
||||
endif()
|
||||
include(FetchDependency)
|
||||
|
||||
include(dependencies/ffmpeg)
|
||||
|
||||
if(USE_FFMPEG)
|
||||
option(USE_MAIATRAC3PLUS "Use MAIATRAC3+ for support of ATRAC3+" OFF)
|
||||
else()
|
||||
option(USE_MAIATRAC3PLUS "Use MAIATRAC3+ for support of ATRAC3+" ON)
|
||||
endif()
|
||||
|
||||
# FFmpeg detection
|
||||
if(USE_FFMPEG)
|
||||
if(NOT WIN32 AND BUILD_STATIC AND NOT FFMPEG_PATH)
|
||||
if(Git_FOUND)
|
||||
set(FFMPEG_PATH ${VGM_SOURCE_DIR}/dependencies/ffmpeg)
|
||||
FetchContent_Declare(ffmpeg
|
||||
GIT_REPOSITORY https://git.ffmpeg.org/ffmpeg.git
|
||||
SOURCE_DIR ${FFMPEG_PATH}
|
||||
BINARY_DIR ${FFMPEG_PATH}-build
|
||||
SUBBUILD_DIR ${FFMPEG_PATH}-subbuild
|
||||
GIT_TAG n4.4
|
||||
GIT_SHALLOW ON
|
||||
)
|
||||
FetchContent_GetProperties(ffmpeg)
|
||||
if(NOT ffmpeg_POPULATED)
|
||||
FetchContent_Populate(ffmpeg)
|
||||
endif()
|
||||
else()
|
||||
set(USE_FFMPEG OFF)
|
||||
endif()
|
||||
endif()
|
||||
if(NOT WIN32 AND FFMPEG_PATH)
|
||||
if(BUILD_STATIC)
|
||||
set(FF_SHARED --enable-static --disable-shared)
|
||||
set(FF_EXTRA --extra-libs=-static --extra-cflags=--static --pkg-config-flags=--static)
|
||||
set(LINK_EXT .a)
|
||||
else()
|
||||
set(FF_SHARED --disable-static --enable-shared)
|
||||
unset(FF_EXTRA)
|
||||
set(LINK_EXT .so)
|
||||
endif()
|
||||
set(FF_CONF_ARGS ${FF_SHARED} --enable-gpl --disable-doc --disable-ffplay --disable-ffprobe --disable-avdevice --disable-ffmpeg --disable-postproc --disable-avfilter --disable-swscale --disable-network --disable-swscale-alpha --disable-vdpau --disable-dxva2 --disable-amf --disable-cuda --disable-d3d11va --disable-ffnvcodec --disable-nvenc --disable-nvdec --disable-hwaccels --disable-sdl2 --disable-iconv --disable-everything --enable-hwaccels --enable-swresample --enable-libopus --enable-parser=ac3,mpegaudio,xma,vorbis,opus --enable-demuxer=ac3,asf,xwma,mov,oma,ogg,tak,dsf,wav,aac,dts,dtshd,mp3,bink,flac,msf,xmv,caf,ape,smacker,pcm_s8,spdif,mpc,mpc8 --enable-decoder=ac3,wmapro,wmav1,wmav2,wmavoice,wmalossless,xma1,xma2,dca,tak,dsd_lsbf,dsd_lsbf_planar,dsd_mbf,dsd_msbf_planar,aac,atrac3,atrac3p,mp1float,mp2float,mp3float,binkaudio_dct,binkaudio_rdft,flac,pcm_s16be,pcm_s16be_planar,pcm_s16le,pcm_s16le_planar,vorbis,ape,adpcm_ima_qt,smackaud,libopus,pcm_s8,pcm_s8_planar,mpc7,mpc8,alac,adpcm_ima_dk3,adpcm_ima_dk4 --disable-parser=mpeg4video,h263 --disable-decoder=mpeg2video,h263,h264,mpeg1video,mpeg2video,mpeg4,hevc,vp9 --disable-cuvid --disable-version3 ${FF_EXTRA})
|
||||
if(NOT EXISTS ${FFMPEG_PATH}/libavutil/libavutil${LINK_EXT})
|
||||
add_custom_target(FF_MAKE ALL
|
||||
COMMAND ./configure ${FF_CONF_ARGS} && make
|
||||
WORKING_DIRECTORY ${FFMPEG_PATH}
|
||||
)
|
||||
endif()
|
||||
add_library_path(avutil ${BUILD_STATIC} ${FFMPEG_PATH}/libavutil/libavutil)
|
||||
add_library_path(avformat ${BUILD_STATIC} ${FFMPEG_PATH}/libavformat/libavformat)
|
||||
add_library_path(swresample ${BUILD_STATIC} ${FFMPEG_PATH}/libswresample/libswresample)
|
||||
add_library_path(avcodec ${BUILD_STATIC} ${FFMPEG_PATH}/libavcodec/libavcodec)
|
||||
elseif(NOT BUILD_STATIC)
|
||||
find_package(FFmpeg)
|
||||
if(NOT FFMPEG_LIBRARIES)
|
||||
set_ffmpeg(OFF TRUE)
|
||||
else()
|
||||
if(${AVCODEC_VERSION} VERSION_LESS 57)
|
||||
set_ffmpeg(OFF TRUE)
|
||||
message("libavcodec version mismatch ${AVCODEC_VERSION} expected >=57")
|
||||
elseif(${AVUTIL_VERSION} VERSION_LESS 55)
|
||||
set_ffmpeg(OFF TRUE)
|
||||
message("libavutil version mismatch ${AVUTIL_VERSION} expected >=55")
|
||||
elseif(${SWRESAMPLE_VERSION} VERSION_LESS 2)
|
||||
set_ffmpeg(OFF TRUE)
|
||||
message("libswresample version mismatch ${SWRESAMPLE_VERSION} expected >=2")
|
||||
endif()
|
||||
endif()
|
||||
else()
|
||||
set(USE_FFMPEG OFF)
|
||||
endif()
|
||||
include(dependencies/mpg123)
|
||||
include(dependencies/vorbis)
|
||||
include(dependencies/libao)
|
||||
include(dependencies/maitrac3plus)
|
||||
include(dependencies/g719)
|
||||
include(dependencies/atrac9)
|
||||
include(dependencies/speex)
|
||||
include(dependencies/jansson)
|
||||
include(dependencies/audacious)
|
||||
|
||||
if(USE_G7221)
|
||||
set(G7221_SOURCE "(built-in)")
|
||||
else()
|
||||
unset(G7221_SOURCE)
|
||||
endif()
|
||||
|
||||
if(WIN32)
|
||||
@ -229,161 +173,8 @@ if(WIN32)
|
||||
endif(MINGW)
|
||||
|
||||
set(CMAKE_EXECUTABLE_SUFFIX .exe)
|
||||
|
||||
else()
|
||||
|
||||
# Find the relevant packages
|
||||
if(USE_MPEG)
|
||||
if(NOT WIN32 AND BUILD_STATIC AND NOT MPEG_PATH)
|
||||
set(MPEG_PATH ${VGM_SOURCE_DIR}/dependencies/mgp123)
|
||||
set(MPEG_FILE ${MPEG_PATH}/mpg123-1.28.2.tar.bz2)
|
||||
if(NOT EXISTS ${MPEG_FILE})
|
||||
file(DOWNLOAD
|
||||
https://downloads.sourceforge.net/mpg123/mpg123-1.28.2.tar.bz2
|
||||
${MPEG_FILE}
|
||||
)
|
||||
file(ARCHIVE_EXTRACT
|
||||
INPUT ${MPEG_FILE}
|
||||
DESTINATION ${MPEG_PATH}
|
||||
)
|
||||
endif()
|
||||
set(MPEG_PATH ${MPEG_PATH}/mpg123-1.28.2)
|
||||
endif()
|
||||
if(NOT WIN32 AND MPEG_PATH)
|
||||
if(BUILD_STATIC)
|
||||
set(MPEG_CONF_ARGS --enable-static=yes --enable-shared=no)
|
||||
set(LINK_EXT .a)
|
||||
else()
|
||||
set(MPEG_CONF_ARGS --enable-static=no --enable-shared=yes)
|
||||
set(LINK_EXT .so)
|
||||
endif()
|
||||
if(NOT EXISTS ${MPEG_PATH}/src/libmpg123/.libs/libmpg123${LINK_EXT})
|
||||
add_custom_target(MPEG_MAKE ALL
|
||||
COMMAND ./configure ${MPEG_CONF_ARGS} && make
|
||||
WORKING_DIRECTORY ${MPEG_PATH}
|
||||
)
|
||||
endif()
|
||||
add_library_path(mpg123 ${BUILD_STATIC} ${MPEG_PATH}/src/libmpg123/.libs/libmpg123)
|
||||
elseif(NOT BUILD_STATIC)
|
||||
find_package(MPG123)
|
||||
if(NOT MPG123_FOUND)
|
||||
set_mpeg(OFF TRUE)
|
||||
endif()
|
||||
else()
|
||||
set(USE_MPEG OFF)
|
||||
endif()
|
||||
endif()
|
||||
if(USE_VORBIS)
|
||||
if(NOT VORBIS_PATH)
|
||||
find_package(VorbisFile QUIET)
|
||||
if(NOT VORBISFILE_FOUND)
|
||||
if(Git_FOUND)
|
||||
set(OGG_PATH ${VGM_SOURCE_DIR}/dependencies/ogg)
|
||||
FetchContent_Declare(libogg
|
||||
GIT_REPOSITORY https://gitlab.xiph.org/xiph/ogg
|
||||
SOURCE_DIR ${OGG_PATH}
|
||||
BINARY_DIR ${OGG_PATH}-build
|
||||
SUBBUILD_DIR ${OGG_PATH}-subbuild
|
||||
GIT_TAG v1.3.5
|
||||
GIT_SHALLOW ON
|
||||
)
|
||||
FetchContent_GetProperties(libogg)
|
||||
if(NOT libogg_POPULATED)
|
||||
FetchContent_Populate(libogg)
|
||||
endif()
|
||||
if(NOT VORBIS_PATH)
|
||||
set(VORBIS_PATH ${VGM_SOURCE_DIR}/dependencies/vorbis)
|
||||
FetchContent_Declare(libvorbis
|
||||
GIT_REPOSITORY https://gitlab.xiph.org/xiph/vorbis
|
||||
SOURCE_DIR ${VORBIS_PATH}
|
||||
BINARY_DIR ${VORBIS_PATH}-build
|
||||
SUBBUILD_DIR ${VORBIS_PATH}-subbuild
|
||||
GIT_TAG v1.3.7
|
||||
GIT_SHALLOW ON
|
||||
)
|
||||
FetchContent_GetProperties(libvorbis)
|
||||
if(NOT libvorbis_POPULATED)
|
||||
FetchContent_Populate(libvorbis)
|
||||
endif()
|
||||
endif()
|
||||
else()
|
||||
unset(VORBIS_PATH)
|
||||
endif()
|
||||
if(VORBIS_PATH)
|
||||
add_subdirectory(${OGG_PATH})
|
||||
set(OGG_INCLUDE_DIR ${OGG_PATH}/include ${VGM_BINARY_DIR}/dependencies/ogg/include)
|
||||
set(OGG_LIBRARY ogg)
|
||||
|
||||
add_subdirectory(${VORBIS_PATH})
|
||||
set(OGG_VORBIS_INCLUDE_DIR ${VORBIS_PATH}/include)
|
||||
set(OGG_VORBIS_LIBRARY vorbis)
|
||||
|
||||
set(VORBISFILE_INCLUDE_DIRS ${OGG_INCLUDE_DIR} ${OGG_VORBIS_INCLUDE_DIR})
|
||||
else()
|
||||
set_vorbis(OFF TRUE)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# If building the CLI, we need to include AO as well
|
||||
if(BUILD_V123)
|
||||
if(LIBAO_PATH)
|
||||
if(BUILD_STATIC)
|
||||
set(LIBAO_CONF_ARGS --enable-static=yes --enable-shared=no)
|
||||
set(LINK_EXT .a)
|
||||
else()
|
||||
set(LIBAO_CONF_ARGS --enable-static=no --enable-shared=yes)
|
||||
set(LINK_EXT .so)
|
||||
endif()
|
||||
if(NOT EXISTS ${LIBAO_PATH}/src/.libs/libao${LINK_EXT})
|
||||
add_custom_target(LIBAO_MAKE ALL
|
||||
COMMAND ./autogen.sh && ./configure ${LIBAO_CONF_ARGS} && make
|
||||
WORKING_DIRECTORY ${LIBAO_PATH}
|
||||
)
|
||||
endif()
|
||||
add_library_path(ao ${BUILD_STATIC} ${LIBAO_PATH}/src/.libs/libao)
|
||||
set(LIBAO_INCLUDE ${LIBAO_PATH}/include)
|
||||
set(USE_V123 ON)
|
||||
elseif(NOT BUILD_STATIC)
|
||||
find_package(AO)
|
||||
if(AO_FOUND)
|
||||
set(LIBAO_INCLUDE ${AO_INCLUDE_DIR})
|
||||
set(USE_V123 ON)
|
||||
else()
|
||||
set(USE_V123 OFF)
|
||||
endif()
|
||||
else()
|
||||
message(FATAL_ERROR "Path to libao must be set. (Use LIBAO_PATH)")
|
||||
set(USE_V123 OFF)
|
||||
endif()
|
||||
else()
|
||||
set(USE_V123 OFF)
|
||||
endif()
|
||||
|
||||
find_package(PkgConfig REQUIRED)
|
||||
|
||||
# Only build JSON dumping capabilities on Linux
|
||||
if(USE_JANSSON)
|
||||
pkg_check_modules(JANSSON jansson>=2.3)
|
||||
if(JANSSON_FOUND)
|
||||
set(JANSSON_PKG libjansson)
|
||||
include_directories(${JANSSON_INCLUDE_DIRS})
|
||||
link_directories(${JANSSON_LIBRARY_DIRS})
|
||||
else()
|
||||
set(USE_JANSSON OFF)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# If building Audacious, we need to make sure we can find its pkg-config module as well as GTK's
|
||||
if(BUILD_AUDACIOUS)
|
||||
pkg_search_module(AUDACIOUS REQUIRED audacious>=3.6)
|
||||
pkg_get_variable(AUDACIOUS_PLUGIN_DIR audacious plugin_dir)
|
||||
pkg_search_module(GTK REQUIRED gtk+-3.0 gtk+-2.0)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
||||
# Set compiler flags
|
||||
if(CMAKE_CXX_COMPILER_ID MATCHES Clang OR CMAKE_CXX_COMPILER_ID MATCHES GNU)
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall")
|
||||
@ -422,136 +213,6 @@ elseif(MSVC)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4005 /wd4018 /wd4244 /wd4302 /wd4838")
|
||||
endif()
|
||||
|
||||
# Add other projects and subdirectories as needed
|
||||
if(USE_MAIATRAC3PLUS)
|
||||
if(MAIATRAC3PLUS_PATH)
|
||||
add_subdirectory(${MAIATRAC3PLUS_PATH}/MaiAT3PlusDecoder ${VGM_BINARY_DIR}/maitrac3plus)
|
||||
else()
|
||||
message(FATAL_ERROR "Path to MAIATRAC3+ must be set. (Use MAIATRAC3PLUS_PATH)")
|
||||
endif()
|
||||
endif()
|
||||
if(NOT WIN32)
|
||||
if(USE_G719)
|
||||
if(NOT G719_PATH)
|
||||
if(Git_FOUND)
|
||||
set(G719_PATH ${VGM_SOURCE_DIR}/dependencies/libg719_decode)
|
||||
FetchContent_Declare(libg719_decode
|
||||
GIT_REPOSITORY https://github.com/kode54/libg719_decode
|
||||
SOURCE_DIR ${G719_PATH}
|
||||
BINARY_DIR ${G719_PATH}-build
|
||||
SUBBUILD_DIR ${G719_PATH}-subbuild
|
||||
GIT_SHALLOW ON
|
||||
)
|
||||
FetchContent_GetProperties(libg719_decode)
|
||||
if(NOT libg719_decode_POPULATED)
|
||||
FetchContent_Populate(libg719_decode)
|
||||
endif()
|
||||
else()
|
||||
set(USE_G719 OFF)
|
||||
endif()
|
||||
endif()
|
||||
if(G719_PATH)
|
||||
configure_file(
|
||||
${VGM_SOURCE_DIR}/ext_libs/libg719_decode/CMakeLists.txt
|
||||
${G719_PATH}/
|
||||
COPYONLY)
|
||||
add_subdirectory(${G719_PATH})
|
||||
endif()
|
||||
endif()
|
||||
if(USE_ATRAC9)
|
||||
if(NOT ATRAC9_PATH)
|
||||
if(Git_FOUND)
|
||||
set(ATRAC9_PATH ${VGM_SOURCE_DIR}/dependencies/LibAtrac9)
|
||||
FetchContent_Declare(ATRAC9_FETCH
|
||||
GIT_REPOSITORY https://github.com/Thealexbarney/LibAtrac9
|
||||
SOURCE_DIR ${ATRAC9_PATH}
|
||||
BINARY_DIR ${ATRAC9_PATH}-build
|
||||
SUBBUILD_DIR ${ATRAC9_PATH}-subbuild
|
||||
GIT_SHALLOW ON
|
||||
)
|
||||
FetchContent_GetProperties(ATRAC9_FETCH)
|
||||
if(NOT ATRAC9_FETCH_POPULATED)
|
||||
FetchContent_Populate(ATRAC9_FETCH)
|
||||
endif()
|
||||
else()
|
||||
set(USE_ATRAC9 OFF)
|
||||
endif()
|
||||
endif()
|
||||
if(ATRAC9_PATH)
|
||||
if(EMSCRIPTEN)
|
||||
set(ATRAC9_LINK_PATH ${ATRAC9_PATH}/C/embin/libatrac9.a)
|
||||
else()
|
||||
set(ATRAC9_LINK_PATH ${ATRAC9_PATH}/C/bin/libatrac9.a)
|
||||
endif()
|
||||
if(NOT EXISTS ${ATRAC9_LINK_PATH})
|
||||
if(EMSCRIPTEN)
|
||||
add_custom_target(ATRAC9_MAKE ALL
|
||||
COMMAND make clean && emmake make static CFLAGS="-fPIC" CC=emcc AR=emar BINDIR=embin
|
||||
WORKING_DIRECTORY ${ATRAC9_PATH}/C
|
||||
)
|
||||
else()
|
||||
add_custom_target(ATRAC9_MAKE ALL
|
||||
COMMAND make clean && make static CFLAGS="-fPIC"
|
||||
WORKING_DIRECTORY ${ATRAC9_PATH}/C
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
add_library(atrac9 STATIC IMPORTED)
|
||||
set_target_properties(atrac9 PROPERTIES
|
||||
IMPORTED_LOCATION ${ATRAC9_LINK_PATH}
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
if(USE_SPEEX)
|
||||
if(NOT SPEEX_PATH)
|
||||
find_package(Speex QUIET)
|
||||
endif()
|
||||
if(SPEEX_PATH OR NOT Speex_FOUND)
|
||||
if(NOT SPEEX_PATH)
|
||||
if(Git_FOUND)
|
||||
set(SPEEX_PATH ${VGM_SOURCE_DIR}/dependencies/speex)
|
||||
FetchContent_Declare(SPEEX_FETCH
|
||||
GIT_REPOSITORY https://gitlab.xiph.org/xiph/speex
|
||||
SOURCE_DIR ${SPEEX_PATH}
|
||||
BINARY_DIR ${SPEEX_PATH}-build
|
||||
SUBBUILD_DIR ${SPEEX_PATH}-subbuild
|
||||
GIT_SHALLOW ON
|
||||
)
|
||||
FetchContent_GetProperties(SPEEX_FETCH)
|
||||
if(NOT SPEEX_FETCH_POPULATED)
|
||||
FetchContent_Populate(SPEEX_FETCH)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
if(SPEEX_PATH)
|
||||
if(EMSCRIPTEN)
|
||||
set(SPEEX_LINK_PATH ${SPEEX_PATH}/embin/usr/local/lib/libspeex.a)
|
||||
else()
|
||||
set(SPEEX_LINK_PATH ${SPEEX_PATH}/bin/usr/local/lib/libspeex.a)
|
||||
endif()
|
||||
if(NOT EXISTS ${SPEEX_LINK_PATH})
|
||||
if(EMSCRIPTEN)
|
||||
add_custom_target(SPEEX_MAKE ALL
|
||||
COMMAND emconfigure ./autogen.sh && emconfigure ./configure --enable-static=yes --enable-shared=no && make clean && emmake make && make install DESTDIR="${SPEEX_PATH}/embin"
|
||||
WORKING_DIRECTORY ${SPEEX_PATH}
|
||||
)
|
||||
else()
|
||||
add_custom_target(SPEEX_MAKE ALL
|
||||
COMMAND ./autogen.sh && ./configure --enable-static=yes --enable-shared=no && make clean && make && make install DESTDIR="${SPEEX_PATH}/bin"
|
||||
WORKING_DIRECTORY ${SPEEX_PATH}
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
add_library(speex STATIC IMPORTED)
|
||||
set_target_properties(speex PROPERTIES
|
||||
IMPORTED_LOCATION ${SPEEX_LINK_PATH}
|
||||
)
|
||||
else()
|
||||
set(USE_SPEEX OFF)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
add_subdirectory(src)
|
||||
if(WIN32)
|
||||
add_subdirectory(ext_libs)
|
||||
@ -599,17 +260,21 @@ endif()
|
||||
# Option Summary
|
||||
message(STATUS " Option Summary")
|
||||
message(STATUS "=================")
|
||||
message(STATUS " MPEG: ${USE_MPEG}")
|
||||
message(STATUS " Vorbis: ${USE_VORBIS}")
|
||||
message(STATUS " FFmpeg: ${USE_FFMPEG}")
|
||||
message(STATUS " MAIATRAC3+: ${USE_MAIATRAC3PLUS}")
|
||||
message(STATUS " G.722.1: ${USE_G7221}")
|
||||
message(STATUS " G.719: ${USE_G719}")
|
||||
message(STATUS " ATRAC9: ${USE_ATRAC9}")
|
||||
message(STATUS " MPEG: ${USE_MPEG} ${MPEG_SOURCE}")
|
||||
message(STATUS " Vorbis: ${USE_VORBIS} ${VORBIS_SOURCE}")
|
||||
message(STATUS " FFmpeg: ${USE_FFMPEG} ${FFMPEG_SOURCE}")
|
||||
message(STATUS " MAIATRAC3+: ${USE_MAIATRAC3PLUS} ${MAIATRAC3PLUS_SOURCE}")
|
||||
message(STATUS " G.722.1: ${USE_G7221} ${G7221_SOURCE}")
|
||||
message(STATUS " G.719: ${USE_G719} ${G719_SOURCE}")
|
||||
message(STATUS " ATRAC9: ${USE_ATRAC9} ${ATRAC9_SOURCE}")
|
||||
if(WIN32)
|
||||
message(STATUS " FSB CELT: ${USE_CELT}")
|
||||
endif()
|
||||
message(STATUS " SPEEX: ${USE_SPEEX}")
|
||||
message(STATUS " SPEEX: ${USE_SPEEX} ${SPEEX_SOURCE}")
|
||||
if(NOT WIN32)
|
||||
message(STATUS " LIBAO: ${BUILD_V123} ${LIBAO_SOURCE}")
|
||||
message(STATUS " Jansson: ${USE_JANSSON} ${JANSSON_SOURCE}")
|
||||
endif()
|
||||
message(STATUS "")
|
||||
|
||||
# Build Summary
|
||||
@ -622,9 +287,8 @@ if(WIN32)
|
||||
message(STATUS " XMPlay plugin: ${BUILD_XMPLAY}")
|
||||
else()
|
||||
message(STATUS " CLI: ${BUILD_CLI}")
|
||||
message(STATUS " vgmstream123: ${USE_V123}")
|
||||
message(STATUS " JSON dumping: ${USE_JANSSON}")
|
||||
message(STATUS "Audacious plugin: ${BUILD_AUDACIOUS}")
|
||||
message(STATUS " vgmstream123: ${BUILD_V123}")
|
||||
message(STATUS "Audacious plugin: ${BUILD_AUDACIOUS} ${AUDACIOUS_SOURCE}")
|
||||
message(STATUS " Static linking: ${BUILD_STATIC}")
|
||||
endif()
|
||||
message(STATUS "")
|
||||
|
@ -66,7 +66,7 @@ install(TARGETS vgmstream_cli
|
||||
|
||||
# TODO: Make it so vgmstream123 can build with Windows (this probably needs a libao.dll included with vgmstream, though)
|
||||
|
||||
if(NOT WIN32 AND USE_V123)
|
||||
if(NOT WIN32 AND BUILD_V123)
|
||||
# vgmstream123
|
||||
|
||||
add_executable(vgmstream123
|
||||
@ -75,7 +75,7 @@ if(NOT WIN32 AND USE_V123)
|
||||
# Link to the vgmstream library as well as libao
|
||||
target_link_libraries(vgmstream123
|
||||
libvgmstream
|
||||
ao dl)
|
||||
ao pthread dl)
|
||||
|
||||
setup_target(vgmstream123 TRUE)
|
||||
|
||||
|
43
cmake/FetchDependency.cmake
Normal file
43
cmake/FetchDependency.cmake
Normal file
@ -0,0 +1,43 @@
|
||||
if(NOT WIN32)
|
||||
find_package(Git QUIET)
|
||||
if(Git_FOUND)
|
||||
include(FetchContent)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
function(FetchDependency name)
|
||||
set(value_args DIR GIT_REPOSITORY GIT_TAG)
|
||||
cmake_parse_arguments(ARGS "" "${value_args}" "" ${ARGN})
|
||||
|
||||
if(NOT ARGS_DIR)
|
||||
set(ARGS_DIR ${name})
|
||||
endif()
|
||||
|
||||
set(${name}_BIN ${VGM_BINARY_DIR}/dependencies/${ARGS_DIR})
|
||||
set(${name}_BIN ${${name}_BIN} PARENT_SCOPE)
|
||||
|
||||
if(${name}_PATH AND IS_DIRECTORY "${${name}_PATH}")
|
||||
set(${name}_SOURCE "(local path)" PARENT_SCOPE)
|
||||
elseif(Git_FOUND AND ARGS_GIT_REPOSITORY)
|
||||
set(${name}_PATH ${VGM_SOURCE_DIR}/dependencies/${ARGS_DIR})
|
||||
set(${name}_PATH ${${name}_PATH} PARENT_SCOPE)
|
||||
set(${name}_SOURCE "(download)" PARENT_SCOPE)
|
||||
|
||||
FetchContent_Declare(${name}_FETCH
|
||||
GIT_REPOSITORY ${ARGS_GIT_REPOSITORY}
|
||||
SOURCE_DIR ${${name}_PATH}
|
||||
BINARY_DIR ${${name}_BIN}
|
||||
SUBBUILD_DIR ${${name}_BIN}-sub
|
||||
GIT_TAG ${ARGS_GIT_TAG}
|
||||
GIT_SHALLOW ON
|
||||
)
|
||||
FetchContent_GetProperties(${name}_FETCH)
|
||||
if(NOT ${name}_FETCH_POPULATED)
|
||||
message("Downloading ${ARGS_DIR}...")
|
||||
FetchContent_Populate(${name}_FETCH)
|
||||
endif()
|
||||
else()
|
||||
set(${name}_PATH "" PARENT_SCOPE)
|
||||
set(USE_${name} OFF PARENT_SCOPE)
|
||||
endif()
|
||||
endfunction()
|
36
cmake/dependencies/atrac9.cmake
Normal file
36
cmake/dependencies/atrac9.cmake
Normal file
@ -0,0 +1,36 @@
|
||||
if(NOT WIN32 AND USE_ATRAC9)
|
||||
FetchDependency(ATRAC9
|
||||
DIR LibAtrac9
|
||||
GIT_REPOSITORY https://github.com/Thealexbarney/LibAtrac9
|
||||
GIT_TAG 6a9e00f6c7abd74d037fd210b6670d3cdb313049
|
||||
)
|
||||
|
||||
if(ATRAC9_PATH)
|
||||
if(EMSCRIPTEN)
|
||||
set(ATRAC9_LINK_PATH ${ATRAC9_BIN}/embin/libatrac9.a)
|
||||
else()
|
||||
set(ATRAC9_LINK_PATH ${ATRAC9_BIN}/bin/libatrac9.a)
|
||||
endif()
|
||||
if(NOT EXISTS ${ATRAC9_LINK_PATH})
|
||||
if(EMSCRIPTEN)
|
||||
add_custom_target(ATRAC9_MAKE ALL
|
||||
COMMAND emmake make static CFLAGS="-fPIC" CC=emcc AR=emar BINDIR="${ATRAC9_BIN}/embin" && make clean
|
||||
WORKING_DIRECTORY ${ATRAC9_PATH}/C
|
||||
)
|
||||
else()
|
||||
add_custom_target(ATRAC9_MAKE ALL
|
||||
COMMAND make static CFLAGS="-fPIC" BINDIR="${ATRAC9_BIN}/bin" && make clean
|
||||
WORKING_DIRECTORY ${ATRAC9_PATH}/C
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
add_library(atrac9 STATIC IMPORTED)
|
||||
set_target_properties(atrac9 PROPERTIES
|
||||
IMPORTED_LOCATION ${ATRAC9_LINK_PATH}
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
if(NOT USE_ATRAC9)
|
||||
unset(ATRAC9_SOURCE)
|
||||
endif()
|
10
cmake/dependencies/audacious.cmake
Normal file
10
cmake/dependencies/audacious.cmake
Normal file
@ -0,0 +1,10 @@
|
||||
if(NOT WIN32 AND BUILD_AUDACIOUS)
|
||||
set(AUDACIOUS_SOURCE "(system)")
|
||||
|
||||
pkg_search_module(AUDACIOUS REQUIRED audacious>=3.6)
|
||||
pkg_get_variable(AUDACIOUS_PLUGIN_DIR audacious plugin_dir)
|
||||
pkg_search_module(GTK REQUIRED gtk+-3.0 gtk+-2.0)
|
||||
endif()
|
||||
if(NOT BUILD_AUDACIOUS)
|
||||
unset(AUDACIOUS_SOURCE)
|
||||
endif()
|
137
cmake/dependencies/ffmpeg.cmake
Normal file
137
cmake/dependencies/ffmpeg.cmake
Normal file
@ -0,0 +1,137 @@
|
||||
if(USE_FFMPEG)
|
||||
if(NOT FFMPEG_PATH AND NOT BUILD_STATIC)
|
||||
# FFmpeg detection
|
||||
if(WIN32)
|
||||
find_package(FFmpeg)
|
||||
else()
|
||||
find_package(FFmpeg QUIET)
|
||||
endif()
|
||||
|
||||
if(NOT FFMPEG_LIBRARIES)
|
||||
if(WIN32)
|
||||
set_ffmpeg(OFF TRUE)
|
||||
else()
|
||||
set(FFmpeg_FOUND NO)
|
||||
endif()
|
||||
else()
|
||||
if(${AVCODEC_VERSION} VERSION_LESS 57)
|
||||
if(WIN32)
|
||||
set_ffmpeg(OFF TRUE)
|
||||
message("libavcodec version mismatch ${AVCODEC_VERSION} expected >=57")
|
||||
else()
|
||||
set(FFmpeg_FOUND NO)
|
||||
endif()
|
||||
elseif(${AVUTIL_VERSION} VERSION_LESS 55)
|
||||
if(WIN32)
|
||||
set_ffmpeg(OFF TRUE)
|
||||
message("libavutil version mismatch ${AVUTIL_VERSION} expected >=55")
|
||||
else()
|
||||
set(FFmpeg_FOUND NO)
|
||||
endif()
|
||||
elseif(${SWRESAMPLE_VERSION} VERSION_LESS 2)
|
||||
if(WIN32)
|
||||
set_ffmpeg(OFF TRUE)
|
||||
message("libswresample version mismatch ${SWRESAMPLE_VERSION} expected >=2")
|
||||
else()
|
||||
set(FFmpeg_FOUND NO)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(FFmpeg_FOUND)
|
||||
set(FFMPEG_SOURCE "(system)")
|
||||
endif()
|
||||
endif()
|
||||
if(USE_FFMPEG AND NOT WIN32 AND (NOT FFmpeg_FOUND OR FFMPEG_PATH OR BUILD_STATIC))
|
||||
find_package(PkgConfig REQUIRED)
|
||||
pkg_check_modules(PC_OPUS REQUIRED opus>=1.1)
|
||||
|
||||
FetchDependency(FFMPEG
|
||||
DIR ffmpeg
|
||||
GIT_REPOSITORY https://git.ffmpeg.org/ffmpeg.git
|
||||
GIT_TAG n4.4
|
||||
)
|
||||
|
||||
if(FFMPEG_PATH)
|
||||
set(FFMPEG_CONF_PARSER
|
||||
ac3 mpegaudio xma vorbis opus
|
||||
)
|
||||
set(FFMPEG_CONF_DEMUXER
|
||||
ac3 asf xwma mov oma ogg tak dsf wav aac dts dtshd mp3 bink flac msf xmv caf ape smacker pcm_s8 spdif mpc mpc8
|
||||
)
|
||||
set(FFMPEG_CONF_DECODER
|
||||
ac3 wmapro wmav1 wmav2 wmavoice wmalossless xma1 xma2 dca tak dsd_lsbf dsd_lsbf_planar dsd_mbf dsd_msbf_planar aac atrac3 atrac3p mp1float mp2float mp3float binkaudio_dct binkaudio_rdft flac pcm_s16be pcm_s16be_planar pcm_s16le pcm_s16le_planar vorbis ape adpcm_ima_qt smackaud libopus pcm_s8 pcm_s8_planar mpc7 mpc8 alac adpcm_ima_dk3 adpcm_ima_dk4
|
||||
)
|
||||
set(FFMPEG_CONF_DISABLE_PARSER
|
||||
mpeg4video h263
|
||||
)
|
||||
set(FFMPEG_CONF_DISABLE_DECODER
|
||||
mpeg2video h263 h264 mpeg1video mpeg2video mpeg4 hevc vp9
|
||||
)
|
||||
string(REPLACE ";" "," FFMPEG_CONF_PARSER "${FFMPEG_CONF_PARSER}")
|
||||
string(REPLACE ";" "," FFMPEG_CONF_DEMUXER "${FFMPEG_CONF_DEMUXER}")
|
||||
string(REPLACE ";" "," FFMPEG_CONF_DECODER "${FFMPEG_CONF_DECODER}")
|
||||
string(REPLACE ";" "," FFMPEG_CONF_DISABLE_PARSER "${FFMPEG_CONF_DISABLE_PARSER}")
|
||||
string(REPLACE ";" "," FFMPEG_CONF_DISABLE_DECODER "${FFMPEG_CONF_DISABLE_DECODER}")
|
||||
set(FFMPEG_CONF_ARGS
|
||||
--enable-static
|
||||
--disable-shared
|
||||
--enable-gpl
|
||||
--disable-doc
|
||||
--disable-ffplay
|
||||
--disable-ffprobe
|
||||
--disable-avdevice
|
||||
--disable-ffmpeg
|
||||
--disable-postproc
|
||||
--disable-avfilter
|
||||
--disable-swscale
|
||||
--disable-network
|
||||
--disable-swscale-alpha
|
||||
--disable-vdpau
|
||||
--disable-dxva2
|
||||
--disable-amf
|
||||
--disable-cuda
|
||||
--disable-d3d11va
|
||||
--disable-ffnvcodec
|
||||
--disable-nvenc
|
||||
--disable-nvdec
|
||||
--disable-hwaccels
|
||||
--disable-sdl2
|
||||
--disable-iconv
|
||||
--disable-everything
|
||||
--enable-hwaccels
|
||||
--enable-swresample
|
||||
--enable-libopus
|
||||
--enable-parser=${FFMPEG_CONF_PARSER}
|
||||
--enable-demuxer=${FFMPEG_CONF_DEMUXER}
|
||||
--enable-decoder=${FFMPEG_CONF_DECODER}
|
||||
--disable-parser=${FFMPEG_CONF_DISABLE_PARSER}
|
||||
--disable-decoder=${FFMPEG_CONF_DISABLE_DECODER}
|
||||
--disable-cuvid
|
||||
--disable-version3
|
||||
--extra-libs=-static
|
||||
--extra-cflags=--static
|
||||
--pkg-config-flags=--static
|
||||
)
|
||||
|
||||
set(FFMPEG_LINK_PATH ${FFMPEG_BIN}/bin/usr/local/lib)
|
||||
|
||||
if(NOT EXISTS ${FFMPEG_LINK_PATH}/libavutil.a)
|
||||
add_custom_target(FFMPEG_MAKE ALL
|
||||
COMMAND ./configure ${FFMPEG_CONF_ARGS} && make && make install DESTDIR="${FFMPEG_BIN}/bin" && make clean
|
||||
WORKING_DIRECTORY ${FFMPEG_PATH}
|
||||
)
|
||||
endif()
|
||||
|
||||
foreach(LIB avutil avformat swresample avcodec)
|
||||
add_library(${LIB} STATIC IMPORTED)
|
||||
set_target_properties(${LIB} PROPERTIES
|
||||
IMPORTED_LOCATION ${FFMPEG_LINK_PATH}/lib${LIB}.a
|
||||
)
|
||||
endforeach()
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
if(NOT USE_FFMPEG)
|
||||
unset(FFMPEG_SOURCE)
|
||||
endif()
|
18
cmake/dependencies/g719.cmake
Normal file
18
cmake/dependencies/g719.cmake
Normal file
@ -0,0 +1,18 @@
|
||||
if(NOT WIN32 AND USE_G719)
|
||||
FetchDependency(G719
|
||||
DIR libg719_decode
|
||||
GIT_REPOSITORY https://github.com/kode54/libg719_decode
|
||||
GIT_TAG 9bd89f89df4a5c0e9f178c173fc55d373f039bcf
|
||||
)
|
||||
|
||||
if(G719_PATH)
|
||||
configure_file(
|
||||
${VGM_SOURCE_DIR}/ext_libs/libg719_decode/CMakeLists.txt
|
||||
${G719_PATH}/CMakeLists.txt
|
||||
COPYONLY)
|
||||
add_subdirectory(${G719_PATH} ${G719_BIN})
|
||||
endif()
|
||||
endif()
|
||||
if(NOT USE_G719)
|
||||
unset(G719_SOURCE)
|
||||
endif()
|
17
cmake/dependencies/jansson.cmake
Normal file
17
cmake/dependencies/jansson.cmake
Normal file
@ -0,0 +1,17 @@
|
||||
if(NOT WIN32 AND USE_JANSSON)
|
||||
find_package(PkgConfig REQUIRED)
|
||||
pkg_check_modules(JANSSON jansson>=2.3)
|
||||
|
||||
if(JANSSON_FOUND)
|
||||
set(JANSSON_SOURCE "(system)")
|
||||
set(JANSSON_PKG libjansson)
|
||||
|
||||
include_directories(${JANSSON_INCLUDE_DIRS})
|
||||
link_directories(${JANSSON_LIBRARY_DIRS})
|
||||
else()
|
||||
set(USE_JANSSON OFF)
|
||||
endif()
|
||||
endif()
|
||||
if(NOT USE_JANSSON)
|
||||
unset(JANSSON_SOURCE)
|
||||
endif()
|
51
cmake/dependencies/libao.cmake
Normal file
51
cmake/dependencies/libao.cmake
Normal file
@ -0,0 +1,51 @@
|
||||
if(NOT WIN32 AND BUILD_V123)
|
||||
if(NOT LIBAO_PATH AND NOT BUILD_STATIC)
|
||||
find_package(AO QUIET)
|
||||
|
||||
if(AO_FOUND)
|
||||
set(LIBAO_SOURCE "(system)")
|
||||
set(LIBAO_INCLUDE ${AO_INCLUDE_DIR})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(LIBAO_PATH OR BUILD_STATIC OR NOT AO_FOUND)
|
||||
FetchDependency(LIBAO
|
||||
DIR libao
|
||||
)
|
||||
|
||||
if(LIBAO_PATH)
|
||||
if(BUILD_STATIC)
|
||||
set(LIBAO_CONF_ARGS --enable-static=yes --enable-shared=no)
|
||||
set(LINK_EXT .a)
|
||||
else()
|
||||
set(LIBAO_CONF_ARGS --enable-static=no --enable-shared=yes)
|
||||
set(LINK_EXT .so)
|
||||
endif()
|
||||
set(LIBAO_LINK_PATH ${LIBAO_BIN}/bin/usr/local/lib/libao${LINK_EXT})
|
||||
set(LIBAO_INCLUDE ${LIBAO_BIN}/bin/usr/local/include)
|
||||
|
||||
if(NOT EXISTS ${LIBAO_LINK_PATH})
|
||||
add_custom_target(LIBAO_MAKE ALL
|
||||
COMMAND ./autogen.sh && ./configure ${LIBAO_CONF_ARGS} && make clean && make && make install DESTDIR=${LIBAO_BIN}/bin
|
||||
WORKING_DIRECTORY ${LIBAO_PATH}
|
||||
)
|
||||
endif()
|
||||
|
||||
if(BUILD_STATIC)
|
||||
add_library(ao STATIC IMPORTED)
|
||||
else()
|
||||
add_library(ao SHARED IMPORTED)
|
||||
endif()
|
||||
set_target_properties(ao PROPERTIES
|
||||
IMPORTED_LOCATION ${LIBAO_LINK_PATH}
|
||||
)
|
||||
elseif(BUILD_STATIC)
|
||||
message(FATAL_ERROR "Path to libao must be set. (Use LIBAO_PATH)")
|
||||
else()
|
||||
set(BUILD_V123 OFF)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
if(NOT BUILD_V123)
|
||||
unset(LIBAO_SOURCE)
|
||||
endif()
|
26
cmake/dependencies/maitrac3plus.cmake
Normal file
26
cmake/dependencies/maitrac3plus.cmake
Normal file
@ -0,0 +1,26 @@
|
||||
if(USE_MAIATRAC3PLUS)
|
||||
FetchDependency(MAIATRAC3PLUS
|
||||
DIR maiatrac3plus
|
||||
GIT_REPOSITORY https://github.com/emulibraries/maiatrac3plus
|
||||
GIT_TAG 95c34f2651b0988a8ed762692925eb22700e9b42
|
||||
)
|
||||
|
||||
if(MAIATRAC3PLUS_PATH)
|
||||
configure_file(
|
||||
${VGM_SOURCE_DIR}/ext_libs/maiatrac3plus/CMakeLists.txt
|
||||
${MAIATRAC3PLUS_PATH}/MaiAT3PlusDecoder/CMakeLists.txt
|
||||
COPYONLY)
|
||||
configure_file(
|
||||
${VGM_SOURCE_DIR}/ext_libs/maiatrac3plus/maiatrac3plus.h
|
||||
${MAIATRAC3PLUS_PATH}/MaiAT3PlusDecoder/maiatrac3plus.h
|
||||
COPYONLY)
|
||||
configure_file(
|
||||
${MAIATRAC3PLUS_PATH}/MaiAT3PlusDecoder/src/base/Mai_mem.cc
|
||||
${MAIATRAC3PLUS_PATH}/MaiAT3PlusDecoder/src/base/Mai_Mem.cc
|
||||
COPYONLY)
|
||||
add_subdirectory(${MAIATRAC3PLUS_PATH}/MaiAT3PlusDecoder ${MAIATRAC3PLUS_BIN})
|
||||
endif()
|
||||
endif()
|
||||
if(NOT USE_MAIATRAC3PLUS)
|
||||
unset(MAIATRAC3PLUS_SOURCE)
|
||||
endif()
|
51
cmake/dependencies/mpg123.cmake
Normal file
51
cmake/dependencies/mpg123.cmake
Normal file
@ -0,0 +1,51 @@
|
||||
if(NOT WIN32 AND USE_MPEG)
|
||||
if(NOT MPEG_PATH AND NOT BUILD_STATIC)
|
||||
find_package(MPG123 QUIET)
|
||||
|
||||
if(MPG123_FOUND)
|
||||
set(MPEG_SOURCE "(system)")
|
||||
endif()
|
||||
endif()
|
||||
if(MPEG_PATH OR BUILD_STATIC OR NOT MPG123_FOUND)
|
||||
set(MPEG_BIN ${VGM_BINARY_DIR}/dependencies/mpg123)
|
||||
|
||||
if(MPEG_PATH)
|
||||
set(MPEG_SOURCE "(local path)")
|
||||
else()
|
||||
set(MPEG_PATH ${VGM_SOURCE_DIR}/dependencies/mgp123)
|
||||
set(MPEG_FILE ${MPEG_PATH}/mpg123-1.28.2.tar.bz2)
|
||||
set(MPEG_SOURCE "(download)")
|
||||
|
||||
if(NOT EXISTS ${MPEG_FILE})
|
||||
|
||||
file(DOWNLOAD
|
||||
https://downloads.sourceforge.net/mpg123/mpg123-1.28.2.tar.bz2
|
||||
${MPEG_FILE}
|
||||
)
|
||||
file(ARCHIVE_EXTRACT
|
||||
INPUT ${MPEG_FILE}
|
||||
DESTINATION ${MPEG_PATH}
|
||||
)
|
||||
endif()
|
||||
|
||||
set(MPEG_PATH ${MPEG_PATH}/mpg123-1.28.2)
|
||||
endif()
|
||||
|
||||
set(MPEG_LINK_PATH ${MPEG_BIN}/bin/usr/local/lib/libmpg123.a)
|
||||
|
||||
if(NOT EXISTS ${MPEG_LINK_PATH})
|
||||
add_custom_target(MPEG_MAKE ALL
|
||||
COMMAND ./configure --enable-static=yes --enable-shared=no && make && make install DESTDIR="${MPEG_BIN}/bin" && make clean
|
||||
WORKING_DIRECTORY ${MPEG_PATH}
|
||||
)
|
||||
endif()
|
||||
|
||||
add_library(mpg123 STATIC IMPORTED)
|
||||
set_target_properties(mpg123 PROPERTIES
|
||||
IMPORTED_LOCATION ${MPEG_LINK_PATH}
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
if(NOT USE_MPEG)
|
||||
unset(MPEG_SOURCE)
|
||||
endif()
|
45
cmake/dependencies/speex.cmake
Normal file
45
cmake/dependencies/speex.cmake
Normal file
@ -0,0 +1,45 @@
|
||||
if(NOT WIN32 AND USE_SPEEX)
|
||||
if(NOT SPEEX_PATH)
|
||||
find_package(Speex QUIET)
|
||||
|
||||
if(Speex_FOUND)
|
||||
set(SPEEX_SOURCE "(system)")
|
||||
endif()
|
||||
endif()
|
||||
if(SPEEX_PATH OR NOT Speex_FOUND)
|
||||
FetchDependency(SPEEX
|
||||
DIR speex
|
||||
GIT_REPOSITORY https://gitlab.xiph.org/xiph/speex
|
||||
GIT_TAG 870ff845b32f314aec0036641ffe18aba4916887
|
||||
)
|
||||
|
||||
if(SPEEX_PATH)
|
||||
if(EMSCRIPTEN)
|
||||
set(SPEEX_LINK_PATH ${SPEEX_BIN}/embin/usr/local/lib/libspeex.a)
|
||||
else()
|
||||
set(SPEEX_LINK_PATH ${SPEEX_BIN}/bin/usr/local/lib/libspeex.a)
|
||||
endif()
|
||||
if(NOT EXISTS ${SPEEX_LINK_PATH})
|
||||
if(EMSCRIPTEN)
|
||||
add_custom_target(SPEEX_MAKE ALL
|
||||
COMMAND emconfigure ./autogen.sh && emconfigure ./configure --enable-static=yes --enable-shared=no && emmake make && make install DESTDIR="${SPEEX_BIN}/embin" && make clean
|
||||
WORKING_DIRECTORY ${SPEEX_PATH}
|
||||
)
|
||||
else()
|
||||
add_custom_target(SPEEX_MAKE ALL
|
||||
COMMAND ./autogen.sh && ./configure --enable-static=yes --enable-shared=no && make && make install DESTDIR="${SPEEX_BIN}/bin" && make clean
|
||||
WORKING_DIRECTORY ${SPEEX_PATH}
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
add_library(speex STATIC IMPORTED)
|
||||
set_target_properties(speex PROPERTIES
|
||||
IMPORTED_LOCATION ${SPEEX_LINK_PATH}
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
if(NOT USE_SPEEX)
|
||||
unset(SPEEX_SOURCE)
|
||||
endif()
|
38
cmake/dependencies/vorbis.cmake
Normal file
38
cmake/dependencies/vorbis.cmake
Normal file
@ -0,0 +1,38 @@
|
||||
if(NOT WIN32 AND USE_VORBIS)
|
||||
if(NOT VORBIS_PATH OR NOT OGG_PATH)
|
||||
find_package(VorbisFile QUIET)
|
||||
|
||||
if(VORBISFILE_FOUND)
|
||||
set(VORBIS_SOURCE "(system)")
|
||||
endif()
|
||||
endif()
|
||||
if(VORBIS_PATH AND OGG_PATH OR NOT VORBISFILE_FOUND)
|
||||
FetchDependency(OGG
|
||||
DIR ogg
|
||||
GIT_REPOSITORY https://gitlab.xiph.org/xiph/ogg
|
||||
GIT_TAG v1.3.5
|
||||
)
|
||||
FetchDependency(VORBIS
|
||||
DIR vorbis
|
||||
GIT_REPOSITORY https://gitlab.xiph.org/xiph/vorbis
|
||||
GIT_TAG v1.3.7
|
||||
)
|
||||
|
||||
if(OGG_PATH AND VORBIS_PATH)
|
||||
add_subdirectory(${OGG_PATH} ${OGG_BIN})
|
||||
set(OGG_INCLUDE_DIR ${OGG_PATH}/include ${OGG_BIN}/include)
|
||||
set(OGG_LIBRARY ogg)
|
||||
|
||||
add_subdirectory(${VORBIS_PATH} ${VORBIS_BIN})
|
||||
set(OGG_VORBIS_INCLUDE_DIR ${VORBIS_PATH}/include)
|
||||
set(OGG_VORBIS_LIBRARY vorbis)
|
||||
|
||||
set(VORBISFILE_INCLUDE_DIRS ${OGG_INCLUDE_DIR} ${OGG_VORBIS_INCLUDE_DIR})
|
||||
else()
|
||||
set_vorbis(OFF TRUE)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
if(NOT USE_VORBIS)
|
||||
unset(VORBIS_SOURCE)
|
||||
endif()
|
@ -1,6 +1,10 @@
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
project(libg719_decode)
|
||||
|
||||
if(CMAKE_CXX_COMPILER_ID MATCHES Clang OR CMAKE_CXX_COMPILER_ID MATCHES GNU)
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-comment -Wno-missing-braces")
|
||||
endif()
|
||||
|
||||
file(GLOB_RECURSE SOURCES "reference_code/*.c")
|
||||
|
||||
add_library(g719_decode STATIC g719.c ${SOURCES})
|
||||
|
217
ext_libs/maiatrac3plus/CMakeLists.txt
Normal file
217
ext_libs/maiatrac3plus/CMakeLists.txt
Normal file
@ -0,0 +1,217 @@
|
||||
# vim:noexpandtab:
|
||||
cmake_minimum_required(VERSION 2.8.8)
|
||||
project(MaiAT3)
|
||||
|
||||
if(ANDROID)
|
||||
if(ARMEABI OR ARMEABI_V7A)
|
||||
set(ARM ON)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (IOS OR BLACKBERRY)
|
||||
set(ARM ON)
|
||||
endif()
|
||||
|
||||
if (MAEMO)
|
||||
set(ARM ON)
|
||||
#Maemo's gcc-4.7.2 is strickt
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fpermissive")
|
||||
endif()
|
||||
|
||||
if(LOONGSON)
|
||||
set(MIPS ON) # MIPS + x86 for now
|
||||
endif()
|
||||
|
||||
if(ARM)
|
||||
set(USING_GLES2 ON)
|
||||
else() # Assume x86
|
||||
set(X86 ON)
|
||||
endif()
|
||||
|
||||
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
||||
set(MACOSX ON)
|
||||
endif()
|
||||
|
||||
if(ANDROID OR BLACKBERRY OR IOS OR PANDORA OR MAEMO OR MACOSX)
|
||||
set(HEADLESS OFF)
|
||||
elseif(NOT DEFINED HEADLESS)
|
||||
set(HEADLESS ON)
|
||||
endif()
|
||||
|
||||
# User-editable options (go into CMakeCache.txt)
|
||||
option(ARM "Set to ON if targeting an ARM processor" ${ARM})
|
||||
option(MIPS "Set to ON if targeting a MIPS processor" ${MIPS})
|
||||
option(X86 "Set to ON if targeting an X86 processor" ${X86})
|
||||
option(ANDROID "Set to ON if targeting an Android device" ${ANDROID})
|
||||
option(BLACKBERRY "Set to ON if targeting a Blackberry device" ${BLACKBERRY})
|
||||
option(PANDORA "Set to ON if targeting an OpenPandora device" ${PANDORA})
|
||||
option(MAEMO "Set to ON if targeting an Maemo (N900) device" ${MAEMO})
|
||||
option(IOS "Set to ON if targeting an iOS device" ${IOS})
|
||||
|
||||
if(ANDROID)
|
||||
if(NOT ANDROID_ABI)
|
||||
message(FATAL_ERROR "CMAKE_TOOLCHAIN_FILE was not set!\n"
|
||||
"Delete the CMakeCache.txt file and CMakeFiles directory."
|
||||
"Rerun ${CMAKE_COMMAND} with \"-DCMAKE_TOOLCHAIN_FILE"
|
||||
"=${CMAKE_SOURCE_DIR}/android/android.toolchain.cmake\"")
|
||||
endif()
|
||||
set(CoreLibName ppsspp_jni)
|
||||
set(CoreLinkType SHARED)
|
||||
elseif(IOS)
|
||||
if (NOT IOS_PLATFORM)
|
||||
message(FATAL_ERROR "CMAKE_TOOLCHAIN_FILE was not set!\n"
|
||||
"Delete the CMakeCache.txt file and CMakeFiles directory."
|
||||
"Rerun ${CMAKE_COMMAND} with \"-DCMAKE_TOOLCHAIN_FILE"
|
||||
"=${CMAKE_SOURCE_DIR}/ios/ios.toolchain.cmake\"")
|
||||
endif()
|
||||
set(CoreLibName Core)
|
||||
set(CoreLinkType STATIC)
|
||||
else()
|
||||
set(CoreLibName Core)
|
||||
set(CoreLinkType STATIC)
|
||||
endif()
|
||||
|
||||
include(FindThreads)
|
||||
if(APPLE)
|
||||
find_library(COCOA_LIBRARY Cocoa)
|
||||
endif()
|
||||
|
||||
# Needed for Globals.h
|
||||
include_directories("${CMAKE_SOURCE_DIR}")
|
||||
|
||||
if(BLACKBERRY)
|
||||
add_definitions(-DBLACKBERRY)
|
||||
if(BLACKBERRY VERSION_GREATER 10)
|
||||
add_definitions(-DBLACKBERRY10)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(ANDROID)
|
||||
add_definitions(-DANDROID)
|
||||
endif()
|
||||
|
||||
if(IOS)
|
||||
add_definitions(-DIOS)
|
||||
endif()
|
||||
|
||||
if(MAEMO)
|
||||
add_definitions(-DMAEMO)
|
||||
endif()
|
||||
|
||||
if(PANDORA)
|
||||
add_definitions(-DPANDORA)
|
||||
endif()
|
||||
|
||||
if(ARM)
|
||||
add_definitions(-DARM)
|
||||
endif()
|
||||
|
||||
if(MIPS)
|
||||
add_definitions(-DMIPS)
|
||||
endif()
|
||||
|
||||
if(MACOSX)
|
||||
add_definitions(-DMACOSX)
|
||||
endif()
|
||||
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_DEBUG")
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -D_NDEBUG")
|
||||
|
||||
if(NOT MSVC)
|
||||
# Disable some warnings
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3")
|
||||
add_definitions(-Wno-multichar)
|
||||
add_definitions(-fno-strict-aliasing)
|
||||
if (CMAKE_C_COMPILER_ID STREQUAL "Intel")
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -parallel -fopenmp")
|
||||
else()
|
||||
add_definitions(-ffast-math)
|
||||
endif()
|
||||
if(NOT APPLE)
|
||||
if (NOT CMAKE_C_COMPILER_ID STREQUAL "Intel")
|
||||
add_definitions(-Wno-psabi)
|
||||
endif()
|
||||
add_definitions(-D_XOPEN_SOURCE=600 -D_XOPEN_SOURCE_EXTENDED -D__BSD_VISIBLE=1)
|
||||
add_definitions(-D_LARGEFILE64_SOURCE=1 -D_FILE_OFFSET_BITS=64)
|
||||
endif()
|
||||
if(IOS)
|
||||
add_definitions(-DGL_ETC1_RGB8_OES=0)
|
||||
endif()
|
||||
|
||||
if(BLACKBERRY)
|
||||
add_definitions(-D_QNX_SOURCE=1 -D_C99=1 -O3 -mfpu=neon -mtune=cortex-a9)
|
||||
endif()
|
||||
|
||||
if(X86 AND NOT MIPS)
|
||||
# enable sse2 code generation
|
||||
add_definitions(-msse2)
|
||||
if(EMSCRIPTEN)
|
||||
add_definitions(-msimd128)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(IOS)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libstdc++")
|
||||
elseif(APPLE)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++ -U__STRICT_ANSI__")
|
||||
# Karen/angelXwind: --macosx-version-min=10.7 is needed in order to produce binaries that OS X 10.7 Lion can execute. However, it seems that PPSSPP won't support 10.6 or lower without getting rid of -stdlib=libc++ ...which probably won't end well. So I guess PPSSPP will strictly be a 10.7+ app.
|
||||
# vit9696: OSX 10.6 builds are possible: http://forums.ppsspp.org/showthread.php?tid=1826&pid=18875#pid18875
|
||||
set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libc++")
|
||||
endif()
|
||||
if(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.7.0)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
|
||||
else()
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
|
||||
endif()
|
||||
else()
|
||||
# Disable warnings about MS-specific _s variants of libc functions
|
||||
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
|
||||
endif()
|
||||
|
||||
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib")
|
||||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib")
|
||||
|
||||
if(ANDROID)
|
||||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/android/libs/${ANDROID_ABI}")
|
||||
endif()
|
||||
|
||||
# This sets up the MSVC project dirs according to the physical project dirs
|
||||
macro(setup_target_project TargetName ProjectDir)
|
||||
get_property(TargetSources TARGET "${TargetName}" PROPERTY SOURCES)
|
||||
foreach(Source ${TargetSources})
|
||||
# Figure out the file's path relative to the ProjectDir
|
||||
# NOTE: &#$@ double-quoted regexps
|
||||
string(REGEX REPLACE "${ProjectDir}" "" RelativePath "${Source}")
|
||||
string(REGEX REPLACE "[\\\\/][^\\\\/]*$" "" RelativePath "${RelativePath}")
|
||||
string(REGEX REPLACE "^[\\\\/]" "" RelativePath "${RelativePath}")
|
||||
string(REGEX REPLACE "/" "\\\\\\\\" RelativePath "${RelativePath}")
|
||||
# put the source file in a source_group equivalent to the relative path
|
||||
source_group("${RelativePath}" FILES ${Source})
|
||||
endforeach()
|
||||
endmacro()
|
||||
|
||||
include_directories(include)
|
||||
include_directories(include/SUB)
|
||||
|
||||
add_library(base STATIC
|
||||
src/base/Heap_Alloc0.cc
|
||||
src/base/MaiBitReader.cc
|
||||
src/base/MaiBufIO.cc
|
||||
src/base/MaiCriticalSection.cc
|
||||
src/base/MaiFile.cc
|
||||
src/base/MaiQueue0.cc
|
||||
src/base/MaiString.cc
|
||||
src/base/MaiThread.cc
|
||||
src/base/Mai_Sleep.cc
|
||||
src/base/Mai_Mem.cc
|
||||
src/base/Unicode.cc)
|
||||
|
||||
add_library(at3plusdecoder SHARED
|
||||
maiatrac3plus.cpp
|
||||
src/MaiAT3PlusCoreDecoder.cpp
|
||||
src/MaiAT3PlusCoreDecoder_DecFunc.cpp
|
||||
src/MaiAT3PlusCoreDecoder_StaticData.cpp
|
||||
src/MaiAT3PlusCoreDecoder_SubFunc.cpp
|
||||
src/MaiAT3PlusFrameDecoder.cpp)
|
||||
|
||||
target_link_libraries(at3plusdecoder base)
|
28
ext_libs/maiatrac3plus/maiatrac3plus.h
Normal file
28
ext_libs/maiatrac3plus/maiatrac3plus.h
Normal file
@ -0,0 +1,28 @@
|
||||
// The following ifdef block is the standard way of creating macros which make exporting
|
||||
// from a DLL simpler. All files within this DLL are compiled with the MAIATRAC3PLUS_EXPORTS
|
||||
// symbol defined on the command line. This symbol should not be defined on any project
|
||||
// that uses this DLL. This way any other project whose source files include this file see
|
||||
// MAIATRAC3PLUS_API functions as being imported from a DLL, whereas this DLL sees symbols
|
||||
// defined with this macro as being exported.
|
||||
|
||||
#ifdef _WIN32
|
||||
#ifdef MAIATRAC3PLUS_EXPORTS
|
||||
#define MAIATRAC3PLUS_API __declspec(dllexport)
|
||||
#else
|
||||
#define MAIATRAC3PLUS_API __declspec(dllimport)
|
||||
#endif
|
||||
#else
|
||||
#define MAIATRAC3PLUS_API
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
MAIATRAC3PLUS_API void* Atrac3plusDecoder_openContext();
|
||||
MAIATRAC3PLUS_API int Atrac3plusDecoder_closeContext(void* context);
|
||||
MAIATRAC3PLUS_API int Atrac3plusDecoder_decodeFrame(void* context, void* inbuf, int inbytes, int* channels, void** outbuf);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
@ -3,14 +3,7 @@
|
||||
|
||||
#ifdef VGM_USE_MAIATRAC3PLUS
|
||||
#include "maiatrac3plus.h"
|
||||
|
||||
struct maiatrac3plus_codec_data {
|
||||
sample_t* buffer;
|
||||
int channels;
|
||||
int samples_discard;
|
||||
void* handle;
|
||||
};
|
||||
|
||||
#include "at3plus_decoder.h"
|
||||
|
||||
maiatrac3plus_codec_data *init_at3plus() {
|
||||
|
||||
|
11
src/coding/at3plus_decoder.h
Normal file
11
src/coding/at3plus_decoder.h
Normal file
@ -0,0 +1,11 @@
|
||||
#ifndef _AT3PLUS_DECODER_H
|
||||
#define _AT3PLUS_DECODER_H
|
||||
|
||||
struct maiatrac3plus_codec_data {
|
||||
sample_t* buffer;
|
||||
int channels;
|
||||
int samples_discard;
|
||||
void* handle;
|
||||
};
|
||||
|
||||
#endif
|
@ -4,6 +4,9 @@
|
||||
#include "coding/coding.h"
|
||||
#include "mixing.h"
|
||||
#include "plugins.h"
|
||||
#ifdef VGM_USE_MAIATRAC3PLUS
|
||||
#include "at3plus_decoder.h"
|
||||
#endif
|
||||
|
||||
/* custom codec handling, not exactly "decode" stuff but here to simplify adding new codecs */
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user