changeset 1464:4647636334aa

dos2unix
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 12 Jun 2020 07:20:12 +0200
parents 182bf3106ee2
children 70b0b1dc1de4
files Deprecated/Samples/Qt/CMakeLists.txt Samples/Sdl/CMakeLists.txt Samples/WebAssembly/CMakeLists.txt
diffstat 3 files changed, 327 insertions(+), 327 deletions(-) [+]
line wrap: on
line diff
--- a/Deprecated/Samples/Qt/CMakeLists.txt	Fri Jun 12 07:19:31 2020 +0200
+++ b/Deprecated/Samples/Qt/CMakeLists.txt	Fri Jun 12 07:20:12 2020 +0200
@@ -1,83 +1,83 @@
-cmake_minimum_required(VERSION 2.8.3)
-
-#####################################################################
-## Configuration of the Orthanc framework
-#####################################################################
-
-# This CMake file defines the "ORTHANC_STONE_VERSION" macro, so it
-# must be the first inclusion
-include(${CMAKE_SOURCE_DIR}/../../Resources/CMake/Version.cmake)
-
-if (ORTHANC_STONE_VERSION STREQUAL "mainline")
-  set(ORTHANC_FRAMEWORK_VERSION "mainline")
-  set(ORTHANC_FRAMEWORK_DEFAULT_SOURCE "hg")
-else()
-  set(ORTHANC_FRAMEWORK_VERSION "1.5.7")
-  set(ORTHANC_FRAMEWORK_DEFAULT_SOURCE "web")
-endif()
-
-set(ORTHANC_FRAMEWORK_SOURCE "${ORTHANC_FRAMEWORK_DEFAULT_SOURCE}" CACHE STRING "Source of the Orthanc source code (can be \"hg\", \"archive\", \"web\" or \"path\")")
-set(ORTHANC_FRAMEWORK_ARCHIVE "" CACHE STRING "Path to the Orthanc archive, if ORTHANC_FRAMEWORK_SOURCE is \"archive\"")
-set(ORTHANC_FRAMEWORK_ROOT "" CACHE STRING "Path to the Orthanc source directory, if ORTHANC_FRAMEWORK_SOURCE is \"path\"")
-
-
-#####################################################################
-## Configuration of the Stone framework
-#####################################################################
-
-include(${CMAKE_SOURCE_DIR}/../../Resources/CMake/OrthancStoneParameters.cmake)
-include(${ORTHANC_ROOT}/Resources/CMake/DownloadPackage.cmake)
-
-DownloadPackage(
-  "a24b8136b8f3bb93f166baf97d9328de"
-  "http://orthanc.osimis.io/ThirdPartyDownloads/ubuntu-font-family-0.83.zip"
-  "${CMAKE_BINARY_DIR}/ubuntu-font-family-0.83")
-
-set(ORTHANC_STONE_APPLICATION_RESOURCES
-  UBUNTU_FONT  ${CMAKE_BINARY_DIR}/ubuntu-font-family-0.83/Ubuntu-R.ttf
-  )
-
-SET(ENABLE_GOOGLE_TEST OFF)
-SET(ENABLE_LOCALE ON)
-SET(ENABLE_QT ON)
-SET(ENABLE_SDL OFF)
-SET(ENABLE_WEB_CLIENT ON)
-SET(ORTHANC_SANDBOXED OFF)
-LIST(APPEND ORTHANC_BOOST_COMPONENTS program_options)
-
-include(${CMAKE_SOURCE_DIR}/../../Resources/CMake/OrthancStoneConfiguration.cmake)
-
-add_definitions(
-  -DORTHANC_ENABLE_LOGGING_PLUGIN=0
-  )
-#####################################################################
-## Build the samples
-#####################################################################
-
-add_library(OrthancStone STATIC
-  ${ORTHANC_STONE_SOURCES}
-  )
-
-list(APPEND BASIC_SCENE_APPLICATIONS_SOURCES
-  BasicSceneWindow.cpp
-  )
-
-ORTHANC_QT_WRAP_UI(BASIC_SCENE_APPLICATIONS_SOURCES
-  BasicSceneWindow.ui
-  )
-
-ORTHANC_QT_WRAP_CPP(BASIC_SCENE_APPLICATIONS_SOURCES
-  BasicSceneWindow.h
-  QStoneOpenGlWidget.h
-  )
-
-add_executable(MpBasicScene
-  ${CMAKE_CURRENT_LIST_DIR}/../MultiPlatform/BasicScene/BasicScene.h
-  ${CMAKE_CURRENT_LIST_DIR}/../MultiPlatform/BasicScene/BasicScene.cpp
-  ${CMAKE_CURRENT_LIST_DIR}/../MultiPlatform/BasicScene/mainQt.cpp
-  QStoneOpenGlWidget.cpp
-  ${BASIC_SCENE_APPLICATIONS_SOURCES}
-  )
-
-target_include_directories(MpBasicScene PUBLIC ${CMAKE_SOURCE_DIR} ${ORTHANC_STONE_ROOT})
-target_link_libraries(MpBasicScene OrthancStone)
+cmake_minimum_required(VERSION 2.8.3)
+
+#####################################################################
+## Configuration of the Orthanc framework
+#####################################################################
+
+# This CMake file defines the "ORTHANC_STONE_VERSION" macro, so it
+# must be the first inclusion
+include(${CMAKE_SOURCE_DIR}/../../Resources/CMake/Version.cmake)
+
+if (ORTHANC_STONE_VERSION STREQUAL "mainline")
+  set(ORTHANC_FRAMEWORK_VERSION "mainline")
+  set(ORTHANC_FRAMEWORK_DEFAULT_SOURCE "hg")
+else()
+  set(ORTHANC_FRAMEWORK_VERSION "1.5.7")
+  set(ORTHANC_FRAMEWORK_DEFAULT_SOURCE "web")
+endif()
+
+set(ORTHANC_FRAMEWORK_SOURCE "${ORTHANC_FRAMEWORK_DEFAULT_SOURCE}" CACHE STRING "Source of the Orthanc source code (can be \"hg\", \"archive\", \"web\" or \"path\")")
+set(ORTHANC_FRAMEWORK_ARCHIVE "" CACHE STRING "Path to the Orthanc archive, if ORTHANC_FRAMEWORK_SOURCE is \"archive\"")
+set(ORTHANC_FRAMEWORK_ROOT "" CACHE STRING "Path to the Orthanc source directory, if ORTHANC_FRAMEWORK_SOURCE is \"path\"")
+
+
+#####################################################################
+## Configuration of the Stone framework
+#####################################################################
+
+include(${CMAKE_SOURCE_DIR}/../../Resources/CMake/OrthancStoneParameters.cmake)
+include(${ORTHANC_ROOT}/Resources/CMake/DownloadPackage.cmake)
+
+DownloadPackage(
+  "a24b8136b8f3bb93f166baf97d9328de"
+  "http://orthanc.osimis.io/ThirdPartyDownloads/ubuntu-font-family-0.83.zip"
+  "${CMAKE_BINARY_DIR}/ubuntu-font-family-0.83")
+
+set(ORTHANC_STONE_APPLICATION_RESOURCES
+  UBUNTU_FONT  ${CMAKE_BINARY_DIR}/ubuntu-font-family-0.83/Ubuntu-R.ttf
+  )
+
+SET(ENABLE_GOOGLE_TEST OFF)
+SET(ENABLE_LOCALE ON)
+SET(ENABLE_QT ON)
+SET(ENABLE_SDL OFF)
+SET(ENABLE_WEB_CLIENT ON)
+SET(ORTHANC_SANDBOXED OFF)
+LIST(APPEND ORTHANC_BOOST_COMPONENTS program_options)
+
+include(${CMAKE_SOURCE_DIR}/../../Resources/CMake/OrthancStoneConfiguration.cmake)
+
+add_definitions(
+  -DORTHANC_ENABLE_LOGGING_PLUGIN=0
+  )
+#####################################################################
+## Build the samples
+#####################################################################
+
+add_library(OrthancStone STATIC
+  ${ORTHANC_STONE_SOURCES}
+  )
+
+list(APPEND BASIC_SCENE_APPLICATIONS_SOURCES
+  BasicSceneWindow.cpp
+  )
+
+ORTHANC_QT_WRAP_UI(BASIC_SCENE_APPLICATIONS_SOURCES
+  BasicSceneWindow.ui
+  )
+
+ORTHANC_QT_WRAP_CPP(BASIC_SCENE_APPLICATIONS_SOURCES
+  BasicSceneWindow.h
+  QStoneOpenGlWidget.h
+  )
+
+add_executable(MpBasicScene
+  ${CMAKE_CURRENT_LIST_DIR}/../MultiPlatform/BasicScene/BasicScene.h
+  ${CMAKE_CURRENT_LIST_DIR}/../MultiPlatform/BasicScene/BasicScene.cpp
+  ${CMAKE_CURRENT_LIST_DIR}/../MultiPlatform/BasicScene/mainQt.cpp
+  QStoneOpenGlWidget.cpp
+  ${BASIC_SCENE_APPLICATIONS_SOURCES}
+  )
+
+target_include_directories(MpBasicScene PUBLIC ${CMAKE_SOURCE_DIR} ${ORTHANC_STONE_ROOT})
+target_link_libraries(MpBasicScene OrthancStone)
--- a/Samples/Sdl/CMakeLists.txt	Fri Jun 12 07:19:31 2020 +0200
+++ b/Samples/Sdl/CMakeLists.txt	Fri Jun 12 07:20:12 2020 +0200
@@ -1,106 +1,106 @@
-cmake_minimum_required(VERSION 2.8.10)
-
-project(OrthancStone)
-
-set(ORTHANC_FRAMEWORK_SOURCE "path" CACHE STRING "select the source of Orthanc")
-set(ORTHANC_FRAMEWORK_ROOT ${CMAKE_CURRENT_LIST_DIR}/../../../orthanc CACHE STRING "select the root path of Orthanc")
-set(STONE_ROOT ${CMAKE_CURRENT_LIST_DIR}/../../)
-
-include(${STONE_ROOT}/Resources/CMake/OrthancStoneParameters.cmake)
-include(${ORTHANC_ROOT}/Resources/CMake/DownloadPackage.cmake)
-
-set(ALLOW_DOWNLOADS ON)
-set(STANDALONE_BUILD ON)  # To have DCMTK_USE_EMBEDDED_DICTIONARIES defined
-if(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
-  set(STATIC_BUILD ON)
-endif()
-set(ENABLE_GOOGLE_TEST ON)
-set(ENABLE_LOCALE ON)  # Necessary for text rendering
-set(ENABLE_SDL ON)
-set(ENABLE_DCMTK ON)  # <==
-set(ENABLE_OPENGL ON)  #  <==
-set(ENABLE_WEB_CLIENT ON)
-set(ORTHANC_SANDBOXED OFF)
-
-DownloadPackage(
-  "a24b8136b8f3bb93f166baf97d9328de"
-  "http://orthanc.osimis.io/ThirdPartyDownloads/ubuntu-font-family-0.83.zip"
-  "${CMAKE_BINARY_DIR}/ubuntu-font-family-0.83")
-
-set(ORTHANC_STONE_APPLICATION_RESOURCES
-  UBUNTU_FONT  ${CMAKE_BINARY_DIR}/ubuntu-font-family-0.83/Ubuntu-R.ttf
-  )
-
-list(APPEND ORTHANC_BOOST_COMPONENTS program_options)
-include(${STONE_ROOT}/Resources/CMake/OrthancStoneConfiguration.cmake)
-include(${STONE_ROOT}/Resources/CMake/BoostExtendedConfiguration.cmake)
-include(${STONE_ROOT}/Resources/CMake/Utilities.cmake)
-
-add_definitions(
-  -DORTHANC_ENABLE_LOGGING=1
-  -DORTHANC_ENABLE_LOGGING_PLUGIN=0
-  -DORTHANC_ENABLE_PUGIXML=0
-  -DORTHANC_DEFAULT_DICOM_ENCODING=Encoding_Latin1
-  )
-
-SortFilesInSourceGroups()
-
-add_library(OrthancStone STATIC
-  ${ORTHANC_STONE_SOURCES}
-  )
-
-
-#############################
-project(RtViewerSdl)
-
-add_executable(RtViewerSdl
-  RtViewer/RtViewerSdl.cpp
-  SdlHelpers.h
-  ../Common/RtViewerApp.cpp
-  ../Common/RtViewerApp.h
-  ../Common/RtViewerView.cpp
-  ../Common/RtViewerView.h
-  ../Common/SampleHelpers.h
-  )
-
-target_link_libraries(RtViewerSdl OrthancStone ${DCMTK_LIBRARIES})
-
-#############################
-project(SdlSimpleViewer)
-
-add_executable(SdlSimpleViewer
-  SdlHelpers.h
-  ../Common/SampleHelpers.h
-  SingleFrameViewer/SdlSimpleViewerApplication.h
-  SingleFrameViewer/SdlSimpleViewer.cpp
-  ${BOOST_EXTENDED_SOURCES}
-  )
-
-target_link_libraries(SdlSimpleViewer OrthancStone ${DCMTK_LIBRARIES})
-
-#############################
-project(UnitTests)
-
-add_executable(UnitTests
-  ${GOOGLE_TEST_SOURCES}
-  ${ORTHANC_STONE_ROOT}/UnitTestsSources/GenericToolboxTests.cpp
-  ${ORTHANC_STONE_ROOT}/UnitTestsSources/ImageToolboxTests.cpp
-  ${ORTHANC_STONE_ROOT}/UnitTestsSources/PixelTestPatternsTests.cpp
-  ${ORTHANC_STONE_ROOT}/UnitTestsSources/TestCommands.cpp
-  ${ORTHANC_STONE_ROOT}/UnitTestsSources/TestMessageBroker.cpp
-  ${ORTHANC_STONE_ROOT}/UnitTestsSources/TestStrategy.cpp
-  ${ORTHANC_STONE_ROOT}/UnitTestsSources/TestStructureSet.cpp
-  ${ORTHANC_STONE_ROOT}/UnitTestsSources/UnitTestsMain.cpp
-)
-
-target_link_libraries(UnitTests OrthancStone)
-
-add_custom_command(
-  TARGET UnitTests
-  POST_BUILD
-  COMMAND ${CMAKE_COMMAND} -E copy
-    "${ORTHANC_STONE_ROOT}/UnitTestsSources/72c773ac-5059f2c4-2e6a9120-4fd4bca1-45701661.json" 
-    "$<TARGET_FILE_DIR:UnitTests>/72c773ac-5059f2c4-2e6a9120-4fd4bca1-45701661.json"
-)
-
-target_link_libraries(UnitTests OrthancStone ${DCMTK_LIBRARIES})
+cmake_minimum_required(VERSION 2.8.10)
+
+project(OrthancStone)
+
+set(ORTHANC_FRAMEWORK_SOURCE "path" CACHE STRING "select the source of Orthanc")
+set(ORTHANC_FRAMEWORK_ROOT ${CMAKE_CURRENT_LIST_DIR}/../../../orthanc CACHE STRING "select the root path of Orthanc")
+set(STONE_ROOT ${CMAKE_CURRENT_LIST_DIR}/../../)
+
+include(${STONE_ROOT}/Resources/CMake/OrthancStoneParameters.cmake)
+include(${ORTHANC_ROOT}/Resources/CMake/DownloadPackage.cmake)
+
+set(ALLOW_DOWNLOADS ON)
+set(STANDALONE_BUILD ON)  # To have DCMTK_USE_EMBEDDED_DICTIONARIES defined
+if(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
+  set(STATIC_BUILD ON)
+endif()
+set(ENABLE_GOOGLE_TEST ON)
+set(ENABLE_LOCALE ON)  # Necessary for text rendering
+set(ENABLE_SDL ON)
+set(ENABLE_DCMTK ON)  # <==
+set(ENABLE_OPENGL ON)  #  <==
+set(ENABLE_WEB_CLIENT ON)
+set(ORTHANC_SANDBOXED OFF)
+
+DownloadPackage(
+  "a24b8136b8f3bb93f166baf97d9328de"
+  "http://orthanc.osimis.io/ThirdPartyDownloads/ubuntu-font-family-0.83.zip"
+  "${CMAKE_BINARY_DIR}/ubuntu-font-family-0.83")
+
+set(ORTHANC_STONE_APPLICATION_RESOURCES
+  UBUNTU_FONT  ${CMAKE_BINARY_DIR}/ubuntu-font-family-0.83/Ubuntu-R.ttf
+  )
+
+list(APPEND ORTHANC_BOOST_COMPONENTS program_options)
+include(${STONE_ROOT}/Resources/CMake/OrthancStoneConfiguration.cmake)
+include(${STONE_ROOT}/Resources/CMake/BoostExtendedConfiguration.cmake)
+include(${STONE_ROOT}/Resources/CMake/Utilities.cmake)
+
+add_definitions(
+  -DORTHANC_ENABLE_LOGGING=1
+  -DORTHANC_ENABLE_LOGGING_PLUGIN=0
+  -DORTHANC_ENABLE_PUGIXML=0
+  -DORTHANC_DEFAULT_DICOM_ENCODING=Encoding_Latin1
+  )
+
+SortFilesInSourceGroups()
+
+add_library(OrthancStone STATIC
+  ${ORTHANC_STONE_SOURCES}
+  )
+
+
+#############################
+project(RtViewerSdl)
+
+add_executable(RtViewerSdl
+  RtViewer/RtViewerSdl.cpp
+  SdlHelpers.h
+  ../Common/RtViewerApp.cpp
+  ../Common/RtViewerApp.h
+  ../Common/RtViewerView.cpp
+  ../Common/RtViewerView.h
+  ../Common/SampleHelpers.h
+  )
+
+target_link_libraries(RtViewerSdl OrthancStone ${DCMTK_LIBRARIES})
+
+#############################
+project(SdlSimpleViewer)
+
+add_executable(SdlSimpleViewer
+  SdlHelpers.h
+  ../Common/SampleHelpers.h
+  SingleFrameViewer/SdlSimpleViewerApplication.h
+  SingleFrameViewer/SdlSimpleViewer.cpp
+  ${BOOST_EXTENDED_SOURCES}
+  )
+
+target_link_libraries(SdlSimpleViewer OrthancStone ${DCMTK_LIBRARIES})
+
+#############################
+project(UnitTests)
+
+add_executable(UnitTests
+  ${GOOGLE_TEST_SOURCES}
+  ${ORTHANC_STONE_ROOT}/UnitTestsSources/GenericToolboxTests.cpp
+  ${ORTHANC_STONE_ROOT}/UnitTestsSources/ImageToolboxTests.cpp
+  ${ORTHANC_STONE_ROOT}/UnitTestsSources/PixelTestPatternsTests.cpp
+  ${ORTHANC_STONE_ROOT}/UnitTestsSources/TestCommands.cpp
+  ${ORTHANC_STONE_ROOT}/UnitTestsSources/TestMessageBroker.cpp
+  ${ORTHANC_STONE_ROOT}/UnitTestsSources/TestStrategy.cpp
+  ${ORTHANC_STONE_ROOT}/UnitTestsSources/TestStructureSet.cpp
+  ${ORTHANC_STONE_ROOT}/UnitTestsSources/UnitTestsMain.cpp
+)
+
+target_link_libraries(UnitTests OrthancStone)
+
+add_custom_command(
+  TARGET UnitTests
+  POST_BUILD
+  COMMAND ${CMAKE_COMMAND} -E copy
+    "${ORTHANC_STONE_ROOT}/UnitTestsSources/72c773ac-5059f2c4-2e6a9120-4fd4bca1-45701661.json" 
+    "$<TARGET_FILE_DIR:UnitTests>/72c773ac-5059f2c4-2e6a9120-4fd4bca1-45701661.json"
+)
+
+target_link_libraries(UnitTests OrthancStone ${DCMTK_LIBRARIES})
--- a/Samples/WebAssembly/CMakeLists.txt	Fri Jun 12 07:19:31 2020 +0200
+++ b/Samples/WebAssembly/CMakeLists.txt	Fri Jun 12 07:20:12 2020 +0200
@@ -1,138 +1,138 @@
-cmake_minimum_required(VERSION 2.8.3)
-
-project(OrthancStone)
-
-# Configuration of the Emscripten compiler for WebAssembly target
-# ---------------------------------------------------------------
-set(USE_WASM ON CACHE BOOL "")
-set(ORTHANC_FRAMEWORK_ROOT ${CMAKE_CURRENT_LIST_DIR}/../../../orthanc CACHE STRING "")
-set(STONE_ROOT ${CMAKE_CURRENT_LIST_DIR}/../../)
-
-set(EMSCRIPTEN_SET_LLVM_WASM_BACKEND ON CACHE BOOL "")
-
-set(WASM_FLAGS "-s WASM=1 -s FETCH=1")
-if (CMAKE_BUILD_TYPE STREQUAL "Debug")
-  set(WASM_FLAGS "${WASM_FLAGS} -s SAFE_HEAP=1")
-endif()
-
-set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${WASM_FLAGS}")
-set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${WASM_FLAGS}")
-
-set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s EXTRA_EXPORTED_RUNTIME_METHODS='[\"ccall\", \"cwrap\"]'")
-set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s ERROR_ON_UNDEFINED_SYMBOLS=1")
-set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s ASSERTIONS=1 -s DISABLE_EXCEPTION_CATCHING=0")
-set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s ALLOW_MEMORY_GROWTH=1 -s TOTAL_MEMORY=268435456")  # 256MB + resize
-set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s DISABLE_DEPRECATED_FIND_EVENT_TARGET_BEHAVIOR=1")
-add_definitions(
-  -DDISABLE_DEPRECATED_FIND_EVENT_TARGET_BEHAVIOR=1
-)
-
-# Stone of Orthanc configuration
-# ---------------------------------------------------------------
-set(ALLOW_DOWNLOADS ON)
-set(ORTHANC_FRAMEWORK_SOURCE "path")
-
-include(${STONE_ROOT}/Resources/CMake/OrthancStoneParameters.cmake)
-include(${ORTHANC_ROOT}/Resources/CMake/DownloadPackage.cmake)
-
-SET(ENABLE_DCMTK ON)
-SET(ENABLE_GOOGLE_TEST OFF)
-SET(ENABLE_LOCALE ON)  # Necessary for text rendering
-SET(ENABLE_WASM ON)
-SET(ORTHANC_SANDBOXED ON)
-
-
-# We embed a font to be used for on-screen overlays
-# ---------------------------------------------------------------
-
-DownloadPackage(
-  "a24b8136b8f3bb93f166baf97d9328de"
-  "http://orthanc.osimis.io/ThirdPartyDownloads/ubuntu-font-family-0.83.zip"
-  "${CMAKE_BINARY_DIR}/ubuntu-font-family-0.83")
-
-set(ORTHANC_STONE_APPLICATION_RESOURCES
-  UBUNTU_FONT  ${CMAKE_BINARY_DIR}/ubuntu-font-family-0.83/Ubuntu-R.ttf
-  )
-
-# this will set up the build system for Stone of Orthanc and will
-# populate the ORTHANC_STONE_SOURCES CMake variable
-include(${STONE_ROOT}/Resources/CMake/OrthancStoneConfiguration.cmake)
-
-include_directories(${STONE_ROOT})
-include_directories(../Common)
-
-add_library(OrthancStone STATIC
-  ${ORTHANC_STONE_SOURCES}
-  )
-
-################################################################################
-
-# Define the WASM module
-# ---------------------------------------------------------------
-
-project(RtViewerWasm)
-
-add_executable(RtViewerWasm
-  RtViewer/RtViewerWasm.cpp
-  ../Common/RtViewerApp.cpp
-  ../Common/RtViewerApp.h
-  ../Common/RtViewerView.cpp
-  ../Common/RtViewerView.h
-  )
-
-target_link_libraries(RtViewerWasm OrthancStone)
-
-# Declare installation files for the module
-# ---------------------------------------------------------------
-install(
-  TARGETS RtViewerWasm
-  RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/RtViewer/
-  )
-
-# Declare installation files for the companion files (web scaffolding)
-# please note that ${CMAKE_CURRENT_BINARY_DIR}/RtViewerWasm.js
-# (the generated JS loader for the WASM module) is handled by the `install1`
-# section above: it is considered to be the binary output of 
-# the linker.
-# ---------------------------------------------------------------
-install(
-  FILES
-  ${CMAKE_SOURCE_DIR}/RtViewer/RtViewerWasmApp.js
-  ${CMAKE_SOURCE_DIR}/RtViewer/index.html
-  ${CMAKE_CURRENT_BINARY_DIR}/RtViewerWasm.wasm
-  DESTINATION ${CMAKE_INSTALL_PREFIX}/RtViewer/
-  )
-
-################################################################################
-
-# Define the WASM module
-# ---------------------------------------------------------------
-
-project(SingleFrameViewerWasm)
-
-add_executable(SingleFrameViewerWasm
-  SingleFrameViewer/SingleFrameViewer.cpp
-  )
-
-target_link_libraries(SingleFrameViewerWasm OrthancStone)
-
-# Declare installation files for the module
-# ---------------------------------------------------------------
-install(
-  TARGETS SingleFrameViewerWasm
-  RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/SingleFrameViewer/
-  )
-
-# Declare installation files for the companion files (web scaffolding)
-# please note that ${CMAKE_CURRENT_BINARY_DIR}/RtViewerWasm.js
-# (the generated JS loader for the WASM module) is handled by the `install1`
-# section above: it is considered to be the binary output of 
-# the linker.
-# ---------------------------------------------------------------
-install(
-  FILES
-  ${CMAKE_SOURCE_DIR}/SingleFrameViewer/SingleFrameViewerApp.js
-  ${CMAKE_SOURCE_DIR}/SingleFrameViewer/index.html
-  ${CMAKE_CURRENT_BINARY_DIR}/SingleFrameViewerWasm.wasm
-  DESTINATION ${CMAKE_INSTALL_PREFIX}/SingleFrameViewer/
-  )
+cmake_minimum_required(VERSION 2.8.3)
+
+project(OrthancStone)
+
+# Configuration of the Emscripten compiler for WebAssembly target
+# ---------------------------------------------------------------
+set(USE_WASM ON CACHE BOOL "")
+set(ORTHANC_FRAMEWORK_ROOT ${CMAKE_CURRENT_LIST_DIR}/../../../orthanc CACHE STRING "")
+set(STONE_ROOT ${CMAKE_CURRENT_LIST_DIR}/../../)
+
+set(EMSCRIPTEN_SET_LLVM_WASM_BACKEND ON CACHE BOOL "")
+
+set(WASM_FLAGS "-s WASM=1 -s FETCH=1")
+if (CMAKE_BUILD_TYPE STREQUAL "Debug")
+  set(WASM_FLAGS "${WASM_FLAGS} -s SAFE_HEAP=1")
+endif()
+
+set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${WASM_FLAGS}")
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${WASM_FLAGS}")
+
+set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s EXTRA_EXPORTED_RUNTIME_METHODS='[\"ccall\", \"cwrap\"]'")
+set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s ERROR_ON_UNDEFINED_SYMBOLS=1")
+set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s ASSERTIONS=1 -s DISABLE_EXCEPTION_CATCHING=0")
+set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s ALLOW_MEMORY_GROWTH=1 -s TOTAL_MEMORY=268435456")  # 256MB + resize
+set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s DISABLE_DEPRECATED_FIND_EVENT_TARGET_BEHAVIOR=1")
+add_definitions(
+  -DDISABLE_DEPRECATED_FIND_EVENT_TARGET_BEHAVIOR=1
+)
+
+# Stone of Orthanc configuration
+# ---------------------------------------------------------------
+set(ALLOW_DOWNLOADS ON)
+set(ORTHANC_FRAMEWORK_SOURCE "path")
+
+include(${STONE_ROOT}/Resources/CMake/OrthancStoneParameters.cmake)
+include(${ORTHANC_ROOT}/Resources/CMake/DownloadPackage.cmake)
+
+SET(ENABLE_DCMTK ON)
+SET(ENABLE_GOOGLE_TEST OFF)
+SET(ENABLE_LOCALE ON)  # Necessary for text rendering
+SET(ENABLE_WASM ON)
+SET(ORTHANC_SANDBOXED ON)
+
+
+# We embed a font to be used for on-screen overlays
+# ---------------------------------------------------------------
+
+DownloadPackage(
+  "a24b8136b8f3bb93f166baf97d9328de"
+  "http://orthanc.osimis.io/ThirdPartyDownloads/ubuntu-font-family-0.83.zip"
+  "${CMAKE_BINARY_DIR}/ubuntu-font-family-0.83")
+
+set(ORTHANC_STONE_APPLICATION_RESOURCES
+  UBUNTU_FONT  ${CMAKE_BINARY_DIR}/ubuntu-font-family-0.83/Ubuntu-R.ttf
+  )
+
+# this will set up the build system for Stone of Orthanc and will
+# populate the ORTHANC_STONE_SOURCES CMake variable
+include(${STONE_ROOT}/Resources/CMake/OrthancStoneConfiguration.cmake)
+
+include_directories(${STONE_ROOT})
+include_directories(../Common)
+
+add_library(OrthancStone STATIC
+  ${ORTHANC_STONE_SOURCES}
+  )
+
+################################################################################
+
+# Define the WASM module
+# ---------------------------------------------------------------
+
+project(RtViewerWasm)
+
+add_executable(RtViewerWasm
+  RtViewer/RtViewerWasm.cpp
+  ../Common/RtViewerApp.cpp
+  ../Common/RtViewerApp.h
+  ../Common/RtViewerView.cpp
+  ../Common/RtViewerView.h
+  )
+
+target_link_libraries(RtViewerWasm OrthancStone)
+
+# Declare installation files for the module
+# ---------------------------------------------------------------
+install(
+  TARGETS RtViewerWasm
+  RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/RtViewer/
+  )
+
+# Declare installation files for the companion files (web scaffolding)
+# please note that ${CMAKE_CURRENT_BINARY_DIR}/RtViewerWasm.js
+# (the generated JS loader for the WASM module) is handled by the `install1`
+# section above: it is considered to be the binary output of 
+# the linker.
+# ---------------------------------------------------------------
+install(
+  FILES
+  ${CMAKE_SOURCE_DIR}/RtViewer/RtViewerWasmApp.js
+  ${CMAKE_SOURCE_DIR}/RtViewer/index.html
+  ${CMAKE_CURRENT_BINARY_DIR}/RtViewerWasm.wasm
+  DESTINATION ${CMAKE_INSTALL_PREFIX}/RtViewer/
+  )
+
+################################################################################
+
+# Define the WASM module
+# ---------------------------------------------------------------
+
+project(SingleFrameViewerWasm)
+
+add_executable(SingleFrameViewerWasm
+  SingleFrameViewer/SingleFrameViewer.cpp
+  )
+
+target_link_libraries(SingleFrameViewerWasm OrthancStone)
+
+# Declare installation files for the module
+# ---------------------------------------------------------------
+install(
+  TARGETS SingleFrameViewerWasm
+  RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/SingleFrameViewer/
+  )
+
+# Declare installation files for the companion files (web scaffolding)
+# please note that ${CMAKE_CURRENT_BINARY_DIR}/RtViewerWasm.js
+# (the generated JS loader for the WASM module) is handled by the `install1`
+# section above: it is considered to be the binary output of 
+# the linker.
+# ---------------------------------------------------------------
+install(
+  FILES
+  ${CMAKE_SOURCE_DIR}/SingleFrameViewer/SingleFrameViewerApp.js
+  ${CMAKE_SOURCE_DIR}/SingleFrameViewer/index.html
+  ${CMAKE_CURRENT_BINARY_DIR}/SingleFrameViewerWasm.wasm
+  DESTINATION ${CMAKE_INSTALL_PREFIX}/SingleFrameViewer/
+  )