Mercurial > hg > orthanc
annotate CMakeLists.txt @ 3260:345f86fd1ac3
fix (shame on me for not testing)
author | Alain Mazy <alain@mazy.be> |
---|---|
date | Tue, 19 Feb 2019 08:43:23 +0100 |
parents | 47fbb0467a62 |
children | 92d679112657 |
rev | line source |
---|---|
2691 | 1 cmake_minimum_required(VERSION 2.8) |
2 | |
3 project(Orthanc) | |
4 | |
5 | |
6 ##################################################################### | |
7 ## Generic parameters of the Orthanc framework | |
8 ##################################################################### | |
9 | |
10 include(${CMAKE_SOURCE_DIR}/Resources/CMake/OrthancFrameworkParameters.cmake) | |
11 | |
12 # Enable all the optional components of the Orthanc framework | |
13 set(ENABLE_CRYPTO_OPTIONS ON) | |
14 set(ENABLE_DCMTK ON) | |
15 set(ENABLE_DCMTK_NETWORKING ON) | |
16 set(ENABLE_GOOGLE_TEST ON) | |
17 set(ENABLE_JPEG ON) | |
18 set(ENABLE_LOCALE ON) | |
19 set(ENABLE_LUA ON) | |
20 set(ENABLE_PNG ON) | |
21 set(ENABLE_PUGIXML ON) | |
22 set(ENABLE_SQLITE ON) | |
23 set(ENABLE_WEB_CLIENT ON) | |
24 set(ENABLE_WEB_SERVER ON) | |
25 set(ENABLE_ZLIB ON) | |
26 | |
27 set(HAS_EMBEDDED_RESOURCES ON) | |
28 | |
29 | |
30 ##################################################################### | |
31 ## CMake parameters tunable at the command line to configure the | |
32 ## plugins, the companion tools, and the unit tests | |
33 ##################################################################### | |
34 | |
35 # Parameters of the build | |
36 SET(BUILD_MODALITY_WORKLISTS ON CACHE BOOL "Whether to build the sample plugin to serve modality worklists") | |
37 SET(BUILD_RECOVER_COMPRESSED_FILE ON CACHE BOOL "Whether to build the companion tool to recover files compressed using Orthanc") | |
38 SET(BUILD_SERVE_FOLDERS ON CACHE BOOL "Whether to build the ServeFolders plugin") | |
39 SET(ENABLE_PLUGINS ON CACHE BOOL "Enable plugins") | |
40 SET(UNIT_TESTS_WITH_HTTP_CONNEXIONS ON CACHE BOOL "Allow unit tests to make HTTP requests") | |
41 | |
42 | |
43 ##################################################################### | |
44 ## Configuration of the Orthanc framework | |
45 ##################################################################### | |
46 | |
47 include(${CMAKE_SOURCE_DIR}/Resources/CMake/VisualStudioPrecompiledHeaders.cmake) | |
48 include(${CMAKE_SOURCE_DIR}/Resources/CMake/OrthancFrameworkConfiguration.cmake) | |
49 | |
50 | |
51 ##################################################################### | |
52 ## List of source files | |
53 ##################################################################### | |
54 | |
55 set(ORTHANC_SERVER_SOURCES | |
3093
2e1808b6146a
reorganization of folders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3091
diff
changeset
|
56 OrthancServer/Database/Compatibility/DatabaseLookup.cpp |
2e1808b6146a
reorganization of folders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3091
diff
changeset
|
57 OrthancServer/Database/Compatibility/ICreateInstance.cpp |
2e1808b6146a
reorganization of folders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3091
diff
changeset
|
58 OrthancServer/Database/Compatibility/IGetChildrenMetadata.cpp |
3187
4bbadcd03966
refactoring retrieval of metadata from database
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3095
diff
changeset
|
59 OrthancServer/Database/Compatibility/ILookupResourceAndParent.cpp |
3093
2e1808b6146a
reorganization of folders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3091
diff
changeset
|
60 OrthancServer/Database/Compatibility/ILookupResources.cpp |
2e1808b6146a
reorganization of folders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3091
diff
changeset
|
61 OrthancServer/Database/Compatibility/SetOfResources.cpp |
3094
61da3c9b4121
cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3093
diff
changeset
|
62 OrthancServer/Database/ResourcesContent.cpp |
3093
2e1808b6146a
reorganization of folders
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3091
diff
changeset
|
63 OrthancServer/Database/SQLiteDatabaseWrapper.cpp |
2691 | 64 OrthancServer/DicomInstanceOrigin.cpp |
65 OrthancServer/DicomInstanceToStore.cpp | |
66 OrthancServer/ExportedResource.cpp | |
67 OrthancServer/LuaScripting.cpp | |
2933
4a38d7d4f0e0
new class: OrthancConfiguration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2893
diff
changeset
|
68 OrthancServer/OrthancConfiguration.cpp |
2691 | 69 OrthancServer/OrthancFindRequestHandler.cpp |
70 OrthancServer/OrthancHttpHandler.cpp | |
71 OrthancServer/OrthancInitialization.cpp | |
72 OrthancServer/OrthancMoveRequestHandler.cpp | |
73 OrthancServer/OrthancRestApi/OrthancRestAnonymizeModify.cpp | |
74 OrthancServer/OrthancRestApi/OrthancRestApi.cpp | |
75 OrthancServer/OrthancRestApi/OrthancRestArchive.cpp | |
76 OrthancServer/OrthancRestApi/OrthancRestChanges.cpp | |
77 OrthancServer/OrthancRestApi/OrthancRestModalities.cpp | |
78 OrthancServer/OrthancRestApi/OrthancRestResources.cpp | |
79 OrthancServer/OrthancRestApi/OrthancRestSystem.cpp | |
80 OrthancServer/QueryRetrieveHandler.cpp | |
3029
ea653ec47f31
new class: DatabaseConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3018
diff
changeset
|
81 OrthancServer/Search/DatabaseConstraint.cpp |
2892
ce310baccda6
DicomTagConstraint and DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2867
diff
changeset
|
82 OrthancServer/Search/DatabaseLookup.cpp |
ce310baccda6
DicomTagConstraint and DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2867
diff
changeset
|
83 OrthancServer/Search/DicomTagConstraint.cpp |
2691 | 84 OrthancServer/Search/HierarchicalMatcher.cpp |
3058
6faf575ba9cc
refactoring: class ISqlLookupFormatter to be used in orthanc-databases
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3057
diff
changeset
|
85 OrthancServer/Search/ISqlLookupFormatter.cpp |
2691 | 86 OrthancServer/ServerContext.cpp |
87 OrthancServer/ServerEnumerations.cpp | |
88 OrthancServer/ServerIndex.cpp | |
89 OrthancServer/ServerJobs/ArchiveJob.cpp | |
90 OrthancServer/ServerJobs/DicomModalityStoreJob.cpp | |
2867 | 91 OrthancServer/ServerJobs/DicomMoveScuJob.cpp |
2691 | 92 OrthancServer/ServerJobs/LuaJobManager.cpp |
2853
52b017d22a4f
New URI: "/studies/.../merge" to merge a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2844
diff
changeset
|
93 OrthancServer/ServerJobs/MergeStudyJob.cpp |
2691 | 94 OrthancServer/ServerJobs/Operations/DeleteResourceOperation.cpp |
3095
beeeb6096f27
removing dependencies upon ServerContext
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3094
diff
changeset
|
95 OrthancServer/ServerJobs/Operations/DicomInstanceOperationValue.cpp |
2691 | 96 OrthancServer/ServerJobs/Operations/ModifyInstanceOperation.cpp |
97 OrthancServer/ServerJobs/Operations/StorePeerOperation.cpp | |
98 OrthancServer/ServerJobs/Operations/StoreScuOperation.cpp | |
99 OrthancServer/ServerJobs/Operations/SystemCallOperation.cpp | |
100 OrthancServer/ServerJobs/OrthancJobUnserializer.cpp | |
101 OrthancServer/ServerJobs/OrthancPeerStoreJob.cpp | |
102 OrthancServer/ServerJobs/ResourceModificationJob.cpp | |
2844
99863d6245b2
New URI: "/studies/.../split" to split a study
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2808
diff
changeset
|
103 OrthancServer/ServerJobs/SplitStudyJob.cpp |
2691 | 104 OrthancServer/ServerToolbox.cpp |
105 OrthancServer/SliceOrdering.cpp | |
106 ) | |
107 | |
108 | |
109 set(ORTHANC_UNIT_TESTS_SOURCES | |
2893
1723cbba55c7
testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2892
diff
changeset
|
110 UnitTestsSources/DatabaseLookupTests.cpp |
2691 | 111 UnitTestsSources/DicomMapTests.cpp |
112 UnitTestsSources/FileStorageTests.cpp | |
113 UnitTestsSources/FromDcmtkTests.cpp | |
2893
1723cbba55c7
testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2892
diff
changeset
|
114 UnitTestsSources/ImageProcessingTests.cpp |
1723cbba55c7
testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2892
diff
changeset
|
115 UnitTestsSources/ImageTests.cpp |
1723cbba55c7
testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2892
diff
changeset
|
116 UnitTestsSources/JpegLosslessTests.cpp |
1723cbba55c7
testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2892
diff
changeset
|
117 UnitTestsSources/LuaTests.cpp |
2691 | 118 UnitTestsSources/MemoryCacheTests.cpp |
2893
1723cbba55c7
testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2892
diff
changeset
|
119 UnitTestsSources/MultiThreadingTests.cpp |
2691 | 120 UnitTestsSources/RestApiTests.cpp |
2893
1723cbba55c7
testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2892
diff
changeset
|
121 UnitTestsSources/SQLiteChromiumTests.cpp |
2691 | 122 UnitTestsSources/SQLiteTests.cpp |
123 UnitTestsSources/ServerIndexTests.cpp | |
2893
1723cbba55c7
testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2892
diff
changeset
|
124 UnitTestsSources/StreamTests.cpp |
1723cbba55c7
testing DicomTagConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2892
diff
changeset
|
125 UnitTestsSources/UnitTestsMain.cpp |
2691 | 126 UnitTestsSources/VersionsTests.cpp |
127 UnitTestsSources/ZipTests.cpp | |
128 ) | |
129 | |
130 | |
131 if (ENABLE_PLUGINS) | |
3074
495c5edce708
new extension for database plugin SDK: lookupResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3071
diff
changeset
|
132 include_directories(${CMAKE_SOURCE_DIR}/Plugins/Include) |
495c5edce708
new extension for database plugin SDK: lookupResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3071
diff
changeset
|
133 |
2691 | 134 list(APPEND ORTHANC_SERVER_SOURCES |
135 Plugins/Engine/OrthancPluginDatabase.cpp | |
136 Plugins/Engine/OrthancPlugins.cpp | |
137 Plugins/Engine/PluginsEnumerations.cpp | |
138 Plugins/Engine/PluginsErrorDictionary.cpp | |
2808
37583cd183ed
primitives to create jobs from plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2773
diff
changeset
|
139 Plugins/Engine/PluginsJob.cpp |
2691 | 140 Plugins/Engine/PluginsManager.cpp |
141 ) | |
142 | |
143 list(APPEND ORTHANC_UNIT_TESTS_SOURCES | |
144 UnitTestsSources/PluginsTests.cpp | |
145 ) | |
146 endif() | |
147 | |
148 | |
149 if (CMAKE_COMPILER_IS_GNUCXX | |
150 AND NOT CMAKE_CROSSCOMPILING | |
151 AND USE_DCMTK_360) | |
152 # Add the "-pedantic" flag only on the Orthanc sources, and only if | |
153 # cross-compiling DCMTK 3.6.0 | |
154 set(ORTHANC_ALL_SOURCES | |
155 ${ORTHANC_CORE_SOURCES_INTERNAL} | |
156 ${ORTHANC_DICOM_SOURCES_INTERNAL} | |
157 ${ORTHANC_SERVER_SOURCES} | |
158 ${ORTHANC_UNIT_TESTS_SOURCES} | |
159 Plugins/Samples/ServeFolders/Plugin.cpp | |
160 Plugins/Samples/ModalityWorklists/Plugin.cpp | |
161 OrthancServer/main.cpp | |
162 ) | |
163 | |
164 set_source_files_properties(${ORTHANC_ALL_SOURCES} | |
165 PROPERTIES COMPILE_FLAGS -pedantic | |
166 ) | |
167 endif() | |
168 | |
169 | |
170 ##################################################################### | |
171 ## Autogeneration of files | |
172 ##################################################################### | |
173 | |
174 set(ORTHANC_EMBEDDED_FILES | |
3094
61da3c9b4121
cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3093
diff
changeset
|
175 CONFIGURATION_SAMPLE ${CMAKE_CURRENT_SOURCE_DIR}/Resources/Configuration.json |
61da3c9b4121
cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3093
diff
changeset
|
176 DICOM_CONFORMANCE_STATEMENT ${CMAKE_CURRENT_SOURCE_DIR}/Resources/DicomConformanceStatement.txt |
61da3c9b4121
cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3093
diff
changeset
|
177 FONT_UBUNTU_MONO_BOLD_16 ${CMAKE_CURRENT_SOURCE_DIR}/Resources/Fonts/UbuntuMonoBold-16.json |
61da3c9b4121
cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3093
diff
changeset
|
178 LUA_TOOLBOX ${CMAKE_CURRENT_SOURCE_DIR}/Resources/Toolbox.lua |
61da3c9b4121
cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3093
diff
changeset
|
179 PREPARE_DATABASE ${CMAKE_CURRENT_SOURCE_DIR}/OrthancServer/Database/PrepareDatabase.sql |
61da3c9b4121
cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3093
diff
changeset
|
180 UPGRADE_DATABASE_3_TO_4 ${CMAKE_CURRENT_SOURCE_DIR}/OrthancServer/Database/Upgrade3To4.sql |
61da3c9b4121
cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3093
diff
changeset
|
181 UPGRADE_DATABASE_4_TO_5 ${CMAKE_CURRENT_SOURCE_DIR}/OrthancServer/Database/Upgrade4To5.sql |
61da3c9b4121
cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3093
diff
changeset
|
182 |
61da3c9b4121
cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3093
diff
changeset
|
183 INSTALL_TRACK_ATTACHMENTS_SIZE |
61da3c9b4121
cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3093
diff
changeset
|
184 ${CMAKE_CURRENT_SOURCE_DIR}/OrthancServer/Database/InstallTrackAttachmentsSize.sql |
2691 | 185 ) |
186 | |
187 if (STANDALONE_BUILD) | |
188 # We embed all the resources in the binaries for standalone builds | |
189 add_definitions(-DORTHANC_STANDALONE=1) | |
190 EmbedResources( | |
191 ${ORTHANC_EMBEDDED_FILES} | |
192 ORTHANC_EXPLORER ${CMAKE_CURRENT_SOURCE_DIR}/OrthancExplorer | |
193 ${DCMTK_DICTIONARIES} | |
194 ) | |
195 else() | |
196 add_definitions( | |
197 -DORTHANC_STANDALONE=0 | |
198 -DORTHANC_PATH=\"${CMAKE_SOURCE_DIR}\" | |
199 ) | |
200 EmbedResources( | |
201 ${ORTHANC_EMBEDDED_FILES} | |
202 ) | |
203 endif() | |
204 | |
205 if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows") | |
206 execute_process( | |
207 COMMAND | |
208 ${PYTHON_EXECUTABLE} ${ORTHANC_ROOT}/Resources/WindowsResources.py | |
209 ${ORTHANC_VERSION} Orthanc Orthanc.exe "Lightweight, RESTful DICOM server for medical imaging" | |
210 ERROR_VARIABLE Failure | |
211 OUTPUT_FILE ${AUTOGENERATED_DIR}/Orthanc.rc | |
212 ) | |
213 | |
214 if (Failure) | |
215 message(FATAL_ERROR "Error while computing the version information: ${Failure}") | |
216 endif() | |
217 | |
218 list(APPEND ORTHANC_RESOURCES ${AUTOGENERATED_DIR}/Orthanc.rc) | |
219 endif() | |
220 | |
221 | |
222 | |
223 ##################################################################### | |
224 ## Configuration of the C/C++ macros | |
225 ##################################################################### | |
226 | |
227 if (ENABLE_PLUGINS) | |
228 add_definitions(-DORTHANC_ENABLE_PLUGINS=1) | |
229 else() | |
230 add_definitions(-DORTHANC_ENABLE_PLUGINS=0) | |
231 endif() | |
232 | |
233 | |
234 if (UNIT_TESTS_WITH_HTTP_CONNEXIONS) | |
235 add_definitions(-DUNIT_TESTS_WITH_HTTP_CONNEXIONS=1) | |
236 else() | |
237 add_definitions(-DUNIT_TESTS_WITH_HTTP_CONNEXIONS=0) | |
238 endif() | |
239 | |
240 | |
241 add_definitions( | |
242 -DORTHANC_BUILD_UNIT_TESTS=1 | |
243 -DORTHANC_ENABLE_LOGGING_PLUGIN=0 | |
244 | |
245 # Macros for the plugins | |
246 -DHAS_ORTHANC_EXCEPTION=0 | |
247 -DMODALITY_WORKLISTS_VERSION="${ORTHANC_VERSION}" | |
248 -DSERVE_FOLDERS_VERSION="${ORTHANC_VERSION}" | |
249 ) | |
250 | |
251 | |
252 # Setup precompiled headers for Microsoft Visual Studio | |
253 | |
254 # WARNING: There must be NO MORE "add_definitions()", "include()" or | |
255 # "include_directories()" below, otherwise the generated precompiled | |
256 # headers might get broken! | |
257 | |
258 if (MSVC) | |
259 add_definitions(-DORTHANC_USE_PRECOMPILED_HEADERS=1) | |
260 | |
261 set(TMP | |
262 ${ORTHANC_CORE_SOURCES_INTERNAL} | |
263 ${ORTHANC_DICOM_SOURCES_INTERNAL} | |
264 ) | |
265 | |
266 ADD_VISUAL_STUDIO_PRECOMPILED_HEADERS( | |
267 "PrecompiledHeaders.h" "Core/PrecompiledHeaders.cpp" | |
268 TMP ORTHANC_CORE_PCH) | |
269 | |
270 ADD_VISUAL_STUDIO_PRECOMPILED_HEADERS( | |
271 "PrecompiledHeadersServer.h" "OrthancServer/PrecompiledHeadersServer.cpp" | |
272 ORTHANC_SERVER_SOURCES ORTHANC_SERVER_PCH) | |
273 | |
274 ADD_VISUAL_STUDIO_PRECOMPILED_HEADERS( | |
275 "PrecompiledHeadersUnitTests.h" "UnitTestsSources/PrecompiledHeadersUnitTests.cpp" | |
276 ORTHANC_UNIT_TESTS_SOURCES ORTHANC_UNIT_TESTS_PCH) | |
277 endif() | |
278 | |
279 | |
280 | |
281 ##################################################################### | |
282 ## Build the core of Orthanc | |
283 ##################################################################### | |
284 | |
285 # "CoreLibrary" contains all the third-party dependencies and the | |
286 # content of the "Core" folder | |
287 add_library(CoreLibrary | |
288 STATIC | |
289 ${ORTHANC_CORE_PCH} | |
290 ${ORTHANC_CORE_SOURCES} | |
291 ${ORTHANC_DICOM_SOURCES} | |
292 ${AUTOGENERATED_SOURCES} | |
293 ) | |
294 | |
295 | |
296 ##################################################################### | |
297 ## Build the Orthanc server | |
298 ##################################################################### | |
299 | |
300 add_library(ServerLibrary | |
301 STATIC | |
302 ${ORTHANC_SERVER_PCH} | |
303 ${ORTHANC_SERVER_SOURCES} | |
304 ) | |
305 | |
306 # Ensure autogenerated code is built before building ServerLibrary | |
307 add_dependencies(ServerLibrary CoreLibrary) | |
308 | |
309 add_executable(Orthanc | |
310 OrthancServer/main.cpp | |
311 ${ORTHANC_RESOURCES} | |
312 ) | |
313 | |
314 target_link_libraries(Orthanc ServerLibrary CoreLibrary ${DCMTK_LIBRARIES}) | |
315 | |
316 install( | |
317 TARGETS Orthanc | |
318 RUNTIME DESTINATION sbin | |
319 ) | |
320 | |
321 | |
322 ##################################################################### | |
323 ## Build the unit tests | |
324 ##################################################################### | |
325 | |
326 add_executable(UnitTests | |
327 ${GOOGLE_TEST_SOURCES} | |
328 ${ORTHANC_UNIT_TESTS_PCH} | |
329 ${ORTHANC_UNIT_TESTS_SOURCES} | |
330 ) | |
331 | |
332 target_link_libraries(UnitTests | |
333 ServerLibrary | |
334 CoreLibrary | |
335 ${DCMTK_LIBRARIES} | |
336 ${GOOGLE_TEST_LIBRARIES} | |
337 ) | |
338 | |
339 | |
340 ##################################################################### | |
3233
47fbb0467a62
Build a static library to share code between the plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3187
diff
changeset
|
341 ## Build a static library to share code between the plugins |
47fbb0467a62
Build a static library to share code between the plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3187
diff
changeset
|
342 ##################################################################### |
47fbb0467a62
Build a static library to share code between the plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3187
diff
changeset
|
343 |
47fbb0467a62
Build a static library to share code between the plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3187
diff
changeset
|
344 if (ENABLE_PLUGINS AND |
47fbb0467a62
Build a static library to share code between the plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3187
diff
changeset
|
345 (BUILD_SERVE_FOLDERS OR BUILD_MODALITY_WORKLISTS)) |
47fbb0467a62
Build a static library to share code between the plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3187
diff
changeset
|
346 add_library(ThirdPartyPlugins STATIC |
47fbb0467a62
Build a static library to share code between the plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3187
diff
changeset
|
347 ${BOOST_SOURCES} |
47fbb0467a62
Build a static library to share code between the plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3187
diff
changeset
|
348 ${JSONCPP_SOURCES} |
47fbb0467a62
Build a static library to share code between the plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3187
diff
changeset
|
349 ${LIBICONV_SOURCES} |
47fbb0467a62
Build a static library to share code between the plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3187
diff
changeset
|
350 ${LIBICU_SOURCES} |
47fbb0467a62
Build a static library to share code between the plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3187
diff
changeset
|
351 Plugins/Samples/Common/OrthancPluginCppWrapper.cpp |
47fbb0467a62
Build a static library to share code between the plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3187
diff
changeset
|
352 ) |
47fbb0467a62
Build a static library to share code between the plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3187
diff
changeset
|
353 |
47fbb0467a62
Build a static library to share code between the plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3187
diff
changeset
|
354 # Add the "-fPIC" option as this static library must be embedded |
47fbb0467a62
Build a static library to share code between the plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3187
diff
changeset
|
355 # inside shared libraries (important on UNIX) |
47fbb0467a62
Build a static library to share code between the plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3187
diff
changeset
|
356 set_property( |
47fbb0467a62
Build a static library to share code between the plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3187
diff
changeset
|
357 TARGET ThirdPartyPlugins |
47fbb0467a62
Build a static library to share code between the plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3187
diff
changeset
|
358 PROPERTY POSITION_INDEPENDENT_CODE ON |
47fbb0467a62
Build a static library to share code between the plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3187
diff
changeset
|
359 ) |
47fbb0467a62
Build a static library to share code between the plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3187
diff
changeset
|
360 endif() |
47fbb0467a62
Build a static library to share code between the plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3187
diff
changeset
|
361 |
47fbb0467a62
Build a static library to share code between the plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3187
diff
changeset
|
362 |
47fbb0467a62
Build a static library to share code between the plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3187
diff
changeset
|
363 ##################################################################### |
2691 | 364 ## Build the "ServeFolders" plugin |
365 ##################################################################### | |
366 | |
367 if (ENABLE_PLUGINS AND BUILD_SERVE_FOLDERS) | |
368 if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows") | |
369 execute_process( | |
370 COMMAND | |
371 ${PYTHON_EXECUTABLE} ${ORTHANC_ROOT}/Resources/WindowsResources.py | |
372 ${ORTHANC_VERSION} ServeFolders ServeFolders.dll "Orthanc plugin to serve additional folders" | |
373 ERROR_VARIABLE Failure | |
374 OUTPUT_FILE ${AUTOGENERATED_DIR}/ServeFolders.rc | |
375 ) | |
376 | |
377 if (Failure) | |
378 message(FATAL_ERROR "Error while computing the version information: ${Failure}") | |
379 endif() | |
380 | |
381 list(APPEND SERVE_FOLDERS_RESOURCES ${AUTOGENERATED_DIR}/ServeFolders.rc) | |
382 endif() | |
383 | |
384 add_library(ServeFolders SHARED | |
385 Plugins/Samples/ServeFolders/Plugin.cpp | |
386 ${SERVE_FOLDERS_RESOURCES} | |
387 ) | |
388 | |
3233
47fbb0467a62
Build a static library to share code between the plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3187
diff
changeset
|
389 target_link_libraries(ServeFolders ThirdPartyPlugins) |
47fbb0467a62
Build a static library to share code between the plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3187
diff
changeset
|
390 |
2691 | 391 set_target_properties( |
392 ServeFolders PROPERTIES | |
393 VERSION ${ORTHANC_VERSION} | |
394 SOVERSION ${ORTHANC_VERSION} | |
395 ) | |
396 | |
397 install( | |
398 TARGETS ServeFolders | |
399 RUNTIME DESTINATION lib # Destination for Windows | |
400 LIBRARY DESTINATION share/orthanc/plugins # Destination for Linux | |
401 ) | |
402 endif() | |
403 | |
404 | |
405 | |
406 ##################################################################### | |
407 ## Build the "ModalityWorklists" plugin | |
408 ##################################################################### | |
409 | |
410 if (ENABLE_PLUGINS AND BUILD_MODALITY_WORKLISTS) | |
411 if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows") | |
412 execute_process( | |
413 COMMAND | |
414 ${PYTHON_EXECUTABLE} ${ORTHANC_ROOT}/Resources/WindowsResources.py | |
415 ${ORTHANC_VERSION} ModalityWorklists ModalityWorklists.dll "Sample Orthanc plugin to serve modality worklists" | |
416 ERROR_VARIABLE Failure | |
417 OUTPUT_FILE ${AUTOGENERATED_DIR}/ModalityWorklists.rc | |
418 ) | |
419 | |
420 if (Failure) | |
421 message(FATAL_ERROR "Error while computing the version information: ${Failure}") | |
422 endif() | |
423 | |
424 list(APPEND MODALITY_WORKLISTS_RESOURCES ${AUTOGENERATED_DIR}/ModalityWorklists.rc) | |
425 endif() | |
426 | |
427 add_library(ModalityWorklists SHARED | |
428 Plugins/Samples/ModalityWorklists/Plugin.cpp | |
429 ${MODALITY_WORKLISTS_RESOURCES} | |
430 ) | |
431 | |
3233
47fbb0467a62
Build a static library to share code between the plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3187
diff
changeset
|
432 target_link_libraries(ModalityWorklists ThirdPartyPlugins) |
47fbb0467a62
Build a static library to share code between the plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3187
diff
changeset
|
433 |
2691 | 434 set_target_properties( |
435 ModalityWorklists PROPERTIES | |
436 VERSION ${ORTHANC_VERSION} | |
437 SOVERSION ${ORTHANC_VERSION} | |
438 ) | |
439 | |
440 install( | |
441 TARGETS ModalityWorklists | |
442 RUNTIME DESTINATION lib # Destination for Windows | |
443 LIBRARY DESTINATION share/orthanc/plugins # Destination for Linux | |
444 ) | |
445 endif() | |
446 | |
447 | |
448 | |
449 ##################################################################### | |
450 ## Build the companion tool to recover files compressed using Orthanc | |
451 ##################################################################### | |
452 | |
453 if (BUILD_RECOVER_COMPRESSED_FILE) | |
454 set(RECOVER_COMPRESSED_SOURCES | |
455 Resources/Samples/Tools/RecoverCompressedFile.cpp | |
456 ) | |
457 | |
458 if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows") | |
459 execute_process( | |
460 COMMAND | |
461 ${PYTHON_EXECUTABLE} ${ORTHANC_ROOT}/Resources/WindowsResources.py | |
462 ${ORTHANC_VERSION} OrthancRecoverCompressedFile OrthancRecoverCompressedFile.exe | |
463 "Lightweight, RESTful DICOM server for medical imaging" | |
464 ERROR_VARIABLE Failure | |
465 OUTPUT_FILE ${AUTOGENERATED_DIR}/OrthancRecoverCompressedFile.rc | |
466 ) | |
467 | |
468 if (Failure) | |
469 message(FATAL_ERROR "Error while computing the version information: ${Failure}") | |
470 endif() | |
471 | |
472 list(APPEND RECOVER_COMPRESSED_SOURCES | |
473 ${AUTOGENERATED_DIR}/OrthancRecoverCompressedFile.rc | |
474 ) | |
475 endif() | |
476 | |
477 add_executable(OrthancRecoverCompressedFile ${RECOVER_COMPRESSED_SOURCES}) | |
478 | |
479 target_link_libraries(OrthancRecoverCompressedFile CoreLibrary) | |
480 | |
481 install( | |
482 TARGETS OrthancRecoverCompressedFile | |
483 RUNTIME DESTINATION bin | |
484 ) | |
485 endif() | |
486 | |
487 | |
488 | |
489 ##################################################################### | |
490 ## Generate the documentation if Doxygen is present | |
491 ##################################################################### | |
492 | |
493 find_package(Doxygen) | |
494 if (DOXYGEN_FOUND) | |
495 configure_file( | |
496 ${CMAKE_SOURCE_DIR}/Resources/Orthanc.doxygen | |
497 ${CMAKE_CURRENT_BINARY_DIR}/Orthanc.doxygen | |
498 @ONLY) | |
499 | |
500 configure_file( | |
501 ${CMAKE_SOURCE_DIR}/Resources/OrthancPlugin.doxygen | |
502 ${CMAKE_CURRENT_BINARY_DIR}/OrthancPlugin.doxygen | |
503 @ONLY) | |
504 | |
505 add_custom_target(doc | |
506 ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Orthanc.doxygen | |
507 COMMENT "Generating internal documentation with Doxygen" VERBATIM | |
508 ) | |
509 | |
510 add_custom_command(TARGET Orthanc | |
511 POST_BUILD | |
512 COMMAND ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/OrthancPlugin.doxygen | |
513 WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} | |
514 COMMENT "Generating plugin documentation with Doxygen" VERBATIM | |
515 ) | |
516 | |
517 install( | |
518 DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/OrthancPluginDocumentation/doc/ | |
519 DESTINATION share/doc/orthanc/OrthancPlugin | |
520 ) | |
521 else() | |
522 message("Doxygen not found. The documentation will not be built.") | |
523 endif() | |
524 | |
525 | |
526 | |
527 ##################################################################### | |
528 ## Install the plugin SDK | |
529 ##################################################################### | |
530 | |
531 if (ENABLE_PLUGINS) | |
532 install( | |
533 FILES | |
534 Plugins/Include/orthanc/OrthancCPlugin.h | |
535 Plugins/Include/orthanc/OrthancCDatabasePlugin.h | |
536 DESTINATION include/orthanc | |
537 ) | |
538 endif() | |
539 | |
540 | |
541 | |
542 ##################################################################### | |
543 ## Prepare the "uninstall" target | |
544 ## http://www.cmake.org/Wiki/CMake_FAQ#Can_I_do_.22make_uninstall.22_with_CMake.3F | |
545 ##################################################################### | |
546 | |
547 configure_file( | |
548 "${CMAKE_CURRENT_SOURCE_DIR}/Resources/CMake/Uninstall.cmake.in" | |
549 "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" | |
550 IMMEDIATE @ONLY) | |
551 | |
552 add_custom_target(uninstall | |
553 COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake) |