mirror of
https://github.com/vgmstream/vgmstream.git
synced 2024-11-23 22:41:05 +01:00
Cmake: Build mpg123 and jansson for wasm target
This commit is contained in:
parent
e9f7958bfa
commit
493c12916c
15
.github/workflows/cmake-wasm.yml
vendored
15
.github/workflows/cmake-wasm.yml
vendored
@ -49,6 +49,13 @@ jobs:
|
||||
${{runner.workspace}}/embuild/dependencies/ffmpeg/bin/usr/local/lib
|
||||
key: wasm-ffmpeg-${{ hashFiles('cmake/dependencies/ffmpeg.cmake') }}
|
||||
|
||||
- name: Cache jansson
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: |
|
||||
${{runner.workspace}}/embuild/dependencies/jansson/src/.libs
|
||||
key: wasm-jansson-${{ hashFiles('cmake/dependencies/jansson.cmake') }}
|
||||
|
||||
- name: Cache atrac9
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
@ -63,6 +70,14 @@ jobs:
|
||||
${{runner.workspace}}/embuild/dependencies/libg719_decode/libg719_decode.a
|
||||
key: wasm-g719-${{ hashFiles('cmake/dependencies/g719.cmake') }}
|
||||
|
||||
- name: Cache mpg123
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: |
|
||||
${{runner.workspace}}/dependencies/mpg123
|
||||
${{runner.workspace}}/embuild/dependencies/mpg123/src/libmpg123/.libs
|
||||
key: wasm-mpg123-${{ hashFiles('cmake/dependencies/mpg123.cmake') }}
|
||||
|
||||
- name: Cache speex
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
|
@ -69,6 +69,7 @@ if(NOT WIN32)
|
||||
set(CELT0061_PATH CACHE PATH "Path to CELT version 0.6.1")
|
||||
set(CELT0110_PATH CACHE PATH "Path to CELT version 0.11.0")
|
||||
set(LIBAO_PATH CACHE PATH "Path to libao")
|
||||
set(JANSSON_PATH CACHE PATH "Path to jansson")
|
||||
endif()
|
||||
|
||||
# Build choices
|
||||
@ -99,8 +100,6 @@ else()
|
||||
endif()
|
||||
|
||||
if(EMSCRIPTEN)
|
||||
set(USE_MPEG OFF)
|
||||
set(USE_JANSSON OFF)
|
||||
set(BUILD_V123 OFF)
|
||||
set(BUILD_AUDACIOUS OFF)
|
||||
|
||||
|
@ -19,6 +19,7 @@ target_link_libraries(vgmstream_cli libvgmstream)
|
||||
# Link to Jansson, if we have it
|
||||
if (USE_JANSSON AND JANSSON_FOUND)
|
||||
target_compile_definitions(vgmstream_cli PRIVATE HAVE_JSON)
|
||||
target_include_directories(vgmstream_cli PRIVATE ${JANSSON_INCLUDE_DIRS})
|
||||
target_link_libraries(vgmstream_cli jansson)
|
||||
endif()
|
||||
|
||||
|
@ -1,15 +1,56 @@
|
||||
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)
|
||||
if(NOT JANSSON_PATH AND NOT EMSCRIPTEN)
|
||||
find_package(PkgConfig REQUIRED)
|
||||
pkg_check_modules(JANSSON jansson>=2.3)
|
||||
|
||||
include_directories(${JANSSON_INCLUDE_DIRS})
|
||||
link_directories(${JANSSON_LIBRARY_DIRS})
|
||||
else()
|
||||
set(USE_JANSSON OFF)
|
||||
if(JANSSON_FOUND)
|
||||
set(JANSSON_SOURCE "(system)")
|
||||
set(JANSSON_PKG libjansson)
|
||||
|
||||
link_directories(${JANSSON_LIBRARY_DIRS})
|
||||
endif()
|
||||
endif()
|
||||
if(JANSSON_PATH OR EMSCRIPTEN OR NOT JANSSON_FOUND)
|
||||
FetchDependency(JANSSON
|
||||
DIR jansson
|
||||
GIT_REPOSITORY https://github.com/akheron/jansson
|
||||
GIT_TAG 684e18c927e89615c2d501737e90018f4930d6c5
|
||||
)
|
||||
|
||||
if(JANSSON_PATH)
|
||||
set(JANSSON_LINK_PATH ${JANSSON_BIN}/src/.libs/libjansson.a)
|
||||
set(JANSSON_INCLUDE_DIRS ${JANSSON_PATH}/src)
|
||||
|
||||
if(NOT EXISTS ${JANSSON_PATH}/configure)
|
||||
add_custom_target(JANSSON_AUTORECONF
|
||||
COMMAND autoreconf -iv
|
||||
BYPRODUCTS ${JANSSON_PATH}/configure
|
||||
WORKING_DIRECTORY ${JANSSON_PATH}
|
||||
)
|
||||
endif()
|
||||
|
||||
file(MAKE_DIRECTORY ${JANSSON_BIN})
|
||||
add_custom_target(JANSSON_CONFIGURE
|
||||
COMMAND "${JANSSON_PATH}/configure" --enable-static --disable-shared CC="${CMAKE_C_COMPILER}" AR="${CMAKE_AR}" RANLIB="${CMAKE_RANLIB}"
|
||||
DEPENDS ${JANSSON_PATH}/configure
|
||||
BYPRODUCTS ${JANSSON_BIN}/Makefile
|
||||
WORKING_DIRECTORY ${JANSSON_BIN}
|
||||
)
|
||||
add_custom_target(JANSSON_MAKE
|
||||
COMMAND make
|
||||
DEPENDS ${JANSSON_BIN}/Makefile
|
||||
BYPRODUCTS ${JANSSON_LINK_PATH} ${JANSSON_BIN}
|
||||
WORKING_DIRECTORY ${JANSSON_BIN}
|
||||
)
|
||||
|
||||
add_library(jansson STATIC IMPORTED)
|
||||
if(NOT EXISTS ${JANSSON_LINK_PATH})
|
||||
add_dependencies(jansson JANSSON_MAKE)
|
||||
endif()
|
||||
set_target_properties(jansson PROPERTIES
|
||||
IMPORTED_LOCATION ${JANSSON_LINK_PATH}
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
if(NOT USE_JANSSON)
|
||||
|
@ -36,9 +36,22 @@ if(NOT WIN32 AND USE_MPEG)
|
||||
)
|
||||
endif()
|
||||
|
||||
set(MPEG_CONFIGURE
|
||||
--enable-static
|
||||
--disable-shared
|
||||
CC="${CMAKE_C_COMPILER}"
|
||||
AR="${CMAKE_AR}"
|
||||
RANLIB="${CMAKE_RANLIB}"
|
||||
)
|
||||
if(EMSCRIPTEN)
|
||||
list(APPEND MPEG_CONFIGURE
|
||||
--with-cpu=generic_fpu
|
||||
)
|
||||
endif()
|
||||
|
||||
file(MAKE_DIRECTORY ${MPEG_BIN})
|
||||
add_custom_target(MPEG_CONFIGURE
|
||||
COMMAND "${MPEG_PATH}/configure" --enable-static --disable-shared CC="${CMAKE_C_COMPILER}" AR="${CMAKE_AR}"
|
||||
COMMAND "${MPEG_PATH}/configure" ${MPEG_CONFIGURE}
|
||||
DEPENDS ${MPEG_PATH}/configure
|
||||
BYPRODUCTS ${MPEG_BIN}/Makefile
|
||||
WORKING_DIRECTORY ${MPEG_BIN}
|
||||
|
@ -60,16 +60,18 @@ setup_target(libvgmstream)
|
||||
target_include_directories(libvgmstream PRIVATE ${libvgmstream_includes})
|
||||
|
||||
# libvgmstream.so
|
||||
add_library(libvgmstream_shared SHARED EXCLUDE_FROM_ALL ${libvgmstream_sources})
|
||||
set_target_properties(libvgmstream_shared PROPERTIES
|
||||
PREFIX ""
|
||||
OUTPUT_NAME "libvgmstream"
|
||||
)
|
||||
|
||||
if(USE_FFMPEG AND FFMPEG_COMPILE)
|
||||
add_dependencies(libvgmstream_shared avcodec)
|
||||
if(NOT EMSCRIPTEN)
|
||||
add_library(libvgmstream_shared SHARED EXCLUDE_FROM_ALL ${libvgmstream_sources})
|
||||
set_target_properties(libvgmstream_shared PROPERTIES
|
||||
PREFIX ""
|
||||
OUTPUT_NAME "libvgmstream"
|
||||
)
|
||||
|
||||
if(USE_FFMPEG AND FFMPEG_COMPILE)
|
||||
add_dependencies(libvgmstream_shared avcodec)
|
||||
endif()
|
||||
|
||||
setup_target(libvgmstream_shared TRUE)
|
||||
|
||||
target_include_directories(libvgmstream_shared PRIVATE ${libvgmstream_includes})
|
||||
endif()
|
||||
|
||||
setup_target(libvgmstream_shared TRUE)
|
||||
|
||||
target_include_directories(libvgmstream_shared PRIVATE ${libvgmstream_includes})
|
||||
|
Loading…
Reference in New Issue
Block a user