1+ #! /bin/bash
2+ #
3+ # Copyright (c) 2024 Xiaomi Corporation
4+
5+ # Exit on error and print commands
6+ set -ex
7+
8+ echo " === Starting build process for sherpa-onnx WASM combined ==="
9+
10+ # Set environment flag to indicate we're using this script
11+ export SHERPA_ONNX_IS_USING_BUILD_WASM_SH=1
12+
13+ # Create build directory
14+ mkdir -p build-wasm-combined
15+ cd build-wasm-combined
16+
17+ echo " === Running CMake configuration ==="
18+ # Configure with CMake
19+ emcmake cmake \
20+ -DCMAKE_BUILD_TYPE=Release \
21+ -DSHERPA_ONNX_ENABLE_WASM=ON \
22+ -DSHERPA_ONNX_ENABLE_CHECK=OFF \
23+ -DSHERPA_ONNX_ENABLE_PORTAUDIO=OFF \
24+ -DSHERPA_ONNX_ENABLE_BINARY=OFF \
25+ -DSHERPA_ONNX_ENABLE_PYTHON=OFF \
26+ -DSHERPA_ONNX_ENABLE_JNI=OFF \
27+ -DSHERPA_ONNX_ENABLE_C_API=ON \
28+ -DSHERPA_ONNX_ENABLE_TEST=OFF \
29+ -DSHERPA_ONNX_ENABLE_WASM_COMBINED=ON \
30+ -DSHERPA_ONNX_INSTALL_TO_REPO=ON \
31+ ..
32+
33+ echo " === Building the target ==="
34+ # Build the target with full path to the target
35+ emmake make -j $( nproc) sherpa-onnx-wasm-combined
36+
37+ echo " === Installing the files ==="
38+ # Install the files
39+ emmake make install/strip
40+
41+ if [ $? -eq 0 ]; then
42+ echo " === Build completed successfully! ==="
43+ echo " Files have been installed to bin/wasm/combined and copied to wasm/combined/"
44+ else
45+ echo " === Build failed! Check the error messages above ==="
46+ exit 1
47+ fi
0 commit comments