comparison Applications/StoneWebViewer/Plugin/CMakeLists.txt @ 1538:d1806b4e4839

moving OrthancStone/Samples/ as Applications/Samples/
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 11 Aug 2020 13:24:38 +0200
parents StoneWebViewer/Plugin/CMakeLists.txt@de8cf5859e84
children 8ddf77198ed7
comparison
equal deleted inserted replaced
1537:de8cf5859e84 1538:d1806b4e4839
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
16
17 set(STONE_BINARIES "${CMAKE_SOURCE_DIR}/../../wasm-binaries/StoneWebViewer/" CACHE PATH "Path to the binaries of the \"../WebAssembly\" folder")
18
19 # Parameters of the build
20 set(STATIC_BUILD OFF CACHE BOOL "Static build of the third-party libraries (necessary for Windows)")
21 set(ALLOW_DOWNLOADS OFF CACHE BOOL "Allow CMake to download packages")
22 set(ORTHANC_FRAMEWORK_SOURCE "${ORTHANC_FRAMEWORK_DEFAULT_SOURCE}" CACHE STRING "Source of the Orthanc framework (can be \"system\", \"hg\", \"archive\", \"web\" or \"path\")")
23 set(ORTHANC_FRAMEWORK_VERSION "${ORTHANC_FRAMEWORK_DEFAULT_VERSION}" CACHE STRING "Version of the Orthanc framework")
24 set(ORTHANC_FRAMEWORK_ARCHIVE "" CACHE STRING "Path to the Orthanc archive, if ORTHANC_FRAMEWORK_SOURCE is \"archive\"")
25 set(ORTHANC_FRAMEWORK_ROOT "" CACHE STRING "Path to the Orthanc source directory, if ORTHANC_FRAMEWORK_SOURCE is \"path\"")
26
27
28 # Advanced parameters to fine-tune linking against system libraries
29 set(USE_SYSTEM_ORTHANC_SDK ON CACHE BOOL "Use the system version of the Orthanc plugin SDK")
30 set(ORTHANC_FRAMEWORK_STATIC OFF CACHE BOOL "If linking against the Orthanc framework system library, indicates whether this library was statically linked")
31 mark_as_advanced(ORTHANC_FRAMEWORK_STATIC)
32
33
34 # Download and setup the Orthanc framework
35 include(${CMAKE_SOURCE_DIR}/../../OrthancStone/Resources/Orthanc/CMake/DownloadOrthancFramework.cmake)
36
37 include_directories(${ORTHANC_FRAMEWORK_ROOT})
38
39 if (ORTHANC_FRAMEWORK_SOURCE STREQUAL "system")
40 link_libraries(${ORTHANC_FRAMEWORK_LIBRARIES})
41
42 else()
43 include(${ORTHANC_FRAMEWORK_ROOT}/../Resources/CMake/OrthancFrameworkParameters.cmake)
44 set(ENABLE_MODULE_IMAGES OFF)
45 set(ENABLE_MODULE_JOBS OFF)
46 set(ENABLE_MODULE_DICOM OFF)
47 include(${ORTHANC_FRAMEWORK_ROOT}/../Resources/CMake/OrthancFrameworkConfiguration.cmake)
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 # Folders
72 IMAGES ${STONE_BINARIES}/img/
73 WEB_APPLICATION ${CMAKE_SOURCE_DIR}/../WebApplication
74
75 # Individual files
76 ORTHANC_EXPLORER ${CMAKE_SOURCE_DIR}/OrthancExplorer.js
77 STONE_WEB_VIEWER_JS ${STONE_BINARIES}/StoneWebViewer.js
78 STONE_WEB_VIEWER_WASM ${STONE_BINARIES}/StoneWebViewer.wasm
79 STONE_WRAPPER ${STONE_BINARIES}/stone.js
80 )
81
82 add_library(StoneWebViewer SHARED
83 Plugin.cpp
84 ${AUTOGENERATED_SOURCES}
85 ${CMAKE_SOURCE_DIR}/../Resources/Orthanc/Plugins/OrthancPluginCppWrapper.cpp
86 ${ORTHANC_CORE_SOURCES}
87 )
88
89 set_target_properties(StoneWebViewer PROPERTIES
90 VERSION ${ORTHANC_PLUGIN_VERSION}
91 SOVERSION ${ORTHANC_PLUGIN_VERSION})
92
93 install(
94 TARGETS StoneWebViewer
95 RUNTIME DESTINATION lib # Destination for Windows
96 LIBRARY DESTINATION share/orthanc/plugins # Destination for Linux
97 )