annotate Applications/Samples/build-web.sh @ 1186:3284c3fd96ad broker

merge
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 22 Nov 2019 09:51:47 +0100
parents 5055031f4a06
children f417a0ae282b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
295
b04b13810540 unified CMakeLists.txt into a single file for WASM/Native + bootstrap Command (to rework) + doc
am@osimis.io
parents:
diff changeset
1 #!/bin/bash
b04b13810540 unified CMakeLists.txt into a single file for WASM/Native + bootstrap Command (to rework) + doc
am@osimis.io
parents:
diff changeset
2
307
be2660b6e40a wip: commands + status update
am@osimis.io
parents: 295
diff changeset
3 set -e
be2660b6e40a wip: commands + status update
am@osimis.io
parents: 295
diff changeset
4
435
e641d3978856 WasmWebService now using BaseWebService and supporting cache
am@osimis.io
parents: 326
diff changeset
5 target=${1:-all}
319
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents: 307
diff changeset
6 # this script currently assumes that the wasm code has been built on its side and is availabie in build-wasm/
295
b04b13810540 unified CMakeLists.txt into a single file for WASM/Native + bootstrap Command (to rework) + doc
am@osimis.io
parents:
diff changeset
7
b04b13810540 unified CMakeLists.txt into a single file for WASM/Native + bootstrap Command (to rework) + doc
am@osimis.io
parents:
diff changeset
8 currentDir=$(pwd)
b04b13810540 unified CMakeLists.txt into a single file for WASM/Native + bootstrap Command (to rework) + doc
am@osimis.io
parents:
diff changeset
9 samplesRootDir=$(pwd)
b04b13810540 unified CMakeLists.txt into a single file for WASM/Native + bootstrap Command (to rework) + doc
am@osimis.io
parents:
diff changeset
10
466
5055031f4a06 - Added browserify to build. This allows using require calls for modules that
bgo-osimis
parents: 435
diff changeset
11 echo "*************************************************************************"
5055031f4a06 - Added browserify to build. This allows using require calls for modules that
bgo-osimis
parents: 435
diff changeset
12 echo "samplesRootDir = $samplesRootDir"
5055031f4a06 - Added browserify to build. This allows using require calls for modules that
bgo-osimis
parents: 435
diff changeset
13 echo "*************************************************************************"
5055031f4a06 - Added browserify to build. This allows using require calls for modules that
bgo-osimis
parents: 435
diff changeset
14
295
b04b13810540 unified CMakeLists.txt into a single file for WASM/Native + bootstrap Command (to rework) + doc
am@osimis.io
parents:
diff changeset
15 outputDir=$samplesRootDir/build-web/
466
5055031f4a06 - Added browserify to build. This allows using require calls for modules that
bgo-osimis
parents: 435
diff changeset
16 mkdir -p "$outputDir"
295
b04b13810540 unified CMakeLists.txt into a single file for WASM/Native + bootstrap Command (to rework) + doc
am@osimis.io
parents:
diff changeset
17
319
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents: 307
diff changeset
18 # files used by all single files samples
466
5055031f4a06 - Added browserify to build. This allows using require calls for modules that
bgo-osimis
parents: 435
diff changeset
19 cp "$samplesRootDir/Web/index.html" "$outputDir"
5055031f4a06 - Added browserify to build. This allows using require calls for modules that
bgo-osimis
parents: 435
diff changeset
20 cp "$samplesRootDir/Web/samples-styles.css" "$outputDir"
295
b04b13810540 unified CMakeLists.txt into a single file for WASM/Native + bootstrap Command (to rework) + doc
am@osimis.io
parents:
diff changeset
21
319
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents: 307
diff changeset
22 # build simple-viewer-single-file (obsolete project)
435
e641d3978856 WasmWebService now using BaseWebService and supporting cache
am@osimis.io
parents: 326
diff changeset
23 if [[ $target == "all" || $target == "OrthancStoneSimpleViewerSingleFile" ]]; then
e641d3978856 WasmWebService now using BaseWebService and supporting cache
am@osimis.io
parents: 326
diff changeset
24 cp $samplesRootDir/Web/simple-viewer-single-file.html $outputDir
466
5055031f4a06 - Added browserify to build. This allows using require calls for modules that
bgo-osimis
parents: 435
diff changeset
25 tsc --project $samplesRootDir/Web/simple-viewer-single-file.tsconfig.json --outDir "$outputDir"
5055031f4a06 - Added browserify to build. This allows using require calls for modules that
bgo-osimis
parents: 435
diff changeset
26 browserify \
5055031f4a06 - Added browserify to build. This allows using require calls for modules that
bgo-osimis
parents: 435
diff changeset
27 "$outputDir/Platforms/Wasm/wasm-application-runner.js" \
5055031f4a06 - Added browserify to build. This allows using require calls for modules that
bgo-osimis
parents: 435
diff changeset
28 "$outputDir/Applications/Samples/Web/simple-viewer-single-file.js" \
5055031f4a06 - Added browserify to build. This allows using require calls for modules that
bgo-osimis
parents: 435
diff changeset
29 -o "$outputDir/app-simple-viewer-single-file.js"
5055031f4a06 - Added browserify to build. This allows using require calls for modules that
bgo-osimis
parents: 435
diff changeset
30 cp "$currentDir/build-wasm/OrthancStoneSimpleViewerSingleFile.js" $outputDir
5055031f4a06 - Added browserify to build. This allows using require calls for modules that
bgo-osimis
parents: 435
diff changeset
31 cp "$currentDir/build-wasm/OrthancStoneSimpleViewerSingleFile.wasm" $outputDir
435
e641d3978856 WasmWebService now using BaseWebService and supporting cache
am@osimis.io
parents: 326
diff changeset
32 fi
319
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents: 307
diff changeset
33
326
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents: 319
diff changeset
34 # build single-frame
435
e641d3978856 WasmWebService now using BaseWebService and supporting cache
am@osimis.io
parents: 326
diff changeset
35 if [[ $target == "all" || $target == "OrthancStoneSingleFrame" ]]; then
e641d3978856 WasmWebService now using BaseWebService and supporting cache
am@osimis.io
parents: 326
diff changeset
36 cp $samplesRootDir/Web/single-frame.html $outputDir
466
5055031f4a06 - Added browserify to build. This allows using require calls for modules that
bgo-osimis
parents: 435
diff changeset
37 tsc --project $samplesRootDir/Web/single-frame.tsconfig.json --outDir "$outputDir"
5055031f4a06 - Added browserify to build. This allows using require calls for modules that
bgo-osimis
parents: 435
diff changeset
38 browserify \
5055031f4a06 - Added browserify to build. This allows using require calls for modules that
bgo-osimis
parents: 435
diff changeset
39 "$outputDir/Platforms/Wasm/wasm-application-runner.js" \
5055031f4a06 - Added browserify to build. This allows using require calls for modules that
bgo-osimis
parents: 435
diff changeset
40 "$outputDir/Applications/Samples/Web/single-frame.js" \
5055031f4a06 - Added browserify to build. This allows using require calls for modules that
bgo-osimis
parents: 435
diff changeset
41 -o "$outputDir/app-single-frame.js"
5055031f4a06 - Added browserify to build. This allows using require calls for modules that
bgo-osimis
parents: 435
diff changeset
42 cp "$currentDir/build-wasm/OrthancStoneSingleFrame.js" $outputDir
5055031f4a06 - Added browserify to build. This allows using require calls for modules that
bgo-osimis
parents: 435
diff changeset
43 cp "$currentDir/build-wasm/OrthancStoneSingleFrame.wasm" $outputDir
435
e641d3978856 WasmWebService now using BaseWebService and supporting cache
am@osimis.io
parents: 326
diff changeset
44 fi
326
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents: 319
diff changeset
45
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents: 319
diff changeset
46 # build single-frame-editor
435
e641d3978856 WasmWebService now using BaseWebService and supporting cache
am@osimis.io
parents: 326
diff changeset
47 if [[ $target == "all" || $target == "OrthancStoneSingleFrameEditor" ]]; then
e641d3978856 WasmWebService now using BaseWebService and supporting cache
am@osimis.io
parents: 326
diff changeset
48 cp $samplesRootDir/Web/single-frame-editor.html $outputDir
466
5055031f4a06 - Added browserify to build. This allows using require calls for modules that
bgo-osimis
parents: 435
diff changeset
49 tsc --project $samplesRootDir/Web/single-frame-editor.tsconfig.json --outDir "$outputDir"
5055031f4a06 - Added browserify to build. This allows using require calls for modules that
bgo-osimis
parents: 435
diff changeset
50 browserify \
5055031f4a06 - Added browserify to build. This allows using require calls for modules that
bgo-osimis
parents: 435
diff changeset
51 "$outputDir/Platforms/Wasm/wasm-application-runner.js" \
5055031f4a06 - Added browserify to build. This allows using require calls for modules that
bgo-osimis
parents: 435
diff changeset
52 "$outputDir/Applications/Samples/Web/single-frame-editor.js" \
5055031f4a06 - Added browserify to build. This allows using require calls for modules that
bgo-osimis
parents: 435
diff changeset
53 -o "$outputDir/app-single-frame-editor.js"
5055031f4a06 - Added browserify to build. This allows using require calls for modules that
bgo-osimis
parents: 435
diff changeset
54 cp "$currentDir/build-wasm/OrthancStoneSingleFrameEditor.js" $outputDir
5055031f4a06 - Added browserify to build. This allows using require calls for modules that
bgo-osimis
parents: 435
diff changeset
55 cp "$currentDir/build-wasm/OrthancStoneSingleFrameEditor.wasm" $outputDir
435
e641d3978856 WasmWebService now using BaseWebService and supporting cache
am@osimis.io
parents: 326
diff changeset
56 fi
326
612238b3f3e8 all 4 samples now working in Qt, SDL and wasm
am@osimis.io
parents: 319
diff changeset
57
319
daa04d15192c new SimpleViewer sample that has been split in multiple files to be able to scale it
am@osimis.io
parents: 307
diff changeset
58 # build simple-viewer project
435
e641d3978856 WasmWebService now using BaseWebService and supporting cache
am@osimis.io
parents: 326
diff changeset
59 if [[ $target == "all" || $target == "OrthancStoneSimpleViewer" ]]; then
e641d3978856 WasmWebService now using BaseWebService and supporting cache
am@osimis.io
parents: 326
diff changeset
60 mkdir -p $outputDir/simple-viewer/
e641d3978856 WasmWebService now using BaseWebService and supporting cache
am@osimis.io
parents: 326
diff changeset
61 cp $samplesRootDir/SimpleViewer/Wasm/simple-viewer.html $outputDir/simple-viewer/
e641d3978856 WasmWebService now using BaseWebService and supporting cache
am@osimis.io
parents: 326
diff changeset
62 cp $samplesRootDir/SimpleViewer/Wasm/styles.css $outputDir/simple-viewer/
466
5055031f4a06 - Added browserify to build. This allows using require calls for modules that
bgo-osimis
parents: 435
diff changeset
63
5055031f4a06 - Added browserify to build. This allows using require calls for modules that
bgo-osimis
parents: 435
diff changeset
64 # the root dir must contain all the source files for the whole project
5055031f4a06 - Added browserify to build. This allows using require calls for modules that
bgo-osimis
parents: 435
diff changeset
65 tsc --module commonjs --allowJs --project "$samplesRootDir/SimpleViewer/Wasm/tsconfig-simple-viewer.json" --rootDir "$samplesRootDir/../.." --outDir "$outputDir/simple-viewer/"
5055031f4a06 - Added browserify to build. This allows using require calls for modules that
bgo-osimis
parents: 435
diff changeset
66 browserify \
5055031f4a06 - Added browserify to build. This allows using require calls for modules that
bgo-osimis
parents: 435
diff changeset
67 "$outputDir/simple-viewer/Platforms/Wasm/wasm-application-runner.js" \
5055031f4a06 - Added browserify to build. This allows using require calls for modules that
bgo-osimis
parents: 435
diff changeset
68 "$outputDir/simple-viewer/Applications/Samples/SimpleViewer/Wasm/simple-viewer.js" \
5055031f4a06 - Added browserify to build. This allows using require calls for modules that
bgo-osimis
parents: 435
diff changeset
69 -o "$outputDir/simple-viewer/app-simple-viewer.js"
5055031f4a06 - Added browserify to build. This allows using require calls for modules that
bgo-osimis
parents: 435
diff changeset
70 cp "$currentDir/build-wasm/OrthancStoneSimpleViewer.js" "$outputDir/simple-viewer/"
5055031f4a06 - Added browserify to build. This allows using require calls for modules that
bgo-osimis
parents: 435
diff changeset
71 cp "$currentDir/build-wasm/OrthancStoneSimpleViewer.wasm" "$outputDir/simple-viewer/"
435
e641d3978856 WasmWebService now using BaseWebService and supporting cache
am@osimis.io
parents: 326
diff changeset
72 fi
295
b04b13810540 unified CMakeLists.txt into a single file for WASM/Native + bootstrap Command (to rework) + doc
am@osimis.io
parents:
diff changeset
73
b04b13810540 unified CMakeLists.txt into a single file for WASM/Native + bootstrap Command (to rework) + doc
am@osimis.io
parents:
diff changeset
74 cd $currentDir