Refactor WebAssembly build script. (#598)
Make it easier to build WebAssembly for ASR.
This commit is contained in:
106
.github/workflows/wasm-simd-hf-space-de-tts.yaml
vendored
Normal file
106
.github/workflows/wasm-simd-hf-space-de-tts.yaml
vendored
Normal file
@@ -0,0 +1,106 @@
|
|||||||
|
name: wasm-simd-hf-space-de-tts
|
||||||
|
|
||||||
|
on:
|
||||||
|
release:
|
||||||
|
types:
|
||||||
|
- published
|
||||||
|
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: wasm-simd-hf-space-de-tts-${{ github.ref }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
wasm-simd-hf-space-de-tts:
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
os: [ubuntu-latest]
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
- name: Install emsdk
|
||||||
|
uses: mymindstorm/setup-emsdk@v14
|
||||||
|
|
||||||
|
- name: View emsdk version
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
emcc -v
|
||||||
|
echo "--------------------"
|
||||||
|
emcc --check
|
||||||
|
|
||||||
|
- name: Download model files
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
cd wasm/tts/assets
|
||||||
|
ls -lh
|
||||||
|
echo "----------"
|
||||||
|
wget -q https://github.com/k2-fsa/sherpa-onnx/releases/download/tts-models/vits-piper-de_DE-thorsten_emotional-medium.tar.bz2
|
||||||
|
tar xf vits-piper-de_DE-thorsten_emotional-medium.tar.bz2
|
||||||
|
rm vits-piper-de_DE-thorsten_emotional-medium.tar.bz2
|
||||||
|
|
||||||
|
mv -v vits-piper-de_DE-thorsten_emotional-medium/de_DE-thorsten_emotional-medium.onnx ./model.onnx
|
||||||
|
mv -v vits-piper-de_DE-thorsten_emotional-medium/tokens.txt ./
|
||||||
|
mv vits-piper-de_DE-thorsten_emotional-medium/espeak-ng-data ./
|
||||||
|
|
||||||
|
rm -rf vits-piper-de_DE-thorsten_emotional-medium
|
||||||
|
|
||||||
|
ls -lh
|
||||||
|
|
||||||
|
- name: Build sherpa-onnx for WebAssembly
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
./build-wasm-simd-tts.sh
|
||||||
|
|
||||||
|
- name: collect files
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
SHERPA_ONNX_VERSION=v$(grep "SHERPA_ONNX_VERSION" ./CMakeLists.txt | cut -d " " -f 2 | cut -d '"' -f 2)
|
||||||
|
|
||||||
|
mv build-wasm-simd-tts/install/bin/wasm sherpa-onnx-wasm-simd-${SHERPA_ONNX_VERSION}-de-tts
|
||||||
|
ls -lh sherpa-onnx-wasm-simd-${SHERPA_ONNX_VERSION}-de-tts
|
||||||
|
tar cjfv sherpa-onnx-wasm-simd-${SHERPA_ONNX_VERSION}-de-tts.tar.bz2 ./sherpa-onnx-wasm-simd-${SHERPA_ONNX_VERSION}-de-tts
|
||||||
|
|
||||||
|
- name: Upload wasm files
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: sherpa-onnx-wasm-simd-de-tts
|
||||||
|
path: ./sherpa-onnx-wasm-simd-*.tar.bz2
|
||||||
|
|
||||||
|
- name: Publish to huggingface
|
||||||
|
env:
|
||||||
|
HF_TOKEN: ${{ secrets.HF_TOKEN }}
|
||||||
|
uses: nick-fields/retry@v2
|
||||||
|
with:
|
||||||
|
max_attempts: 20
|
||||||
|
timeout_seconds: 200
|
||||||
|
shell: bash
|
||||||
|
command: |
|
||||||
|
SHERPA_ONNX_VERSION=v$(grep "SHERPA_ONNX_VERSION" ./CMakeLists.txt | cut -d " " -f 2 | cut -d '"' -f 2)
|
||||||
|
|
||||||
|
git config --global user.email "csukuangfj@gmail.com"
|
||||||
|
git config --global user.name "Fangjun Kuang"
|
||||||
|
|
||||||
|
rm -rf huggingface
|
||||||
|
export GIT_LFS_SKIP_SMUDGE=1
|
||||||
|
|
||||||
|
git clone https://huggingface.co/spaces/k2-fsa/web-assembly-tts-sherpa-onnx-de huggingface
|
||||||
|
cd huggingface
|
||||||
|
git fetch
|
||||||
|
git pull
|
||||||
|
git merge -m "merge remote" --ff origin main
|
||||||
|
|
||||||
|
cp -v ../sherpa-onnx-wasm-simd-${SHERPA_ONNX_VERSION}-de-tts/* .
|
||||||
|
|
||||||
|
git status
|
||||||
|
git lfs track "*.data"
|
||||||
|
git lfs track "*.wasm"
|
||||||
|
ls -lh
|
||||||
|
|
||||||
|
git add .
|
||||||
|
git commit -m "update model"
|
||||||
|
git push https://csukuangfj:$HF_TOKEN@huggingface.co/spaces/k2-fsa/web-assembly-tts-sherpa-onnx-de main
|
||||||
@@ -1,9 +1,6 @@
|
|||||||
name: wasm-simd-hf-space-en
|
name: wasm-simd-hf-space-en-tts
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- wasm-2
|
|
||||||
release:
|
release:
|
||||||
types:
|
types:
|
||||||
- published
|
- published
|
||||||
@@ -11,11 +8,11 @@ on:
|
|||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
group: wasm-simd-hf-space-en-${{ github.ref }}
|
group: wasm-simd-hf-space-en-tts-${{ github.ref }}
|
||||||
cancel-in-progress: true
|
cancel-in-progress: true
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
wasm-simd-hf-space-en:
|
wasm-simd-hf-space-en-tts:
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
@@ -39,7 +36,7 @@ jobs:
|
|||||||
- name: Download model files
|
- name: Download model files
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
cd wasm/assets
|
cd wasm/tts/assets
|
||||||
ls -lh
|
ls -lh
|
||||||
echo "----------"
|
echo "----------"
|
||||||
wget -q https://github.com/k2-fsa/sherpa-onnx/releases/download/tts-models/vits-piper-en_US-libritts_r-medium.tar.bz2
|
wget -q https://github.com/k2-fsa/sherpa-onnx/releases/download/tts-models/vits-piper-en_US-libritts_r-medium.tar.bz2
|
||||||
@@ -55,21 +52,21 @@ jobs:
|
|||||||
- name: Build sherpa-onnx for WebAssembly
|
- name: Build sherpa-onnx for WebAssembly
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
./build-wasm-simd.sh
|
./build-wasm-simd-tts.sh
|
||||||
|
|
||||||
- name: collect files
|
- name: collect files
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
SHERPA_ONNX_VERSION=v$(grep "SHERPA_ONNX_VERSION" ./CMakeLists.txt | cut -d " " -f 2 | cut -d '"' -f 2)
|
SHERPA_ONNX_VERSION=v$(grep "SHERPA_ONNX_VERSION" ./CMakeLists.txt | cut -d " " -f 2 | cut -d '"' -f 2)
|
||||||
|
|
||||||
mv build-wasm-simd/install/bin/wasm sherpa-onnx-wasm-simd-${SHERPA_ONNX_VERSION}-en
|
mv build-wasm-simd-tts/install/bin/wasm sherpa-onnx-wasm-simd-${SHERPA_ONNX_VERSION}-en-tts
|
||||||
ls -lh sherpa-onnx-wasm-simd-${SHERPA_ONNX_VERSION}-en
|
ls -lh sherpa-onnx-wasm-simd-${SHERPA_ONNX_VERSION}-en-tts
|
||||||
tar cjfv sherpa-onnx-wasm-simd-${SHERPA_ONNX_VERSION}-en.tar.bz2 ./sherpa-onnx-wasm-simd-${SHERPA_ONNX_VERSION}-en
|
tar cjfv sherpa-onnx-wasm-simd-${SHERPA_ONNX_VERSION}-en-tts.tar.bz2 ./sherpa-onnx-wasm-simd-${SHERPA_ONNX_VERSION}-en-tts
|
||||||
|
|
||||||
- name: Upload wasm files
|
- name: Upload wasm files
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: sherpa-onnx-wasm-simd-en
|
name: sherpa-onnx-wasm-simd-en-tts
|
||||||
path: ./sherpa-onnx-wasm-simd-*.tar.bz2
|
path: ./sherpa-onnx-wasm-simd-*.tar.bz2
|
||||||
|
|
||||||
- name: Publish to huggingface
|
- name: Publish to huggingface
|
||||||
@@ -95,7 +92,7 @@ jobs:
|
|||||||
git pull
|
git pull
|
||||||
git merge -m "merge remote" --ff origin main
|
git merge -m "merge remote" --ff origin main
|
||||||
|
|
||||||
cp -v ../sherpa-onnx-wasm-simd-${SHERPA_ONNX_VERSION}-en/* .
|
cp -v ../sherpa-onnx-wasm-simd-${SHERPA_ONNX_VERSION}-en-tts/* .
|
||||||
|
|
||||||
git status
|
git status
|
||||||
git lfs track "*.data"
|
git lfs track "*.data"
|
||||||
@@ -21,6 +21,7 @@ option(SHERPA_ONNX_ENABLE_C_API "Whether to build C API" ON)
|
|||||||
option(SHERPA_ONNX_ENABLE_WEBSOCKET "Whether to build webscoket server/client" ON)
|
option(SHERPA_ONNX_ENABLE_WEBSOCKET "Whether to build webscoket server/client" ON)
|
||||||
option(SHERPA_ONNX_ENABLE_GPU "Enable ONNX Runtime GPU support" OFF)
|
option(SHERPA_ONNX_ENABLE_GPU "Enable ONNX Runtime GPU support" OFF)
|
||||||
option(SHERPA_ONNX_ENABLE_WASM "Whether to enable WASM" OFF)
|
option(SHERPA_ONNX_ENABLE_WASM "Whether to enable WASM" OFF)
|
||||||
|
option(SHERPA_ONNX_ENABLE_WASM_TTS "Whether to enable WASM for TTS" OFF)
|
||||||
option(SHERPA_ONNX_ENABLE_BINARY "Whether to build binaries" ON)
|
option(SHERPA_ONNX_ENABLE_BINARY "Whether to build binaries" ON)
|
||||||
option(SHERPA_ONNX_LINK_LIBSTDCPP_STATICALLY "True to link libstdc++ statically. Used only when BUILD_SHARED_LIBS is OFF on Linux" ON)
|
option(SHERPA_ONNX_LINK_LIBSTDCPP_STATICALLY "True to link libstdc++ statically. Used only when BUILD_SHARED_LIBS is OFF on Linux" ON)
|
||||||
|
|
||||||
@@ -104,6 +105,14 @@ message(STATUS "SHERPA_ONNX_ENABLE_C_API ${SHERPA_ONNX_ENABLE_C_API}")
|
|||||||
message(STATUS "SHERPA_ONNX_ENABLE_WEBSOCKET ${SHERPA_ONNX_ENABLE_WEBSOCKET}")
|
message(STATUS "SHERPA_ONNX_ENABLE_WEBSOCKET ${SHERPA_ONNX_ENABLE_WEBSOCKET}")
|
||||||
message(STATUS "SHERPA_ONNX_ENABLE_GPU ${SHERPA_ONNX_ENABLE_GPU}")
|
message(STATUS "SHERPA_ONNX_ENABLE_GPU ${SHERPA_ONNX_ENABLE_GPU}")
|
||||||
message(STATUS "SHERPA_ONNX_ENABLE_WASM ${SHERPA_ONNX_ENABLE_WASM}")
|
message(STATUS "SHERPA_ONNX_ENABLE_WASM ${SHERPA_ONNX_ENABLE_WASM}")
|
||||||
|
message(STATUS "SHERPA_ONNX_ENABLE_WASM_TTS ${SHERPA_ONNX_ENABLE_WASM_TTS}")
|
||||||
|
|
||||||
|
if(SHERPA_ONNX_ENABLE_WASM_TTS)
|
||||||
|
if(NOT SHERPA_ONNX_ENABLE_WASM)
|
||||||
|
message(FATAL_ERROR "Please set SHERPA_ONNX_ENABLE_WASM to ON if you enable WASM for tts")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
if(SHERPA_ONNX_ENABLE_WASM)
|
if(SHERPA_ONNX_ENABLE_WASM)
|
||||||
add_definitions(-DSHERPA_ONNX_ENABLE_WASM=1)
|
add_definitions(-DSHERPA_ONNX_ENABLE_WASM=1)
|
||||||
endif()
|
endif()
|
||||||
@@ -114,7 +123,6 @@ endif()
|
|||||||
set(CMAKE_CXX_EXTENSIONS OFF)
|
set(CMAKE_CXX_EXTENSIONS OFF)
|
||||||
message(STATUS "C++ Standard version: ${CMAKE_CXX_STANDARD}")
|
message(STATUS "C++ Standard version: ${CMAKE_CXX_STANDARD}")
|
||||||
|
|
||||||
|
|
||||||
include(CheckIncludeFileCXX)
|
include(CheckIncludeFileCXX)
|
||||||
|
|
||||||
if(UNIX AND NOT APPLE AND NOT SHERPA_ONNX_ENABLE_WASM AND NOT CMAKE_SYSTEM_NAME STREQUAL Android)
|
if(UNIX AND NOT APPLE AND NOT SHERPA_ONNX_ENABLE_WASM AND NOT CMAKE_SYSTEM_NAME STREQUAL Android)
|
||||||
|
|||||||
@@ -31,8 +31,8 @@ if [ ! -f $EMSCRIPTEN/cmake/Modules/Platform/Emscripten.cmake ]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
mkdir -p build-wasm-simd
|
mkdir -p build-wasm-simd-tts
|
||||||
pushd build-wasm-simd
|
pushd build-wasm-simd-tts
|
||||||
|
|
||||||
export SHERPA_ONNX_IS_USING_BUILD_WASM_SH=ON
|
export SHERPA_ONNX_IS_USING_BUILD_WASM_SH=ON
|
||||||
|
|
||||||
@@ -51,6 +51,7 @@ cmake \
|
|||||||
-DSHERPA_ONNX_ENABLE_WEBSOCKET=OFF \
|
-DSHERPA_ONNX_ENABLE_WEBSOCKET=OFF \
|
||||||
-DSHERPA_ONNX_ENABLE_GPU=OFF \
|
-DSHERPA_ONNX_ENABLE_GPU=OFF \
|
||||||
-DSHERPA_ONNX_ENABLE_WASM=ON \
|
-DSHERPA_ONNX_ENABLE_WASM=ON \
|
||||||
|
-DSHERPA_ONNX_ENABLE_WASM_TTS=ON \
|
||||||
-DSHERPA_ONNX_ENABLE_BINARY=OFF \
|
-DSHERPA_ONNX_ENABLE_BINARY=OFF \
|
||||||
-DSHERPA_ONNX_LINK_LIBSTDCPP_STATICALLY=OFF \
|
-DSHERPA_ONNX_LINK_LIBSTDCPP_STATICALLY=OFF \
|
||||||
..
|
..
|
||||||
@@ -1,59 +1,3 @@
|
|||||||
if(NOT $ENV{SHERPA_ONNX_IS_USING_BUILD_WASM_SH})
|
if(SHERPA_ONNX_ENABLE_WASM_TTS)
|
||||||
message(FATAL_ERROR "Please use ./build-wasm.sh to build for wasm")
|
add_subdirectory(tts)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/assets/decoder_jit_trace-pnnx.ncnn.bin")
|
|
||||||
message(WARNING "${CMAKE_CURRENT_SOURCE_DIR}/assets/decoder_jit_trace-pnnx.ncnn.bin does not exist")
|
|
||||||
# message(FATAL_ERROR "Please read ${CMAKE_CURRENT_SOURCE_DIR}/assets/README.md before you continue")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
set(exported_functions
|
|
||||||
MyPrint
|
|
||||||
SherpaOnnxCreateOfflineTts
|
|
||||||
SherpaOnnxDestroyOfflineTts
|
|
||||||
SherpaOnnxDestroyOfflineTtsGeneratedAudio
|
|
||||||
SherpaOnnxOfflineTtsGenerate
|
|
||||||
SherpaOnnxOfflineTtsGenerateWithCallback
|
|
||||||
SherpaOnnxOfflineTtsNumSpeakers
|
|
||||||
SherpaOnnxOfflineTtsSampleRate
|
|
||||||
SherpaOnnxWriteWave
|
|
||||||
)
|
|
||||||
set(mangled_exported_functions)
|
|
||||||
foreach(x IN LISTS exported_functions)
|
|
||||||
list(APPEND mangled_exported_functions "_${x}")
|
|
||||||
endforeach()
|
|
||||||
list(JOIN mangled_exported_functions "," all_exported_functions)
|
|
||||||
|
|
||||||
|
|
||||||
include_directories(${CMAKE_SOURCE_DIR})
|
|
||||||
set(MY_FLAGS " -s FORCE_FILESYSTEM=1 -s INITIAL_MEMORY=512MB -s ALLOW_MEMORY_GROWTH=1")
|
|
||||||
string(APPEND MY_FLAGS " -sSTACK_SIZE=10485760 ") # 10MB
|
|
||||||
string(APPEND MY_FLAGS " -sEXPORTED_FUNCTIONS=[_CopyHeap,_malloc,_free,${all_exported_functions}] ")
|
|
||||||
string(APPEND MY_FLAGS "--preload-file ${CMAKE_CURRENT_SOURCE_DIR}/assets@. ")
|
|
||||||
string(APPEND MY_FLAGS " -sEXPORTED_RUNTIME_METHODS=['ccall','stringToUTF8','setValue','getValue'] ")
|
|
||||||
|
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${MY_FLAGS}")
|
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${MY_FLAGS}")
|
|
||||||
set(CMAKE_EXECUTBLE_LINKER_FLAGS "${CMAKE_EXECUTBLE_LINKER_FLAGS} ${MY_FLAGS}")
|
|
||||||
|
|
||||||
if (NOT CMAKE_EXECUTABLE_SUFFIX STREQUAL ".js")
|
|
||||||
message(FATAL_ERROR "The default suffix for building executables should be .js!")
|
|
||||||
endif()
|
|
||||||
# set(CMAKE_EXECUTABLE_SUFFIX ".html")
|
|
||||||
|
|
||||||
add_executable(sherpa-onnx-wasm-main sherpa-onnx-wasm-main.cc)
|
|
||||||
target_link_libraries(sherpa-onnx-wasm-main sherpa-onnx-c-api)
|
|
||||||
install(TARGETS sherpa-onnx-wasm-main DESTINATION bin/wasm)
|
|
||||||
|
|
||||||
install(
|
|
||||||
FILES
|
|
||||||
"$<TARGET_FILE_DIR:sherpa-onnx-wasm-main>/sherpa-onnx-wasm-main.js"
|
|
||||||
"index.html"
|
|
||||||
"sherpa-onnx.js"
|
|
||||||
"app.js"
|
|
||||||
"$<TARGET_FILE_DIR:sherpa-onnx-wasm-main>/sherpa-onnx-wasm-main.wasm"
|
|
||||||
"$<TARGET_FILE_DIR:sherpa-onnx-wasm-main>/sherpa-onnx-wasm-main.data"
|
|
||||||
# "$<TARGET_FILE_DIR:sherpa-onnx-wasm-main>/sherpa-onnx-wasm-main.html"
|
|
||||||
DESTINATION
|
|
||||||
bin/wasm
|
|
||||||
)
|
|
||||||
|
|||||||
58
wasm/tts/CMakeLists.txt
Normal file
58
wasm/tts/CMakeLists.txt
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
if(NOT $ENV{SHERPA_ONNX_IS_USING_BUILD_WASM_SH})
|
||||||
|
message(FATAL_ERROR "Please use ./build-wasm-simd-tts.sh to build for wasm TTS")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/assets/model.onnx")
|
||||||
|
message(FATAL_ERROR "Please read ${CMAKE_CURRENT_SOURCE_DIR}/assets/README.md before you continue")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(exported_functions
|
||||||
|
MyPrint
|
||||||
|
SherpaOnnxCreateOfflineTts
|
||||||
|
SherpaOnnxDestroyOfflineTts
|
||||||
|
SherpaOnnxDestroyOfflineTtsGeneratedAudio
|
||||||
|
SherpaOnnxOfflineTtsGenerate
|
||||||
|
SherpaOnnxOfflineTtsGenerateWithCallback
|
||||||
|
SherpaOnnxOfflineTtsNumSpeakers
|
||||||
|
SherpaOnnxOfflineTtsSampleRate
|
||||||
|
SherpaOnnxWriteWave
|
||||||
|
)
|
||||||
|
set(mangled_exported_functions)
|
||||||
|
foreach(x IN LISTS exported_functions)
|
||||||
|
list(APPEND mangled_exported_functions "_${x}")
|
||||||
|
endforeach()
|
||||||
|
list(JOIN mangled_exported_functions "," all_exported_functions)
|
||||||
|
|
||||||
|
|
||||||
|
include_directories(${CMAKE_SOURCE_DIR})
|
||||||
|
set(MY_FLAGS " -s FORCE_FILESYSTEM=1 -s INITIAL_MEMORY=512MB -s ALLOW_MEMORY_GROWTH=1")
|
||||||
|
string(APPEND MY_FLAGS " -sSTACK_SIZE=10485760 ") # 10MB
|
||||||
|
string(APPEND MY_FLAGS " -sEXPORTED_FUNCTIONS=[_CopyHeap,_malloc,_free,${all_exported_functions}] ")
|
||||||
|
string(APPEND MY_FLAGS "--preload-file ${CMAKE_CURRENT_SOURCE_DIR}/assets@. ")
|
||||||
|
string(APPEND MY_FLAGS " -sEXPORTED_RUNTIME_METHODS=['ccall','stringToUTF8','setValue','getValue'] ")
|
||||||
|
|
||||||
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${MY_FLAGS}")
|
||||||
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${MY_FLAGS}")
|
||||||
|
set(CMAKE_EXECUTBLE_LINKER_FLAGS "${CMAKE_EXECUTBLE_LINKER_FLAGS} ${MY_FLAGS}")
|
||||||
|
|
||||||
|
if (NOT CMAKE_EXECUTABLE_SUFFIX STREQUAL ".js")
|
||||||
|
message(FATAL_ERROR "The default suffix for building executables should be .js!")
|
||||||
|
endif()
|
||||||
|
# set(CMAKE_EXECUTABLE_SUFFIX ".html")
|
||||||
|
|
||||||
|
add_executable(sherpa-onnx-wasm-main sherpa-onnx-wasm-main.cc)
|
||||||
|
target_link_libraries(sherpa-onnx-wasm-main sherpa-onnx-c-api)
|
||||||
|
install(TARGETS sherpa-onnx-wasm-main DESTINATION bin/wasm)
|
||||||
|
|
||||||
|
install(
|
||||||
|
FILES
|
||||||
|
"$<TARGET_FILE_DIR:sherpa-onnx-wasm-main>/sherpa-onnx-wasm-main.js"
|
||||||
|
"index.html"
|
||||||
|
"sherpa-onnx.js"
|
||||||
|
"app.js"
|
||||||
|
"$<TARGET_FILE_DIR:sherpa-onnx-wasm-main>/sherpa-onnx-wasm-main.wasm"
|
||||||
|
"$<TARGET_FILE_DIR:sherpa-onnx-wasm-main>/sherpa-onnx-wasm-main.data"
|
||||||
|
# "$<TARGET_FILE_DIR:sherpa-onnx-wasm-main>/sherpa-onnx-wasm-main.html"
|
||||||
|
DESTINATION
|
||||||
|
bin/wasm
|
||||||
|
)
|
||||||
@@ -18,7 +18,7 @@ rm -rf vits-piper-en_US-libritts_r-medium
|
|||||||
```
|
```
|
||||||
|
|
||||||
You should have the following files in `assets` before you can run
|
You should have the following files in `assets` before you can run
|
||||||
`build-wasm-simd.sh`
|
`build-wasm-simd-tts.sh`
|
||||||
|
|
||||||
```
|
```
|
||||||
assets fangjun$ tree -L 1
|
assets fangjun$ tree -L 1
|
||||||
Reference in New Issue
Block a user