comparison RenderingPlugin/CMakeLists.txt @ 1877:a2955abe4c2e

skeleton for the RenderingPlugin
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 12 Jan 2022 08:23:38 +0100
parents
children ddaee6b96501
comparison
equal deleted inserted replaced
1876:b1f510e601d2 1877:a2955abe4c2e
1 # Stone of Orthanc
2 # Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
3 # Department, University Hospital of Liege, Belgium
4 # Copyright (C) 2017-2022 Osimis S.A., Belgium
5 # Copyright (C) 2021-2022 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
6 #
7 # This program is free software: you can redistribute it and/or
8 # modify it under the terms of the GNU General Public License as
9 # published by the Free Software Foundation, either version 3 of the
10 # License, or (at your option) any later version.
11 #
12 # This program is distributed in the hope that it will be useful, but
13 # WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 # General Public License for more details.
16 #
17 # You should have received a copy of the GNU General Public License
18 # along with this program. If not, see <http://www.gnu.org/licenses/>.
19
20
21 cmake_minimum_required(VERSION 2.8.3)
22 cmake_policy(SET CMP0058 NEW)
23
24 project(RenderingPlugin)
25 set(PLUGIN_VERSION "mainline")
26
27 if (PLUGIN_VERSION STREQUAL "mainline")
28 set(ORTHANC_FRAMEWORK_DEFAULT_VERSION "mainline")
29 set(ORTHANC_FRAMEWORK_DEFAULT_SOURCE "hg")
30 else()
31 set(ORTHANC_FRAMEWORK_DEFAULT_VERSION "1.10.0")
32 set(ORTHANC_FRAMEWORK_DEFAULT_SOURCE "web")
33 endif()
34
35
36 # Advanced parameters to fine-tune linking against system libraries
37 set(USE_SYSTEM_ORTHANC_SDK ON CACHE BOOL "Use the system version of the Orthanc plugin SDK")
38
39 include(${CMAKE_SOURCE_DIR}/../OrthancStone/Resources/CMake/OrthancStoneParameters.cmake)
40 include(${CMAKE_SOURCE_DIR}/../OrthancStone/Resources/CMake/OrthancStoneConfiguration.cmake)
41
42 include(${CMAKE_SOURCE_DIR}/Resources/Orthanc/Plugins/OrthancPluginsExports.cmake)
43
44
45 if (STATIC_BUILD OR NOT USE_SYSTEM_ORTHANC_SDK)
46 include_directories(${CMAKE_SOURCE_DIR}/Resources/Orthanc/Sdk-1.0.0)
47 else ()
48 CHECK_INCLUDE_FILE_CXX(orthanc/OrthancCPlugin.h HAVE_ORTHANC_H)
49 if (NOT HAVE_ORTHANC_H)
50 message(FATAL_ERROR "Please install the headers of the Orthanc plugins SDK")
51 endif()
52 endif()
53
54
55 EmbedResources( # TODO
56 )
57
58
59 add_definitions(
60 -DHAS_ORTHANC_EXCEPTION=1
61 -DPLUGIN_VERSION="${PLUGIN_VERSION}"
62 -DPLUGIN_NAME="stone-rendering"
63 -DORTHANC_ENABLE_SDL=OFF
64 -DORTHANC_ENABLE_WASM=OFF
65 )
66
67
68 if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
69 #SET(CMAKE_CXX_STANDARD_LIBRARIES "${CMAKE_CXX_STANDARD_LIBRARIES} -lws2_32")
70
71 execute_process(
72 COMMAND
73 ${PYTHON_EXECUTABLE} ${ORTHANC_FRAMEWORK_ROOT}/../Resources/WindowsResources.py
74 ${PLUGIN_VERSION} "StoneRendering" StoneWebViewer.dll "Stone rendering plugin for Orthanc"
75 ERROR_VARIABLE Failure
76 OUTPUT_FILE ${AUTOGENERATED_DIR}/Version.rc
77 )
78
79 if (Failure)
80 message(FATAL_ERROR "Error while computing the version information: ${Failure}")
81 endif()
82
83 list(APPEND AUTOGENERATED_SOURCES ${AUTOGENERATED_DIR}/Version.rc)
84 endif()
85
86
87 add_library(StoneRendering SHARED
88 Sources/Plugin.cpp
89 ${AUTOGENERATED_SOURCES}
90 ${CMAKE_SOURCE_DIR}/Resources/Orthanc/Plugins/OrthancPluginCppWrapper.cpp
91 ${ORTHANC_CORE_SOURCES}
92 ${ORTHANC_STONE_SOURCES}
93 )
94
95 set_target_properties(StoneRendering PROPERTIES
96 VERSION ${PLUGIN_VERSION}
97 SOVERSION ${PLUGIN_VERSION})
98
99 install(
100 TARGETS StoneRendering
101 RUNTIME DESTINATION lib # Destination for Windows
102 LIBRARY DESTINATION share/orthanc/plugins # Destination for Linux
103 )