mirror of
https://github.com/vgmstream/vgmstream.git
synced 2024-11-28 00:20:47 +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
|
${{runner.workspace}}/embuild/dependencies/ffmpeg/bin/usr/local/lib
|
||||||
key: wasm-ffmpeg-${{ hashFiles('cmake/dependencies/ffmpeg.cmake') }}
|
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
|
- name: Cache atrac9
|
||||||
uses: actions/cache@v2
|
uses: actions/cache@v2
|
||||||
with:
|
with:
|
||||||
@ -63,6 +70,14 @@ jobs:
|
|||||||
${{runner.workspace}}/embuild/dependencies/libg719_decode/libg719_decode.a
|
${{runner.workspace}}/embuild/dependencies/libg719_decode/libg719_decode.a
|
||||||
key: wasm-g719-${{ hashFiles('cmake/dependencies/g719.cmake') }}
|
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
|
- name: Cache speex
|
||||||
uses: actions/cache@v2
|
uses: actions/cache@v2
|
||||||
with:
|
with:
|
||||||
|
@ -69,6 +69,7 @@ if(NOT WIN32)
|
|||||||
set(CELT0061_PATH CACHE PATH "Path to CELT version 0.6.1")
|
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(CELT0110_PATH CACHE PATH "Path to CELT version 0.11.0")
|
||||||
set(LIBAO_PATH CACHE PATH "Path to libao")
|
set(LIBAO_PATH CACHE PATH "Path to libao")
|
||||||
|
set(JANSSON_PATH CACHE PATH "Path to jansson")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Build choices
|
# Build choices
|
||||||
@ -99,8 +100,6 @@ else()
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(EMSCRIPTEN)
|
if(EMSCRIPTEN)
|
||||||
set(USE_MPEG OFF)
|
|
||||||
set(USE_JANSSON OFF)
|
|
||||||
set(BUILD_V123 OFF)
|
set(BUILD_V123 OFF)
|
||||||
set(BUILD_AUDACIOUS OFF)
|
set(BUILD_AUDACIOUS OFF)
|
||||||
|
|
||||||
|
@ -19,6 +19,7 @@ target_link_libraries(vgmstream_cli libvgmstream)
|
|||||||
# Link to Jansson, if we have it
|
# Link to Jansson, if we have it
|
||||||
if (USE_JANSSON AND JANSSON_FOUND)
|
if (USE_JANSSON AND JANSSON_FOUND)
|
||||||
target_compile_definitions(vgmstream_cli PRIVATE HAVE_JSON)
|
target_compile_definitions(vgmstream_cli PRIVATE HAVE_JSON)
|
||||||
|
target_include_directories(vgmstream_cli PRIVATE ${JANSSON_INCLUDE_DIRS})
|
||||||
target_link_libraries(vgmstream_cli jansson)
|
target_link_libraries(vgmstream_cli jansson)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
@ -1,15 +1,56 @@
|
|||||||
if(NOT WIN32 AND USE_JANSSON)
|
if(NOT WIN32 AND USE_JANSSON)
|
||||||
find_package(PkgConfig REQUIRED)
|
if(NOT JANSSON_PATH AND NOT EMSCRIPTEN)
|
||||||
pkg_check_modules(JANSSON jansson>=2.3)
|
find_package(PkgConfig REQUIRED)
|
||||||
|
pkg_check_modules(JANSSON jansson>=2.3)
|
||||||
|
|
||||||
if(JANSSON_FOUND)
|
if(JANSSON_FOUND)
|
||||||
set(JANSSON_SOURCE "(system)")
|
set(JANSSON_SOURCE "(system)")
|
||||||
set(JANSSON_PKG libjansson)
|
set(JANSSON_PKG libjansson)
|
||||||
|
|
||||||
include_directories(${JANSSON_INCLUDE_DIRS})
|
link_directories(${JANSSON_LIBRARY_DIRS})
|
||||||
link_directories(${JANSSON_LIBRARY_DIRS})
|
endif()
|
||||||
else()
|
endif()
|
||||||
set(USE_JANSSON OFF)
|
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()
|
||||||
endif()
|
endif()
|
||||||
if(NOT USE_JANSSON)
|
if(NOT USE_JANSSON)
|
||||||
|
@ -36,9 +36,22 @@ if(NOT WIN32 AND USE_MPEG)
|
|||||||
)
|
)
|
||||||
endif()
|
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})
|
file(MAKE_DIRECTORY ${MPEG_BIN})
|
||||||
add_custom_target(MPEG_CONFIGURE
|
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
|
DEPENDS ${MPEG_PATH}/configure
|
||||||
BYPRODUCTS ${MPEG_BIN}/Makefile
|
BYPRODUCTS ${MPEG_BIN}/Makefile
|
||||||
WORKING_DIRECTORY ${MPEG_BIN}
|
WORKING_DIRECTORY ${MPEG_BIN}
|
||||||
|
@ -60,16 +60,18 @@ setup_target(libvgmstream)
|
|||||||
target_include_directories(libvgmstream PRIVATE ${libvgmstream_includes})
|
target_include_directories(libvgmstream PRIVATE ${libvgmstream_includes})
|
||||||
|
|
||||||
# libvgmstream.so
|
# libvgmstream.so
|
||||||
add_library(libvgmstream_shared SHARED EXCLUDE_FROM_ALL ${libvgmstream_sources})
|
if(NOT EMSCRIPTEN)
|
||||||
set_target_properties(libvgmstream_shared PROPERTIES
|
add_library(libvgmstream_shared SHARED EXCLUDE_FROM_ALL ${libvgmstream_sources})
|
||||||
PREFIX ""
|
set_target_properties(libvgmstream_shared PROPERTIES
|
||||||
OUTPUT_NAME "libvgmstream"
|
PREFIX ""
|
||||||
)
|
OUTPUT_NAME "libvgmstream"
|
||||||
|
)
|
||||||
|
|
||||||
if(USE_FFMPEG AND FFMPEG_COMPILE)
|
if(USE_FFMPEG AND FFMPEG_COMPILE)
|
||||||
add_dependencies(libvgmstream_shared avcodec)
|
add_dependencies(libvgmstream_shared avcodec)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
setup_target(libvgmstream_shared TRUE)
|
||||||
|
|
||||||
|
target_include_directories(libvgmstream_shared PRIVATE ${libvgmstream_includes})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
setup_target(libvgmstream_shared TRUE)
|
|
||||||
|
|
||||||
target_include_directories(libvgmstream_shared PRIVATE ${libvgmstream_includes})
|
|
||||||
|
Loading…
Reference in New Issue
Block a user