comparison Samples/README.md @ 1395:62dc0d737e7b

build script for wasm sample + updated instructions + fixed Sdl sample for Orthanc listening on other ports that 8042
author Alain Mazy <alain@mazy.be>
date Wed, 29 Apr 2020 18:11:49 +0200
parents 5b750a4e1b52
children 5d7ee14dc1eb
comparison
equal deleted inserted replaced
1394:a8ac7e3de0e8 1395:62dc0d737e7b
66 Dicomweb server functionality of Orthanc. 66 Dicomweb server functionality of Orthanc.
67 67
68 This barebones sample uses plain Javascript and requires the 68 This barebones sample uses plain Javascript and requires the
69 Emscripten toolchain and cmake, in addition to a few standard packages. 69 Emscripten toolchain and cmake, in addition to a few standard packages.
70 70
71 Here's how you can build it: create the following script (for instance, 71 To build it, just launch the `build-wasm-SingleFrameViewer.sh` script from
72 `build-wasm-SingleFrameViewer.sh`) one level above the orthanc-stone repository, 72 this folder. Optionaly, you can pass the build type as an argument.
73 thus, in the folder we have called `devroot`. 73 We suggest that you do *not* use the `Debug` configuration unless you really
74
75 If you feel confident, you can also simply read the following script and
76 enter the commands interactively in the terminal.
77
78 ```
79 #!/bin/bash
80
81 if [ ! -d "orthanc-stone" ]; then
82 echo "This script must be run from the folder one level above orthanc-stone"
83 exit 1
84 fi
85
86 if [[ ! $# -eq 1 ]]; then
87 echo "Usage:"
88 echo " $0 [BUILD_TYPE]"
89 echo ""
90 echo " with:"
91 echo " BUILD_TYPE = Debug, RelWithDebInfo or Release"
92 echo ""
93 exit 1
94 fi
95
96 # define the variables that we'll use
97 buildType=$1
98 buildFolderName="`pwd`/out/build-stone-wasm-SingleFrameViewer-$buildType"
99 installFolderName="`pwd`/out/install-stone-wasm-SingleFrameViewer-$buildType"
100
101 # configure the environment to use Emscripten
102 . ~/apps/emsdk/emsdk_env.sh
103
104
105 mkdir -p $buildFolderName
106
107 # change current folder to the build folder
108 pushd $buildFolderName
109
110 emcmake cmake -G "Ninja" \
111 -DCMAKE_BUILD_TYPE=$buildType \
112 -DCMAKE_INSTALL_PREFIX=$installFolderName \
113 -DSTATIC_BUILD=ON -DOPENSSL_NO_CAPIENG=ON -DALLOW_DOWNLOADS=ON \
114 ../orthanc-stone/Samples/WebAssembly/SingleFrameViewer
115
116 # perform build + installation
117 ninja install
118
119 # restore the original working folder
120 popd
121
122 echo "If all went well, the output files can be found in $installFolderName:"
123
124 ls $installFolderName```
125 ```
126
127 Simply navigate to the dev root, and execute the script:
128
129 ```
130 ./build-wasm-SingleFrameViewer.sh RelWithDebInfo
131 ```
132
133 I suggest that you do *not* use the `Debug` confirmation unless you really
134 need it, for the additional checks that are made will lead to a very long 74 need it, for the additional checks that are made will lead to a very long
135 build time and much slower execution (more severe than with a native non-wasm 75 build time and much slower execution (more severe than with a native non-wasm
136 target) 76 target)
77
78 In order to run the sample, you may serve it with the ServeFolders plugin.
79 You can i.e: add such a section in your orthanc configuration file:
80
81 ```
82 {
83 "Plugins" : ["LibServeFolders.so],
84 "ServeFolders" : {
85 "/single-frame-viewer" : "..../out/install-stone-wasm-SingleFrameViewer-RelWithDebInfo"
86 }
87 }
88 ```
89
90 You'll then be able to open the demo at `http://localhost:8042/single-frame-viewer/index.html`
91
137 92
138 Native samples 93 Native samples
139 ================= 94 =================
140 95
141 SdlSimpleViewer 96 SdlSimpleViewer
179 IDE and choose Build --> Build solution. 134 IDE and choose Build --> Build solution.
180 135
181 An alternative is to execute `cmake --build .` in the build folder created by 136 An alternative is to execute `cmake --build .` in the build folder created by
182 the script. 137 the script.
183 138
139 In order to run the sample, make sure you've an Orthanc server running i.e. on
140 port 8042 and launch:
141
142 ```
143 ./SingleFrameViewer --orthanc http://localhost:8042 --instance 7fc84013-abef174e-3354ca83-b9cdb2a4-f1a74368
144 ```