mirror of
https://github.com/xhacker-zzz/KgmWasm.git
synced 2024-01-30 00:16:29 +00:00
add build script
This commit is contained in:
parent
02af645a76
commit
e1f07e0f59
40
build-wasm
Normal file
40
build-wasm
Normal file
@ -0,0 +1,40 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
pushd "$(realpath "$(dirname "$0")")"
|
||||
|
||||
CURR_DIR="${PWD}"
|
||||
|
||||
BUILD_TYPE="$1"
|
||||
if [ -z "$BUILD_TYPE" ]; then
|
||||
BUILD_TYPE=Release
|
||||
fi
|
||||
|
||||
mkdir -p build/wasm
|
||||
if [ ! -d build/emsdk ]; then
|
||||
git clone https://github.com/emscripten-core/emsdk.git build/emsdk
|
||||
fi
|
||||
|
||||
pushd build/emsdk
|
||||
#git pull
|
||||
./emsdk install 3.0.0
|
||||
./emsdk activate 3.0.0
|
||||
source ./emsdk_env.sh
|
||||
popd # build/emsdk
|
||||
|
||||
pushd build/wasm
|
||||
emcmake cmake -DCMAKE_BUILD_TYPE="$BUILD_TYPE" ../..
|
||||
make -j
|
||||
TARGET_FILES="
|
||||
KgmLegacy.js
|
||||
KgmWasm.js
|
||||
KgmWasm.wasm
|
||||
KgmWasmBundle.js
|
||||
${CURR_DIR}/LICENSE.txt
|
||||
"
|
||||
|
||||
cp $TARGET_FILES "${CURR_DIR}/npm/"
|
||||
popd # build/wasm
|
||||
|
||||
popd
|
Loading…
Reference in New Issue
Block a user