view Samples/build-wasm-SingleFrameViewer.sh @ 1396:dd2b75ee644b

cleanup + build script for RtViewer
author Alain Mazy <alain@mazy.be>
date Wed, 29 Apr 2020 19:00:30 +0200
parents 62dc0d737e7b
children
line wrap: on
line source

#!/bin/bash
#
# usage:
# to build the sample in Debug:
# ./build-wasm-SingleFrameViewer.sh
#
# to build the sample in Debug:
# ./build-wasm-SingleFrameViewer.sh Release

set -e

if [ ! -d "WebAssembly" ]; then
  echo "This script must be run from the Samples folder one level below orthanc-stone"
  exit 1
fi


currentDir=$(pwd)
samplesRootDir=$(pwd)
devrootDir=$(pwd)/../../

buildType=${1:-RelWithDebInfo}
buildFolderName="$devrootDir/out/build-stone-wasm-SingleFrameViewer-$buildType"
installFolderName="$devrootDir/out/install-stone-wasm-SingleFrameViewer-$buildType"

mkdir -p $buildFolderName
# change current folder to the build folder
pushd $buildFolderName

# configure the environment to use Emscripten
source ~/apps/emsdk/emsdk_env.sh

emcmake cmake -G "Ninja" \
  -DCMAKE_BUILD_TYPE=$buildType \
  -DCMAKE_INSTALL_PREFIX=$installFolderName \
  -DSTATIC_BUILD=ON -DALLOW_DOWNLOADS=ON \
  $samplesRootDir/WebAssembly/SingleFrameViewer

# perform build + installation
ninja install

# restore the original working folder
popd

echo "If all went well, the output files can be found in $installFolderName:"

ls $installFolderName