-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sh
executable file
·45 lines (34 loc) · 990 Bytes
/
build.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/bin/bash
BUILD_CONFIG=$1
if [ -z "$1" ] ; then
BUILD_CONFIG=release
fi
BUILD_PLATFORM=$2
if [ -z "$2" ] ; then
BUILD_PLATFORM=wasm
fi
BUILD_DIR=build_${BUILD_PLATFORM}_${BUILD_CONFIG}
# Clean-up
rm -f $BUILD_DIR/clp-wasm.js*
if [ $BUILD_PLATFORM == "wasm" ]; then
echo 'Running wasm build ... '
source /emsdk/emsdk_env.sh
cmake -G Ninja -B$BUILD_DIR \
-DCMAKE_BUILD_TYPE=${BUILD_CONFIG} \
-DCMAKE_MODULE_PATH=$EMSDK/upstream/emscripten/cmake \
-DCMAKE_TOOLCHAIN_FILE=$EMSDK/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake .
fi
if [ $BUILD_PLATFORM == "x64" ]; then
echo 'Running x64 build ... '
cmake -G Ninja -B$BUILD_DIR \
-DCMAKE_BUILD_TYPE=${BUILD_CONFIG} .
fi
pushd $BUILD_DIR && ninja
popd
if [ $BUILD_PLATFORM == "wasm" ]; then
cp $BUILD_DIR/clp-*.wasm* .
cp $BUILD_DIR/clp-*.js* .
node bundle-with-wasm.js
#cp $BUILD_DIR/clp-*.wasm* example/
cp ./clp-wasm.all.js example/
fi