mirror of
https://github.com/vgmstream/vgmstream.git
synced 2025-02-19 20:12:52 +01:00
Merge pull request #944 from LoveEevee/wasm-speex
Cmake: Compile speex for wasm target
This commit is contained in:
commit
141ab615db
@ -73,6 +73,7 @@ if(NOT WIN32)
|
|||||||
set(FFMPEG_PATH CACHE PATH "Path to FFmpeg")
|
set(FFMPEG_PATH CACHE PATH "Path to FFmpeg")
|
||||||
set(G719_PATH CACHE PATH "Path to G.719 decoder")
|
set(G719_PATH CACHE PATH "Path to G.719 decoder")
|
||||||
set(ATRAC9_PATH CACHE PATH "Path to LibAtrac9")
|
set(ATRAC9_PATH CACHE PATH "Path to LibAtrac9")
|
||||||
|
set(SPEEX_PATH CACHE PATH "Path to SPEEX")
|
||||||
set(LIBAO_PATH CACHE PATH "Path to libao")
|
set(LIBAO_PATH CACHE PATH "Path to libao")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
@ -438,12 +439,12 @@ if(NOT WIN32)
|
|||||||
if(NOT EXISTS ${ATRAC9_LINK_PATH})
|
if(NOT EXISTS ${ATRAC9_LINK_PATH})
|
||||||
if(EMSCRIPTEN)
|
if(EMSCRIPTEN)
|
||||||
add_custom_target(ATRAC9_MAKE ALL
|
add_custom_target(ATRAC9_MAKE ALL
|
||||||
COMMAND emmake make static CFLAGS="-fPIC" CC=emcc AR=emar BINDIR=embin
|
COMMAND make clean && emmake make static CFLAGS="-fPIC" CC=emcc AR=emar BINDIR=embin
|
||||||
WORKING_DIRECTORY ${ATRAC9_PATH}/C
|
WORKING_DIRECTORY ${ATRAC9_PATH}/C
|
||||||
)
|
)
|
||||||
else()
|
else()
|
||||||
add_custom_target(ATRAC9_MAKE ALL
|
add_custom_target(ATRAC9_MAKE ALL
|
||||||
COMMAND make static CFLAGS="-fPIC"
|
COMMAND make clean && make static CFLAGS="-fPIC"
|
||||||
WORKING_DIRECTORY ${ATRAC9_PATH}/C
|
WORKING_DIRECTORY ${ATRAC9_PATH}/C
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
@ -455,9 +456,52 @@ if(NOT WIN32)
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
if(USE_SPEEX)
|
if(USE_SPEEX)
|
||||||
find_package(Speex)
|
if(NOT SPEEX_PATH)
|
||||||
if(NOT Speex_FOUND)
|
find_package(Speex QUIET)
|
||||||
set(USE_SPEEX OFF)
|
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()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
@ -369,16 +369,17 @@ Follow emscripten's installation instructions:
|
|||||||
- https://emscripten.org/docs/getting_started/downloads.html
|
- https://emscripten.org/docs/getting_started/downloads.html
|
||||||
- https://emscripten.org/docs/compiling/Building-Projects.html#building-projects
|
- https://emscripten.org/docs/compiling/Building-Projects.html#building-projects
|
||||||
|
|
||||||
Then should be buildable on Linux (Windows should be possible too but has some issues at the moment), for example:
|
Then you should be able to build it on Linux (Windows would be possible too, but it has some issues at the moment), for example:
|
||||||
```
|
```
|
||||||
git clone https://github.com/vgmstream/vgmstream
|
git clone https://github.com/vgmstream/vgmstream
|
||||||
cd vgmstream
|
cd vgmstream
|
||||||
mkdir -p build && cd build
|
mkdir -p embuild && cd embuild
|
||||||
|
|
||||||
# quickest example, some can be enabled
|
emcmake cmake -S .. -B .
|
||||||
emcmake cmake -DBUILD_STATIC=ON -DUSE_JANSSON=OFF -DUSE_FFMPEG=OFF -DUSE_VORBIS=OFF -DUSE_MPEG=OFF -DUSE_G7221=OFF -DUSE_G719=OFF -DUSE_ATRAC9=OFF -DUSE_SPEEX=OFF -DUSE_MPEG=OFF -S .. -B .
|
|
||||||
emmake make
|
emmake make
|
||||||
```
|
```
|
||||||
|
The output files `vgmstream-cli.wasm` and `vgmstream-cli.js` will be located in the `embuild/cli` directory.
|
||||||
|
|
||||||
Or with the base makefiles (may need to rename output to .js ATM):
|
Or with the base makefiles (may need to rename output to .js ATM):
|
||||||
```
|
```
|
||||||
git clone https://github.com/vgmstream/vgmstream
|
git clone https://github.com/vgmstream/vgmstream
|
||||||
|
Loading…
x
Reference in New Issue
Block a user