445
|
1 #!/bin/bash
|
|
2 #
|
|
3 # usage:
|
|
4 # to build all targets:
|
|
5 # ./build-wasm.sh
|
|
6 #
|
|
7 # to build a single target:
|
|
8 # ./build-wasm.sh OrthancStoneSingleFrameEditor
|
|
9
|
|
10 set -e
|
|
11
|
|
12 target=${1:-all}
|
|
13
|
|
14 # we will create the output files in a "build-wasm" folder in current location
|
|
15
|
|
16 # let's save current dir
|
|
17 currentDir=$(pwd)
|
|
18
|
|
19 scriptDirRel=$(dirname $0)
|
|
20 #echo $scriptDirRel
|
|
21 scriptDirAbs=$(realpath $scriptDirRel)
|
|
22 echo $scriptDirAbs
|
|
23
|
|
24 pushd
|
|
25 # echo "$0"
|
|
26 # echo $BASH_SOURCE
|
|
27 # echo "$BASH_SOURCE"
|
|
28 # scriptDir=dirname $0
|
|
29 # echo "***********"
|
|
30 # echo "***********"
|
|
31
|
|
32 #echo "Script folder is"
|
|
33 #echo "$(cd "$(dirname "$BASH_SOURCE")"; pwd)/$(basename ""$BASH_SOURCE")"
|
|
34
|
|
35 #samplesRootDir=$(pwd)
|
|
36 samplesRootDir=${scriptDirAbs}
|
|
37 echo "samplesRootDir = " ${samplesRootDir}
|
|
38
|
|
39 mkdir -p build-wasm
|
|
40 cd build-wasm
|
|
41
|
|
42 source ~/apps/emsdk/emsdk_env.sh
|
|
43 cmake -DCMAKE_TOOLCHAIN_FILE=${EMSCRIPTEN}/cmake/Modules/Platform/Emscripten.cmake -DCMAKE_BUILD_TYPE=Release -DSTONE_SOURCES_DIR=$samplesRootDir/../.. -DORTHANC_FRAMEWORK_SOURCE=path -DORTHANC_FRAMEWORK_ROOT=$samplesRootDir/../../../orthanc -DALLOW_DOWNLOADS=ON $samplesRootDir -DENABLE_WASM=ON
|
|
44 make -j 5 $target
|
|
45
|
|
46 echo "-- building the web application -- "
|
|
47 cd ${samplesRootDir}
|
|
48 ./build-web-ext.sh
|
|
49
|
|
50 popd
|