comparison CMakeLists.txt @ 0:95226b754d9e

initial release
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 17 Sep 2018 11:34:55 +0200
parents
children 734066ca3b7d
comparison
equal deleted inserted replaced
-1:000000000000 0:95226b754d9e
1 # Orthanc - A Lightweight, RESTful DICOM Store
2 # Copyright (C) 2018 Osimis S.A., Belgium
3 #
4 # This program is free software: you can redistribute it and/or
5 # modify it under the terms of the GNU Affero General Public License
6 # as published by the Free Software Foundation, either version 3 of
7 # the License, or (at your option) any later version.
8 #
9 # This program is distributed in the hope that it will be useful, but
10 # WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 # Affero General Public License for more details.
13 #
14 # You should have received a copy of the GNU Affero General Public License
15 # along with this program. If not, see <http://www.gnu.org/licenses/>.
16
17
18 cmake_minimum_required(VERSION 2.8)
19 project(OrthancTransfersAccelerator)
20
21 set(ORTHANC_PLUGIN_VERSION "mainline")
22
23 if (ORTHANC_PLUGIN_VERSION STREQUAL "mainline")
24 set(ORTHANC_FRAMEWORK_VERSION "mainline")
25 set(ORTHANC_FRAMEWORK_DEFAULT_SOURCE "hg")
26 else()
27 set(ORTHANC_FRAMEWORK_VERSION "1.4.2")
28 set(ORTHANC_FRAMEWORK_DEFAULT_SOURCE "web")
29 endif()
30
31
32 # Parameters of the build
33 set(ORTHANC_FRAMEWORK_SOURCE "${ORTHANC_FRAMEWORK_DEFAULT_SOURCE}" CACHE STRING "Source of the Orthanc source code (can be \"hg\", \"archive\", \"web\" or \"path\")")
34 set(ORTHANC_FRAMEWORK_ARCHIVE "" CACHE STRING "Path to the Orthanc archive, if ORTHANC_FRAMEWORK_SOURCE is \"archive\"")
35 set(ORTHANC_FRAMEWORK_ROOT "" CACHE STRING "Path to the Orthanc source directory, if ORTHANC_FRAMEWORK_SOURCE is \"path\"")
36 set(ORTHANC_SDK_VERSION "framework" CACHE STRING "Version of the Orthanc plugin SDK to use, if not using the system version (can be \"1.4.2\" or \"framework\")")
37
38 # Advanced parameters to fine-tune linking against system libraries
39 set(USE_SYSTEM_ORTHANC_SDK ON CACHE BOOL "Use the system version of the Orthanc plugin SDK")
40
41
42 # Download and setup the Orthanc framework
43 include(${CMAKE_CURRENT_LIST_DIR}/Resources/Orthanc/DownloadOrthancFramework.cmake)
44 include(${ORTHANC_ROOT}/Resources/CMake/OrthancFrameworkParameters.cmake)
45
46 set(HAS_EMBEDDED_RESOURCES ON)
47 set(ENABLE_LOCALE OFF) # Disable support for locales (notably in Boost)
48 set(ENABLE_GOOGLE_TEST ON)
49 set(ENABLE_MODULE_IMAGES OFF)
50 set(ENABLE_MODULE_JOBS OFF)
51 set(ENABLE_MODULE_DICOM OFF)
52 set(ENABLE_ZLIB ON)
53
54 include(${ORTHANC_ROOT}/Resources/CMake/OrthancFrameworkConfiguration.cmake)
55 include_directories(${ORTHANC_ROOT})
56
57
58 # Check that the Orthanc SDK headers are available
59 if (STATIC_BUILD OR NOT USE_SYSTEM_ORTHANC_SDK)
60 if (ORTHANC_SDK_VERSION STREQUAL "1.4.2")
61 include_directories(${CMAKE_CURRENT_LIST_DIR}/Resources/Orthanc/Sdk-1.4.2)
62 elseif (ORTHANC_SDK_VERSION STREQUAL "framework")
63 include_directories(${ORTHANC_ROOT}/Plugins/Include)
64 else()
65 message(FATAL_ERROR "Unsupported version of the Orthanc plugin SDK: ${ORTHANC_SDK_VERSION}")
66 endif()
67 else ()
68 CHECK_INCLUDE_FILE_CXX(orthanc/OrthancCDatabasePlugin.h HAVE_ORTHANC_H)
69 if (NOT HAVE_ORTHANC_H)
70 message(FATAL_ERROR "Please install the headers of the Orthanc plugins SDK")
71 endif()
72 endif()
73
74
75
76 if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
77 execute_process(
78 COMMAND
79 ${PYTHON_EXECUTABLE} ${ORTHANC_ROOT}/Resources/WindowsResources.py
80 ${ORTHANC_PLUGIN_VERSION} "TransfersAccelerator index plugin" OrthancTransfersAccelerator.dll
81 "TransfersAccelerator as a database back-end to Orthanc (index)"
82 ERROR_VARIABLE Failure
83 OUTPUT_FILE ${AUTOGENERATED_DIR}/Version.rc
84 )
85
86 if (Failure)
87 message(FATAL_ERROR "Error while computing the version information: ${Failure}")
88 endif()
89
90 set(PLUGIN_RESOURCES ${AUTOGENERATED_DIR}/Version.rc)
91 endif()
92
93
94
95 EmbedResources(
96 ORTHANC_EXPLORER ${CMAKE_SOURCE_DIR}/Resources/OrthancExplorer.js
97 )
98
99 set(FRAMEWORK_SOURCES
100 Framework/DicomInstanceInfo.cpp
101 Framework/DownloadArea.cpp
102 Framework/HttpQueries/DetectTransferPlugin.cpp
103 Framework/HttpQueries/HttpQueriesQueue.cpp
104 Framework/HttpQueries/HttpQueriesRunner.cpp
105 Framework/OrthancInstancesCache.cpp
106 Framework/PullMode/BucketPullQuery.cpp
107 Framework/PullMode/PullJob.cpp
108 Framework/PushMode/ActivePushTransactions.cpp
109 Framework/PushMode/BucketPushQuery.cpp
110 Framework/PushMode/PushJob.cpp
111 Framework/SourceDicomInstance.cpp
112 Framework/StatefulOrthancJob.cpp
113 Framework/TransferBucket.cpp
114 Framework/TransferQuery.cpp
115 Framework/TransferScheduler.cpp
116 Framework/TransferToolbox.cpp
117 ${ORTHANC_ROOT}/Plugins/Samples/Common/OrthancPluginCppWrapper.cpp
118 )
119
120
121
122 add_library(OrthancTransfersAccelerator SHARED
123 Plugin/Plugin.cpp
124 Plugin/PluginContext.cpp
125
126 ${FRAMEWORK_SOURCES}
127 ${PLUGIN_RESOURCES}
128 ${ORTHANC_CORE_SOURCES}
129 ${AUTOGENERATED_SOURCES}
130 )
131
132 message("Setting the version of the library to ${ORTHANC_PLUGIN_VERSION}")
133
134 add_definitions(
135 -DORTHANC_PLUGIN_VERSION="${ORTHANC_PLUGIN_VERSION}"
136 -DHAS_ORTHANC_EXCEPTION=1
137 )
138
139 set_target_properties(OrthancTransfersAccelerator PROPERTIES
140 VERSION ${ORTHANC_PLUGIN_VERSION}
141 SOVERSION ${ORTHANC_PLUGIN_VERSION}
142 COMPILE_FLAGS -DORTHANC_ENABLE_LOGGING_PLUGIN=1
143 )
144
145 install(
146 TARGETS OrthancTransfersAccelerator
147 RUNTIME DESTINATION lib # Destination for Windows
148 LIBRARY DESTINATION share/orthanc/plugins # Destination for Linux
149 )
150
151 add_executable(UnitTests
152 UnitTests/UnitTestsMain.cpp
153
154 ${FRAMEWORK_SOURCES}
155 ${ORTHANC_CORE_SOURCES}
156 ${GOOGLE_TEST_SOURCES}
157 )
158
159 target_link_libraries(UnitTests ${GOOGLE_TEST_LIBRARIES})
160 set_target_properties(UnitTests PROPERTIES
161 COMPILE_FLAGS -DORTHANC_ENABLE_LOGGING_PLUGIN=0
162 )