445
|
1 #!/bin/bash
|
|
2
|
|
3 set -e
|
|
4
|
|
5 target=${1:-all}
|
|
6 # this script currently assumes that the wasm code has been built on its side and is availabie in build-wasm/
|
|
7
|
|
8 currentDir=$(pwd)
|
|
9
|
|
10 scriptDirRel=$(dirname $0)
|
|
11 #echo $scriptDirRel
|
|
12 scriptDirAbs=$(realpath $scriptDirRel)
|
|
13 echo $scriptDirAbs
|
|
14
|
|
15 samplesRootDir=scriptDirAbs
|
|
16
|
|
17 outputDir=$samplesRootDir/build-web/
|
|
18 mkdir -p $outputDir
|
|
19
|
|
20 # files used by all single files samples
|
|
21 cp $samplesRootDir/Web/index.html $outputDir
|
|
22 cp $samplesRootDir/Web/samples-styles.css $outputDir
|
|
23
|
|
24 # build simple-viewer-single-file (obsolete project)
|
|
25 if [[ $target == "all" || $target == "OrthancStoneSimpleViewerSingleFile" ]]; then
|
|
26 cp $samplesRootDir/Web/simple-viewer-single-file.html $outputDir
|
|
27 tsc --allowJs --project $samplesRootDir/Web/simple-viewer-single-file.tsconfig.json
|
|
28 cp $currentDir/build-wasm/OrthancStoneSimpleViewerSingleFile.js $outputDir
|
|
29 cp $currentDir/build-wasm/OrthancStoneSimpleViewerSingleFile.wasm $outputDir
|
|
30 fi
|
|
31
|
|
32 # build single-frame
|
|
33 if [[ $target == "all" || $target == "OrthancStoneSingleFrame" ]]; then
|
|
34 cp $samplesRootDir/Web/single-frame.html $outputDir
|
|
35 tsc --allowJs --project $samplesRootDir/Web/single-frame.tsconfig.json
|
|
36 cp $currentDir/build-wasm/OrthancStoneSingleFrame.js $outputDir
|
|
37 cp $currentDir/build-wasm/OrthancStoneSingleFrame.wasm $outputDir
|
|
38 fi
|
|
39
|
|
40 # build single-frame-editor
|
|
41 if [[ $target == "all" || $target == "OrthancStoneSingleFrameEditor" ]]; then
|
|
42 cp $samplesRootDir/Web/single-frame-editor.html $outputDir
|
|
43 tsc --allowJs --project $samplesRootDir/Web/single-frame-editor.tsconfig.json
|
|
44 cp $currentDir/build-wasm/OrthancStoneSingleFrameEditor.js $outputDir
|
|
45 cp $currentDir/build-wasm/OrthancStoneSingleFrameEditor.wasm $outputDir
|
|
46 fi
|
|
47
|
|
48 # build simple-viewer project
|
|
49 if [[ $target == "all" || $target == "OrthancStoneSimpleViewer" ]]; then
|
|
50 mkdir -p $outputDir/simple-viewer/
|
|
51 cp $samplesRootDir/SimpleViewer/Wasm/simple-viewer.html $outputDir/simple-viewer/
|
|
52 cp $samplesRootDir/SimpleViewer/Wasm/styles.css $outputDir/simple-viewer/
|
|
53 tsc --allowJs --project $samplesRootDir/SimpleViewer/Wasm/tsconfig-simple-viewer.json
|
|
54 cp $currentDir/build-wasm/OrthancStoneSimpleViewer.js $outputDir/simple-viewer/
|
|
55 cp $currentDir/build-wasm/OrthancStoneSimpleViewer.wasm $outputDir/simple-viewer/
|
|
56 fi
|
|
57
|
|
58 cd $currentDir
|