Mercurial > hg > orthanc-stone
comparison OrthancStone/Samples/RtViewerPlugin/CMakeLists.txt @ 1527:4c4b267e4004
RtViewerPlugin : similar to the StoneWebPlugin, but for the sole RtViewer sample
author | Benjamin Golinvaux <bgo@osimis.io> |
---|---|
date | Sun, 02 Aug 2020 15:13:58 +0200 |
parents | |
children | c1d991462c7b |
comparison
equal
deleted
inserted
replaced
1526:61023b0d39c8 | 1527:4c4b267e4004 |
---|---|
1 cmake_minimum_required(VERSION 2.8.3) | |
2 | |
3 project(StoneWebViewerPlugin) | |
4 | |
5 set(ORTHANC_PLUGIN_VERSION "mainline") | |
6 | |
7 if (ORTHANC_PLUGIN_VERSION STREQUAL "mainline") | |
8 set(ORTHANC_FRAMEWORK_DEFAULT_VERSION "mainline") | |
9 set(ORTHANC_FRAMEWORK_DEFAULT_SOURCE "hg") | |
10 else() | |
11 set(ORTHANC_FRAMEWORK_DEFAULT_VERSION "1.7.2") | |
12 set(ORTHANC_FRAMEWORK_DEFAULT_SOURCE "web") | |
13 endif() | |
14 | |
15 set(STONE_BINARIES_RT_VIEWER CACHE PATH "Path to the binaries of the RtViewer \"../WebAssembly\" folder") | |
16 | |
17 # Parameters of the build | |
18 set(STATIC_BUILD OFF CACHE BOOL "Static build of the third-party libraries (necessary for Windows)") | |
19 set(ALLOW_DOWNLOADS OFF CACHE BOOL "Allow CMake to download packages") | |
20 set(ORTHANC_FRAMEWORK_SOURCE "${ORTHANC_FRAMEWORK_DEFAULT_SOURCE}" CACHE STRING "Source of the Orthanc framework (can be \"system\", \"hg\", \"archive\", \"web\" or \"path\")") | |
21 set(ORTHANC_FRAMEWORK_VERSION "${ORTHANC_FRAMEWORK_DEFAULT_VERSION}" CACHE STRING "Version of the Orthanc framework") | |
22 set(ORTHANC_FRAMEWORK_ARCHIVE "" CACHE STRING "Path to the Orthanc archive, if ORTHANC_FRAMEWORK_SOURCE is \"archive\"") | |
23 set(ORTHANC_FRAMEWORK_ROOT "" CACHE STRING "Path to the Orthanc source directory, if ORTHANC_FRAMEWORK_SOURCE is \"path\"") | |
24 | |
25 | |
26 # Advanced parameters to fine-tune linking against system libraries | |
27 set(USE_SYSTEM_ORTHANC_SDK ON CACHE BOOL "Use the system version of the Orthanc plugin SDK") | |
28 set(ORTHANC_FRAMEWORK_STATIC OFF CACHE BOOL "If linking against the Orthanc framework system library, indicates whether this library was statically linked") | |
29 mark_as_advanced(ORTHANC_FRAMEWORK_STATIC) | |
30 | |
31 | |
32 # Download and setup the Orthanc framework | |
33 include(${CMAKE_SOURCE_DIR}/../../../OrthancStone/Resources/Orthanc/CMake/DownloadOrthancFramework.cmake) | |
34 | |
35 if (ORTHANC_FRAMEWORK_SOURCE STREQUAL "system") | |
36 link_libraries(${ORTHANC_FRAMEWORK_LIBRARIES}) | |
37 | |
38 else() | |
39 include(${ORTHANC_FRAMEWORK_ROOT}/Resources/CMake/OrthancFrameworkParameters.cmake) | |
40 set(ENABLE_MODULE_IMAGES OFF) | |
41 set(ENABLE_MODULE_JOBS OFF) | |
42 set(ENABLE_MODULE_DICOM OFF) | |
43 include(${ORTHANC_FRAMEWORK_ROOT}/Resources/CMake/OrthancFrameworkConfiguration.cmake) | |
44 | |
45 include_directories( | |
46 ${ORTHANC_FRAMEWORK_ROOT}/Sources | |
47 ) | |
48 endif() | |
49 | |
50 include(${CMAKE_SOURCE_DIR}/Resources/Orthanc/Plugins/OrthancPluginsExports.cmake) | |
51 | |
52 | |
53 if (STATIC_BUILD OR NOT USE_SYSTEM_ORTHANC_SDK) | |
54 include_directories(${CMAKE_SOURCE_DIR}/Resources/OrthancSdk-1.0.0) | |
55 else () | |
56 CHECK_INCLUDE_FILE_CXX(orthanc/OrthancCPlugin.h HAVE_ORTHANC_H) | |
57 if (NOT HAVE_ORTHANC_H) | |
58 message(FATAL_ERROR "Please install the headers of the Orthanc plugins SDK") | |
59 endif() | |
60 endif() | |
61 | |
62 | |
63 add_definitions( | |
64 -DHAS_ORTHANC_EXCEPTION=1 | |
65 -DPLUGIN_VERSION="${ORTHANC_PLUGIN_VERSION}" | |
66 -DPLUGIN_NAME="stone-webviewer" | |
67 ) | |
68 | |
69 | |
70 EmbedResources( | |
71 # Web Viewer Folders | |
72 # IMAGES ${STONE_BINARIES_WEB_VIEWER}/img/ | |
73 # WEB_APPLICATION ${CMAKE_SOURCE_DIR}/../WebApplication | |
74 | |
75 # Explorer extension code | |
76 ORTHANC_EXPLORER ${CMAKE_SOURCE_DIR}/OrthancExplorer.js | |
77 | |
78 # RtViewer individual files | |
79 RT_VIEWER_WASM_JS ${STONE_BINARIES_RT_VIEWER}/RtViewerWasm.js | |
80 RT_VIEWER_WASM ${STONE_BINARIES_RT_VIEWER}/RtViewerWasm.wasm | |
81 RT_VIEWER_WASM_APP_JS ${STONE_BINARIES_RT_VIEWER}/RtViewerWasmApp.js | |
82 RT_VIEWER_INDEX_HTML ${STONE_BINARIES_RT_VIEWER}/index.html | |
83 ) | |
84 | |
85 add_library(RtViewerPlugin SHARED | |
86 Plugin.cpp | |
87 ${AUTOGENERATED_SOURCES} | |
88 ${CMAKE_SOURCE_DIR}/Resources/Orthanc/Plugins/OrthancPluginCppWrapper.cpp | |
89 ${ORTHANC_CORE_SOURCES} | |
90 ) | |
91 | |
92 set_target_properties(RtViewerPlugin PROPERTIES | |
93 VERSION ${ORTHANC_PLUGIN_VERSION} | |
94 SOVERSION ${ORTHANC_PLUGIN_VERSION}) | |
95 | |
96 install( | |
97 TARGETS RtViewerPlugin | |
98 RUNTIME DESTINATION lib # Destination for Windows | |
99 LIBRARY DESTINATION share/orthanc/plugins # Destination for Linux | |
100 ) |