-
Notifications
You must be signed in to change notification settings - Fork 42
/
wasm_build.sh
executable file
·68 lines (50 loc) · 1.68 KB
/
wasm_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
64
65
66
67
if [ -z $1 ]; then
if [ ! -z $QT_ROOT_DIR ]; then
QT_ROOT=$QT_ROOT_DIR/..
else
QT_ROOT=~/Qt/6.6.2
fi
else
QT_ROOT=$1
fi
if [ ! -d $QT_ROOT ]; then
echo "invalid QT root '$QT_ROOT'";
exit 1
fi
if [ -z $2 ]; then
if [ ! -z $EMSDK ]; then
EMSDK_ROOT=$EMSDK
else
EMSDK_ROOT=~/Development/emsdk
fi
else
EMSDK_ROOT=$2
fi
if [ ! -d $EMSDK_ROOT ]; then
echo "invalid EMSDK root '$EMSDK_ROOT'";
exit 2
fi
export QT_DIR=$QT_ROOT/wasm_singlethread
export QT_HOST_PATH=$QT_ROOT/gcc_64
if [ ! -d $QT_HOST_PATH ]; then
echo "invalid QT_HOST_PATH root '$QT_HOST_PATH'";
exit 3
fi
export CMAKE_PREFIX_PATH=${QT_DIR}/lib/cmake
mkdir -p build
pushd build
export EMSDK=$EMSDK_ROOT
export _QT_TOOLCHAIN_VARS_INITIALIZED=1
export _QT_TOOLCHAIN_QT_CHAINLOAD_TOOLCHAIN_FILE=${EMSDK}/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake
export _QT_TOOLCHAIN_QT_TOOLCHAIN_INCLUDE_FILE=
export _QT_TOOLCHAIN_QT_TOOLCHAIN_RELOCATABLE_CMAKE_DIR="bing2"
export _QT_TOOLCHAIN_QT_TOOLCHAIN_RELOCATABLE_PREFIX="bing3"
export _QT_TOOLCHAIN_QT_ADDITIONAL_PACKAGES_PREFIX_PATH="bing4"
CPPCOMPILER=$EMSDK/upstream/emscripten/em++
CCOMPILER=$EMSDK/upstream/emscripten/emcc
QMAKE=$QT_ROOT/wasm_singlethread/bin/qmake
BEFORE=$(pwd)/../setup/auto-setup.cmake
TOOL_CHAIN=$QT_ROOT/wasm_singlethread/lib/cmake/Qt6/qt.toolchain.cmake
cmake -S .. -B . -G Ninja -DCMAKE_BUILD_TYPE=Debug -DCMAKE_PROJECT_INCLUDE_BEFORE=$BEFORE -DQT_QMAKE_EXECUTABLE=$QMAKE -DCMAKE_PREFIX_PATH=$QT_DIR -DCMAKE_C_COMPILER=$CCOMPILER -DCMAKE_CXX_COMPILER=$CPPCOMPILER -DCMAKE_TOOLCHAIN_FILE=$TOOL_CHAIN -DQT_HOST_PATH=$QT_HOST_PATH
cmake --build . --config Release
popd