Mercurial > hg > orthanc-stone
annotate OrthancStone/Samples/WebAssembly/RtViewer/CMakeLists.txt @ 1521:bc4c50a53bd3
changed a few remaining instances of orthanc-stone/Samples to orthanc-stone/OrthancStone/Samples
author | Benjamin Golinvaux <bgo@osimis.io> |
---|---|
date | Fri, 31 Jul 2020 13:36:49 +0200 |
parents | 244ad1e4e76a |
children |
rev | line source |
---|---|
1384
24bcff8ea58f
RtViewer : SDL ok. Preparation for WASM builds ongoing
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
1 cmake_minimum_required(VERSION 2.8.3) |
24bcff8ea58f
RtViewer : SDL ok. Preparation for WASM builds ongoing
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
2 |
24bcff8ea58f
RtViewer : SDL ok. Preparation for WASM builds ongoing
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
3 project(RtViewerWasm) |
24bcff8ea58f
RtViewer : SDL ok. Preparation for WASM builds ongoing
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
4 |
24bcff8ea58f
RtViewer : SDL ok. Preparation for WASM builds ongoing
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
5 # Configuration of the Emscripten compiler for WebAssembly target |
24bcff8ea58f
RtViewer : SDL ok. Preparation for WASM builds ongoing
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
6 # --------------------------------------------------------------- |
24bcff8ea58f
RtViewer : SDL ok. Preparation for WASM builds ongoing
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
7 set(USE_WASM ON CACHE BOOL "") |
24bcff8ea58f
RtViewer : SDL ok. Preparation for WASM builds ongoing
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
8 |
24bcff8ea58f
RtViewer : SDL ok. Preparation for WASM builds ongoing
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
9 set(EMSCRIPTEN_SET_LLVM_WASM_BACKEND ON CACHE BOOL "") |
24bcff8ea58f
RtViewer : SDL ok. Preparation for WASM builds ongoing
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
10 |
24bcff8ea58f
RtViewer : SDL ok. Preparation for WASM builds ongoing
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
11 set(WASM_FLAGS "-s WASM=1 -s FETCH=1") |
24bcff8ea58f
RtViewer : SDL ok. Preparation for WASM builds ongoing
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
12 if (CMAKE_BUILD_TYPE STREQUAL "Debug") |
24bcff8ea58f
RtViewer : SDL ok. Preparation for WASM builds ongoing
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
13 set(WASM_FLAGS "${WASM_FLAGS} -s SAFE_HEAP=1") |
24bcff8ea58f
RtViewer : SDL ok. Preparation for WASM builds ongoing
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
14 endif() |
24bcff8ea58f
RtViewer : SDL ok. Preparation for WASM builds ongoing
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
15 |
24bcff8ea58f
RtViewer : SDL ok. Preparation for WASM builds ongoing
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
16 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${WASM_FLAGS}") |
24bcff8ea58f
RtViewer : SDL ok. Preparation for WASM builds ongoing
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
17 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${WASM_FLAGS}") |
24bcff8ea58f
RtViewer : SDL ok. Preparation for WASM builds ongoing
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
18 |
24bcff8ea58f
RtViewer : SDL ok. Preparation for WASM builds ongoing
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
19 set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s EXTRA_EXPORTED_RUNTIME_METHODS='[\"ccall\", \"cwrap\"]'") |
24bcff8ea58f
RtViewer : SDL ok. Preparation for WASM builds ongoing
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
20 set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s ERROR_ON_UNDEFINED_SYMBOLS=1") |
24bcff8ea58f
RtViewer : SDL ok. Preparation for WASM builds ongoing
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
21 set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s ASSERTIONS=1 -s DISABLE_EXCEPTION_CATCHING=0") |
24bcff8ea58f
RtViewer : SDL ok. Preparation for WASM builds ongoing
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
22 set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s ALLOW_MEMORY_GROWTH=1 -s TOTAL_MEMORY=268435456") # 256MB + resize |
24bcff8ea58f
RtViewer : SDL ok. Preparation for WASM builds ongoing
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
23 set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s DISABLE_DEPRECATED_FIND_EVENT_TARGET_BEHAVIOR=1") |
24bcff8ea58f
RtViewer : SDL ok. Preparation for WASM builds ongoing
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
24 add_definitions( |
24bcff8ea58f
RtViewer : SDL ok. Preparation for WASM builds ongoing
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
25 -DDISABLE_DEPRECATED_FIND_EVENT_TARGET_BEHAVIOR=1 |
24bcff8ea58f
RtViewer : SDL ok. Preparation for WASM builds ongoing
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
26 ) |
24bcff8ea58f
RtViewer : SDL ok. Preparation for WASM builds ongoing
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
27 |
24bcff8ea58f
RtViewer : SDL ok. Preparation for WASM builds ongoing
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
28 # Stone of Orthanc configuration |
24bcff8ea58f
RtViewer : SDL ok. Preparation for WASM builds ongoing
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
29 # --------------------------------------------------------------- |
24bcff8ea58f
RtViewer : SDL ok. Preparation for WASM builds ongoing
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
30 set(ALLOW_DOWNLOADS ON) |
24bcff8ea58f
RtViewer : SDL ok. Preparation for WASM builds ongoing
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
31 |
1512
244ad1e4e76a
reorganization of folders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1474
diff
changeset
|
32 include(${CMAKE_SOURCE_DIR}/../../../Resources/CMake/OrthancStoneParameters.cmake) |
1384
24bcff8ea58f
RtViewer : SDL ok. Preparation for WASM builds ongoing
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
33 |
1474
d1dde1f86d4a
fix build of wasm samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1471
diff
changeset
|
34 SET(ENABLE_DCMTK OFF) # Not necessary |
1384
24bcff8ea58f
RtViewer : SDL ok. Preparation for WASM builds ongoing
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
35 SET(ENABLE_GOOGLE_TEST OFF) |
24bcff8ea58f
RtViewer : SDL ok. Preparation for WASM builds ongoing
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
36 SET(ENABLE_LOCALE ON) # Necessary for text rendering |
24bcff8ea58f
RtViewer : SDL ok. Preparation for WASM builds ongoing
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
37 SET(ENABLE_WASM ON) |
24bcff8ea58f
RtViewer : SDL ok. Preparation for WASM builds ongoing
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
38 SET(ORTHANC_SANDBOXED ON) |
24bcff8ea58f
RtViewer : SDL ok. Preparation for WASM builds ongoing
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
39 |
1471
28c64c246312
working on a shared library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1465
diff
changeset
|
40 # this will set up the build system for Stone of Orthanc and will |
28c64c246312
working on a shared library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1465
diff
changeset
|
41 # populate the ORTHANC_STONE_SOURCES CMake variable |
1512
244ad1e4e76a
reorganization of folders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1474
diff
changeset
|
42 include(${ORTHANC_STONE_ROOT}/Resources/CMake/OrthancStoneConfiguration.cmake) |
1471
28c64c246312
working on a shared library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1465
diff
changeset
|
43 |
1393
27e0a00bd3e8
RtViewer SingleFrameViewer OK : wasm SDL single viewport
Benjamin Golinvaux <bgo@osimis.io>
parents:
1389
diff
changeset
|
44 |
27e0a00bd3e8
RtViewer SingleFrameViewer OK : wasm SDL single viewport
Benjamin Golinvaux <bgo@osimis.io>
parents:
1389
diff
changeset
|
45 # We embed a font to be used for on-screen overlays |
27e0a00bd3e8
RtViewer SingleFrameViewer OK : wasm SDL single viewport
Benjamin Golinvaux <bgo@osimis.io>
parents:
1389
diff
changeset
|
46 # --------------------------------------------------------------- |
27e0a00bd3e8
RtViewer SingleFrameViewer OK : wasm SDL single viewport
Benjamin Golinvaux <bgo@osimis.io>
parents:
1389
diff
changeset
|
47 |
27e0a00bd3e8
RtViewer SingleFrameViewer OK : wasm SDL single viewport
Benjamin Golinvaux <bgo@osimis.io>
parents:
1389
diff
changeset
|
48 DownloadPackage( |
27e0a00bd3e8
RtViewer SingleFrameViewer OK : wasm SDL single viewport
Benjamin Golinvaux <bgo@osimis.io>
parents:
1389
diff
changeset
|
49 "a24b8136b8f3bb93f166baf97d9328de" |
27e0a00bd3e8
RtViewer SingleFrameViewer OK : wasm SDL single viewport
Benjamin Golinvaux <bgo@osimis.io>
parents:
1389
diff
changeset
|
50 "http://orthanc.osimis.io/ThirdPartyDownloads/ubuntu-font-family-0.83.zip" |
27e0a00bd3e8
RtViewer SingleFrameViewer OK : wasm SDL single viewport
Benjamin Golinvaux <bgo@osimis.io>
parents:
1389
diff
changeset
|
51 "${CMAKE_BINARY_DIR}/ubuntu-font-family-0.83") |
27e0a00bd3e8
RtViewer SingleFrameViewer OK : wasm SDL single viewport
Benjamin Golinvaux <bgo@osimis.io>
parents:
1389
diff
changeset
|
52 |
1471
28c64c246312
working on a shared library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1465
diff
changeset
|
53 EmbedResources( |
1474
d1dde1f86d4a
fix build of wasm samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1471
diff
changeset
|
54 COLORMAP_HOT ${ORTHANC_STONE_ROOT}/Resources/Colormaps/hot.lut |
1393
27e0a00bd3e8
RtViewer SingleFrameViewer OK : wasm SDL single viewport
Benjamin Golinvaux <bgo@osimis.io>
parents:
1389
diff
changeset
|
55 UBUNTU_FONT ${CMAKE_BINARY_DIR}/ubuntu-font-family-0.83/Ubuntu-R.ttf |
27e0a00bd3e8
RtViewer SingleFrameViewer OK : wasm SDL single viewport
Benjamin Golinvaux <bgo@osimis.io>
parents:
1389
diff
changeset
|
56 ) |
27e0a00bd3e8
RtViewer SingleFrameViewer OK : wasm SDL single viewport
Benjamin Golinvaux <bgo@osimis.io>
parents:
1389
diff
changeset
|
57 |
1384
24bcff8ea58f
RtViewer : SDL ok. Preparation for WASM builds ongoing
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
58 # Define the WASM module |
24bcff8ea58f
RtViewer : SDL ok. Preparation for WASM builds ongoing
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
59 # --------------------------------------------------------------- |
24bcff8ea58f
RtViewer : SDL ok. Preparation for WASM builds ongoing
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
60 add_executable(RtViewerWasm |
24bcff8ea58f
RtViewer : SDL ok. Preparation for WASM builds ongoing
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
61 RtViewerWasm.cpp |
1404
3e644f6fadd4
Three-viewport is now OK in SDL and Wasm
Benjamin Golinvaux <bgo@osimis.io>
parents:
1393
diff
changeset
|
62 ../../Common/RtViewerApp.cpp |
3e644f6fadd4
Three-viewport is now OK in SDL and Wasm
Benjamin Golinvaux <bgo@osimis.io>
parents:
1393
diff
changeset
|
63 ../../Common/RtViewerApp.h |
3e644f6fadd4
Three-viewport is now OK in SDL and Wasm
Benjamin Golinvaux <bgo@osimis.io>
parents:
1393
diff
changeset
|
64 ../../Common/RtViewerView.cpp |
3e644f6fadd4
Three-viewport is now OK in SDL and Wasm
Benjamin Golinvaux <bgo@osimis.io>
parents:
1393
diff
changeset
|
65 ../../Common/RtViewerView.h |
1384
24bcff8ea58f
RtViewer : SDL ok. Preparation for WASM builds ongoing
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
66 ${ORTHANC_STONE_SOURCES} |
1471
28c64c246312
working on a shared library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1465
diff
changeset
|
67 ${AUTOGENERATED_SOURCES} |
1384
24bcff8ea58f
RtViewer : SDL ok. Preparation for WASM builds ongoing
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
68 ) |
24bcff8ea58f
RtViewer : SDL ok. Preparation for WASM builds ongoing
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
69 |
24bcff8ea58f
RtViewer : SDL ok. Preparation for WASM builds ongoing
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
70 # Declare installation files for the module |
24bcff8ea58f
RtViewer : SDL ok. Preparation for WASM builds ongoing
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
71 # --------------------------------------------------------------- |
24bcff8ea58f
RtViewer : SDL ok. Preparation for WASM builds ongoing
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
72 install( |
1389
5c83be3a6be5
split SDL / common + RtViewer rename + html test file
Benjamin Golinvaux <bgo@osimis.io>
parents:
1384
diff
changeset
|
73 TARGETS RtViewerWasm |
1384
24bcff8ea58f
RtViewer : SDL ok. Preparation for WASM builds ongoing
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
74 RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX} |
24bcff8ea58f
RtViewer : SDL ok. Preparation for WASM builds ongoing
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
75 ) |
24bcff8ea58f
RtViewer : SDL ok. Preparation for WASM builds ongoing
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
76 |
24bcff8ea58f
RtViewer : SDL ok. Preparation for WASM builds ongoing
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
77 # Declare installation files for the companion files (web scaffolding) |
1389
5c83be3a6be5
split SDL / common + RtViewer rename + html test file
Benjamin Golinvaux <bgo@osimis.io>
parents:
1384
diff
changeset
|
78 # please note that ${CMAKE_CURRENT_BINARY_DIR}/RtViewerWasm.js |
1384
24bcff8ea58f
RtViewer : SDL ok. Preparation for WASM builds ongoing
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
79 # (the generated JS loader for the WASM module) is handled by the `install1` |
1389
5c83be3a6be5
split SDL / common + RtViewer rename + html test file
Benjamin Golinvaux <bgo@osimis.io>
parents:
1384
diff
changeset
|
80 # section above: it is considered to be the binary output of |
5c83be3a6be5
split SDL / common + RtViewer rename + html test file
Benjamin Golinvaux <bgo@osimis.io>
parents:
1384
diff
changeset
|
81 # the linker. |
1384
24bcff8ea58f
RtViewer : SDL ok. Preparation for WASM builds ongoing
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
82 # --------------------------------------------------------------- |
24bcff8ea58f
RtViewer : SDL ok. Preparation for WASM builds ongoing
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
83 install( |
24bcff8ea58f
RtViewer : SDL ok. Preparation for WASM builds ongoing
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
84 FILES |
1393
27e0a00bd3e8
RtViewer SingleFrameViewer OK : wasm SDL single viewport
Benjamin Golinvaux <bgo@osimis.io>
parents:
1389
diff
changeset
|
85 ${CMAKE_SOURCE_DIR}/RtViewerWasmApp.js |
1384
24bcff8ea58f
RtViewer : SDL ok. Preparation for WASM builds ongoing
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
86 ${CMAKE_SOURCE_DIR}/index.html |
1389
5c83be3a6be5
split SDL / common + RtViewer rename + html test file
Benjamin Golinvaux <bgo@osimis.io>
parents:
1384
diff
changeset
|
87 ${CMAKE_CURRENT_BINARY_DIR}/RtViewerWasm.wasm |
1384
24bcff8ea58f
RtViewer : SDL ok. Preparation for WASM builds ongoing
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
88 DESTINATION ${CMAKE_INSTALL_PREFIX} |
24bcff8ea58f
RtViewer : SDL ok. Preparation for WASM builds ongoing
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff
changeset
|
89 ) |