-
Notifications
You must be signed in to change notification settings - Fork 647
/
Copy pathbuild.sh
executable file
·63 lines (47 loc) · 1.27 KB
/
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#
# Copyright (C) 2019 Intel Corporation. All rights reserved.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
#
#!/bin/bash
CURR_DIR=$PWD
WAMR_DIR=${PWD}/../..
OUT_DIR=${PWD}/out
WASM_APPS=${PWD}/wasm-apps
rm -rf ${OUT_DIR}
mkdir ${OUT_DIR}
mkdir ${OUT_DIR}/wasm-apps
echo "##################### build shared-module project"
cd ${CURR_DIR}
mkdir -p cmake_build
cd cmake_build
cmake .. -DCMAKE_BUILD_TYPE=Debug
make -j ${nproc}
if [ $? != 0 ];then
echo "BUILD_FAIL shared-module exit as $?\n"
exit 2
fi
cp -a shared-module ${OUT_DIR}
printf "\n"
echo "##################### build wasm apps"
cd ${WASM_APPS}
for i in `ls *.wat`
do
APP_SRC="$i"
OUT_FILE=${i%.*}.wasm
# Note: the CI installs wabt in /opt/wabt
if type wat2wasm; then
WAT2WASM=${WAT2WASM:-wat2wasm}
elif [ -x /opt/wabt/bin/wat2wasm ]; then
WAT2WASM=${WAT2WASM:-/opt/wabt/bin/wat2wasm}
fi
${WAT2WASM} -o ${OUT_DIR}/wasm-apps/${OUT_FILE} ${APP_SRC}
# aot
# wamrc -o ${OUT_DIR}/wasm-apps/${OUT_FILE}.aot ${OUT_DIR}/wasm-apps/${OUT_FILE}
# mv ${OUT_DIR}/wasm-apps/${OUT_FILE}.aot ${OUT_DIR}/wasm-apps/${OUT_FILE}
if [ -f ${OUT_DIR}/wasm-apps/${OUT_FILE} ]; then
echo "build ${OUT_FILE} success"
else
echo "build ${OUT_FILE} fail"
fi
done
echo "##################### build wasm apps done"