annotate Samples/build-wasm-samples.sh @ 1419:f5493e5a51a3

single CMakeLists.txt for all SDL samples & unit tests + another one for all Wasm samples
author Alain Mazy <alain@mazy.be>
date Wed, 13 May 2020 12:42:52 +0200
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1419
f5493e5a51a3 single CMakeLists.txt for all SDL samples & unit tests + another one for all Wasm samples
Alain Mazy <alain@mazy.be>
parents:
diff changeset
1 #!/bin/bash
f5493e5a51a3 single CMakeLists.txt for all SDL samples & unit tests + another one for all Wasm samples
Alain Mazy <alain@mazy.be>
parents:
diff changeset
2 #
f5493e5a51a3 single CMakeLists.txt for all SDL samples & unit tests + another one for all Wasm samples
Alain Mazy <alain@mazy.be>
parents:
diff changeset
3 # usage:
f5493e5a51a3 single CMakeLists.txt for all SDL samples & unit tests + another one for all Wasm samples
Alain Mazy <alain@mazy.be>
parents:
diff changeset
4 # to build the samples in RelWithDebInfo:
f5493e5a51a3 single CMakeLists.txt for all SDL samples & unit tests + another one for all Wasm samples
Alain Mazy <alain@mazy.be>
parents:
diff changeset
5 # ./build-wasm-samples.sh
f5493e5a51a3 single CMakeLists.txt for all SDL samples & unit tests + another one for all Wasm samples
Alain Mazy <alain@mazy.be>
parents:
diff changeset
6 #
f5493e5a51a3 single CMakeLists.txt for all SDL samples & unit tests + another one for all Wasm samples
Alain Mazy <alain@mazy.be>
parents:
diff changeset
7 # to build the samples in Release:
f5493e5a51a3 single CMakeLists.txt for all SDL samples & unit tests + another one for all Wasm samples
Alain Mazy <alain@mazy.be>
parents:
diff changeset
8 # ./build-wasm-samples.sh Release
f5493e5a51a3 single CMakeLists.txt for all SDL samples & unit tests + another one for all Wasm samples
Alain Mazy <alain@mazy.be>
parents:
diff changeset
9
f5493e5a51a3 single CMakeLists.txt for all SDL samples & unit tests + another one for all Wasm samples
Alain Mazy <alain@mazy.be>
parents:
diff changeset
10 set -e
f5493e5a51a3 single CMakeLists.txt for all SDL samples & unit tests + another one for all Wasm samples
Alain Mazy <alain@mazy.be>
parents:
diff changeset
11
f5493e5a51a3 single CMakeLists.txt for all SDL samples & unit tests + another one for all Wasm samples
Alain Mazy <alain@mazy.be>
parents:
diff changeset
12 if [ ! -d "WebAssembly" ]; then
f5493e5a51a3 single CMakeLists.txt for all SDL samples & unit tests + another one for all Wasm samples
Alain Mazy <alain@mazy.be>
parents:
diff changeset
13 echo "This script must be run from the Samples folder one level below orthanc-stone"
f5493e5a51a3 single CMakeLists.txt for all SDL samples & unit tests + another one for all Wasm samples
Alain Mazy <alain@mazy.be>
parents:
diff changeset
14 exit 1
f5493e5a51a3 single CMakeLists.txt for all SDL samples & unit tests + another one for all Wasm samples
Alain Mazy <alain@mazy.be>
parents:
diff changeset
15 fi
f5493e5a51a3 single CMakeLists.txt for all SDL samples & unit tests + another one for all Wasm samples
Alain Mazy <alain@mazy.be>
parents:
diff changeset
16
f5493e5a51a3 single CMakeLists.txt for all SDL samples & unit tests + another one for all Wasm samples
Alain Mazy <alain@mazy.be>
parents:
diff changeset
17
f5493e5a51a3 single CMakeLists.txt for all SDL samples & unit tests + another one for all Wasm samples
Alain Mazy <alain@mazy.be>
parents:
diff changeset
18 currentDir=$(pwd)
f5493e5a51a3 single CMakeLists.txt for all SDL samples & unit tests + another one for all Wasm samples
Alain Mazy <alain@mazy.be>
parents:
diff changeset
19 samplesRootDir=$(pwd)
f5493e5a51a3 single CMakeLists.txt for all SDL samples & unit tests + another one for all Wasm samples
Alain Mazy <alain@mazy.be>
parents:
diff changeset
20 devrootDir=$(pwd)/../../
f5493e5a51a3 single CMakeLists.txt for all SDL samples & unit tests + another one for all Wasm samples
Alain Mazy <alain@mazy.be>
parents:
diff changeset
21
f5493e5a51a3 single CMakeLists.txt for all SDL samples & unit tests + another one for all Wasm samples
Alain Mazy <alain@mazy.be>
parents:
diff changeset
22 buildType=${1:-RelWithDebInfo}
f5493e5a51a3 single CMakeLists.txt for all SDL samples & unit tests + another one for all Wasm samples
Alain Mazy <alain@mazy.be>
parents:
diff changeset
23 buildFolderName="$devrootDir/out/build-stone-wasm-samples-$buildType"
f5493e5a51a3 single CMakeLists.txt for all SDL samples & unit tests + another one for all Wasm samples
Alain Mazy <alain@mazy.be>
parents:
diff changeset
24 installFolderName="$devrootDir/out/install-stone-wasm-samples-$buildType"
f5493e5a51a3 single CMakeLists.txt for all SDL samples & unit tests + another one for all Wasm samples
Alain Mazy <alain@mazy.be>
parents:
diff changeset
25
f5493e5a51a3 single CMakeLists.txt for all SDL samples & unit tests + another one for all Wasm samples
Alain Mazy <alain@mazy.be>
parents:
diff changeset
26 mkdir -p $buildFolderName
f5493e5a51a3 single CMakeLists.txt for all SDL samples & unit tests + another one for all Wasm samples
Alain Mazy <alain@mazy.be>
parents:
diff changeset
27 # change current folder to the build folder
f5493e5a51a3 single CMakeLists.txt for all SDL samples & unit tests + another one for all Wasm samples
Alain Mazy <alain@mazy.be>
parents:
diff changeset
28 pushd $buildFolderName
f5493e5a51a3 single CMakeLists.txt for all SDL samples & unit tests + another one for all Wasm samples
Alain Mazy <alain@mazy.be>
parents:
diff changeset
29
f5493e5a51a3 single CMakeLists.txt for all SDL samples & unit tests + another one for all Wasm samples
Alain Mazy <alain@mazy.be>
parents:
diff changeset
30 # configure the environment to use Emscripten
f5493e5a51a3 single CMakeLists.txt for all SDL samples & unit tests + another one for all Wasm samples
Alain Mazy <alain@mazy.be>
parents:
diff changeset
31 source ~/apps/emsdk/emsdk_env.sh
f5493e5a51a3 single CMakeLists.txt for all SDL samples & unit tests + another one for all Wasm samples
Alain Mazy <alain@mazy.be>
parents:
diff changeset
32
f5493e5a51a3 single CMakeLists.txt for all SDL samples & unit tests + another one for all Wasm samples
Alain Mazy <alain@mazy.be>
parents:
diff changeset
33 emcmake cmake -G "Ninja" \
f5493e5a51a3 single CMakeLists.txt for all SDL samples & unit tests + another one for all Wasm samples
Alain Mazy <alain@mazy.be>
parents:
diff changeset
34 -DCMAKE_BUILD_TYPE=$buildType \
f5493e5a51a3 single CMakeLists.txt for all SDL samples & unit tests + another one for all Wasm samples
Alain Mazy <alain@mazy.be>
parents:
diff changeset
35 -DCMAKE_INSTALL_PREFIX=$installFolderName \
f5493e5a51a3 single CMakeLists.txt for all SDL samples & unit tests + another one for all Wasm samples
Alain Mazy <alain@mazy.be>
parents:
diff changeset
36 -DSTATIC_BUILD=ON -DALLOW_DOWNLOADS=ON \
f5493e5a51a3 single CMakeLists.txt for all SDL samples & unit tests + another one for all Wasm samples
Alain Mazy <alain@mazy.be>
parents:
diff changeset
37 $samplesRootDir/WebAssembly
f5493e5a51a3 single CMakeLists.txt for all SDL samples & unit tests + another one for all Wasm samples
Alain Mazy <alain@mazy.be>
parents:
diff changeset
38
f5493e5a51a3 single CMakeLists.txt for all SDL samples & unit tests + another one for all Wasm samples
Alain Mazy <alain@mazy.be>
parents:
diff changeset
39 # perform build + installation
f5493e5a51a3 single CMakeLists.txt for all SDL samples & unit tests + another one for all Wasm samples
Alain Mazy <alain@mazy.be>
parents:
diff changeset
40 ninja
f5493e5a51a3 single CMakeLists.txt for all SDL samples & unit tests + another one for all Wasm samples
Alain Mazy <alain@mazy.be>
parents:
diff changeset
41 ninja install
f5493e5a51a3 single CMakeLists.txt for all SDL samples & unit tests + another one for all Wasm samples
Alain Mazy <alain@mazy.be>
parents:
diff changeset
42
f5493e5a51a3 single CMakeLists.txt for all SDL samples & unit tests + another one for all Wasm samples
Alain Mazy <alain@mazy.be>
parents:
diff changeset
43 # restore the original working folder
f5493e5a51a3 single CMakeLists.txt for all SDL samples & unit tests + another one for all Wasm samples
Alain Mazy <alain@mazy.be>
parents:
diff changeset
44 popd
f5493e5a51a3 single CMakeLists.txt for all SDL samples & unit tests + another one for all Wasm samples
Alain Mazy <alain@mazy.be>
parents:
diff changeset
45
f5493e5a51a3 single CMakeLists.txt for all SDL samples & unit tests + another one for all Wasm samples
Alain Mazy <alain@mazy.be>
parents:
diff changeset
46 echo "If all went well, the output files can be found in $installFolderName:"
f5493e5a51a3 single CMakeLists.txt for all SDL samples & unit tests + another one for all Wasm samples
Alain Mazy <alain@mazy.be>
parents:
diff changeset
47
f5493e5a51a3 single CMakeLists.txt for all SDL samples & unit tests + another one for all Wasm samples
Alain Mazy <alain@mazy.be>
parents:
diff changeset
48 ls $installFolderName