Mercurial > hg > orthanc-python
annotate Resources/Orthanc/CMake/DownloadOrthancFramework.cmake @ 78:2b9d82366e3a
sync
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 12 Aug 2021 16:05:49 +0200 |
parents | 07fdf388c12e |
children | c814297de620 |
rev | line source |
---|---|
36
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1 # Orthanc - A Lightweight, RESTful DICOM Store |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2 # Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3 # Department, University Hospital of Liege, Belgium |
56
23f3099bed47
upgrade to year 2021
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
49
diff
changeset
|
4 # Copyright (C) 2017-2021 Osimis S.A., Belgium |
36
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
5 # |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
6 # This program is free software: you can redistribute it and/or |
40 | 7 # modify it under the terms of the GNU Lesser General Public License |
8 # as published by the Free Software Foundation, either version 3 of | |
9 # the License, or (at your option) any later version. | |
36
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
10 # |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
11 # This program is distributed in the hope that it will be useful, but |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
12 # WITHOUT ANY WARRANTY; without even the implied warranty of |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
40 | 14 # Lesser General Public License for more details. |
36
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
15 # |
40 | 16 # You should have received a copy of the GNU Lesser General Public |
17 # License along with this program. If not, see | |
18 # <http://www.gnu.org/licenses/>. | |
36
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
19 |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
20 |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
21 |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
22 ## |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
23 ## Check whether the parent script sets the mandatory variables |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
24 ## |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
25 |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
26 if (NOT DEFINED ORTHANC_FRAMEWORK_SOURCE OR |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
27 (NOT ORTHANC_FRAMEWORK_SOURCE STREQUAL "system" AND |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
28 NOT ORTHANC_FRAMEWORK_SOURCE STREQUAL "hg" AND |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
29 NOT ORTHANC_FRAMEWORK_SOURCE STREQUAL "web" AND |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
30 NOT ORTHANC_FRAMEWORK_SOURCE STREQUAL "archive" AND |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
31 NOT ORTHANC_FRAMEWORK_SOURCE STREQUAL "path")) |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
32 message(FATAL_ERROR "The variable ORTHANC_FRAMEWORK_SOURCE must be set to \"system\", \"hg\", \"web\", \"archive\" or \"path\"") |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
33 endif() |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
34 |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
35 |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
36 ## |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
37 ## Detection of the requested version |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
38 ## |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
39 |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
40 if (ORTHANC_FRAMEWORK_SOURCE STREQUAL "hg" OR |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
41 ORTHANC_FRAMEWORK_SOURCE STREQUAL "archive" OR |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
42 ORTHANC_FRAMEWORK_SOURCE STREQUAL "web") |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
43 if (NOT DEFINED ORTHANC_FRAMEWORK_VERSION) |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
44 message(FATAL_ERROR "The variable ORTHANC_FRAMEWORK_VERSION must be set") |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
45 endif() |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
46 |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
47 if (DEFINED ORTHANC_FRAMEWORK_MAJOR OR |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
48 DEFINED ORTHANC_FRAMEWORK_MINOR OR |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
49 DEFINED ORTHANC_FRAMEWORK_REVISION OR |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
50 DEFINED ORTHANC_FRAMEWORK_MD5) |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
51 message(FATAL_ERROR "Some internal variable has been set") |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
52 endif() |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
53 |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
54 set(ORTHANC_FRAMEWORK_MD5 "") |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
55 |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
56 if (NOT DEFINED ORTHANC_FRAMEWORK_BRANCH) |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
57 if (ORTHANC_FRAMEWORK_VERSION STREQUAL "mainline") |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
58 set(ORTHANC_FRAMEWORK_BRANCH "default") |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
59 set(ORTHANC_FRAMEWORK_MAJOR 999) |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
60 set(ORTHANC_FRAMEWORK_MINOR 999) |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
61 set(ORTHANC_FRAMEWORK_REVISION 999) |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
62 |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
63 else() |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
64 set(ORTHANC_FRAMEWORK_BRANCH "Orthanc-${ORTHANC_FRAMEWORK_VERSION}") |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
65 |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
66 set(RE "^([0-9]+)\\.([0-9]+)\\.([0-9]+)$") |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
67 string(REGEX REPLACE ${RE} "\\1" ORTHANC_FRAMEWORK_MAJOR ${ORTHANC_FRAMEWORK_VERSION}) |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
68 string(REGEX REPLACE ${RE} "\\2" ORTHANC_FRAMEWORK_MINOR ${ORTHANC_FRAMEWORK_VERSION}) |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
69 string(REGEX REPLACE ${RE} "\\3" ORTHANC_FRAMEWORK_REVISION ${ORTHANC_FRAMEWORK_VERSION}) |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
70 |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
71 if (NOT ORTHANC_FRAMEWORK_MAJOR MATCHES "^[0-9]+$" OR |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
72 NOT ORTHANC_FRAMEWORK_MINOR MATCHES "^[0-9]+$" OR |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
73 NOT ORTHANC_FRAMEWORK_REVISION MATCHES "^[0-9]+$") |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
74 message("Bad version of the Orthanc framework: ${ORTHANC_FRAMEWORK_VERSION}") |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
75 endif() |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
76 |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
77 if (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.3.1") |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
78 set(ORTHANC_FRAMEWORK_MD5 "dac95bd6cf86fb19deaf4e612961f378") |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
79 elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.3.2") |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
80 set(ORTHANC_FRAMEWORK_MD5 "d0ccdf68e855d8224331f13774992750") |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
81 elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.4.0") |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
82 set(ORTHANC_FRAMEWORK_MD5 "81e15f34d97ac32bbd7d26e85698835a") |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
83 elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.4.1") |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
84 set(ORTHANC_FRAMEWORK_MD5 "9b6f6114264b17ed421b574cd6476127") |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
85 elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.4.2") |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
86 set(ORTHANC_FRAMEWORK_MD5 "d1ee84927dcf668e60eb5868d24b9394") |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
87 elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.5.0") |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
88 set(ORTHANC_FRAMEWORK_MD5 "4429d8d9dea4ff6648df80ec3c64d79e") |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
89 elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.5.1") |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
90 set(ORTHANC_FRAMEWORK_MD5 "099671538865e5da96208b37494d6718") |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
91 elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.5.2") |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
92 set(ORTHANC_FRAMEWORK_MD5 "8867050f3e9a1ce6157c1ea7a9433b1b") |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
93 elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.5.3") |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
94 set(ORTHANC_FRAMEWORK_MD5 "bf2f5ed1adb8b0fc5f10d278e68e1dfe") |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
95 elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.5.4") |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
96 set(ORTHANC_FRAMEWORK_MD5 "404baef5d4c43e7c5d9410edda8ef5a5") |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
97 elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.5.5") |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
98 set(ORTHANC_FRAMEWORK_MD5 "cfc437e0687ae4bd725fd93dc1f08bc4") |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
99 elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.5.6") |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
100 set(ORTHANC_FRAMEWORK_MD5 "3c29de1e289b5472342947168f0105c0") |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
101 elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.5.7") |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
102 set(ORTHANC_FRAMEWORK_MD5 "e1b76f01116d9b5d4ac8cc39980560e3") |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
103 elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.5.8") |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
104 set(ORTHANC_FRAMEWORK_MD5 "82323e8c49a667f658a3639ea4dbc336") |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
105 elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.6.0") |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
106 set(ORTHANC_FRAMEWORK_MD5 "eab428d6e53f61e847fa360bb17ebe25") |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
107 elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.6.1") |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
108 set(ORTHANC_FRAMEWORK_MD5 "3971f5de96ba71dc9d3f3690afeaa7c0") |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
109 elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.7.0") |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
110 set(ORTHANC_FRAMEWORK_MD5 "ce5f689e852b01d3672bd3d2f952a5ef") |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
111 elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.7.1") |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
112 set(ORTHANC_FRAMEWORK_MD5 "3c171217f930abe80246997bdbcaf7cc") |
41
393d2da0722a
upgrade to Orthanc SDK 1.7.2
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
40
diff
changeset
|
113 elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.7.2") |
393d2da0722a
upgrade to Orthanc SDK 1.7.2
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
40
diff
changeset
|
114 set(ORTHANC_FRAMEWORK_MD5 "328f94dcbd78c169655a13f7ad58a2c2") |
48 | 115 elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.7.3") |
116 set(ORTHANC_FRAMEWORK_MD5 "3f1ba9502ec7c5449971d3b56087bcde") | |
117 elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.7.4") | |
118 set(ORTHANC_FRAMEWORK_MD5 "19fcb7c21876af86546baa048a22c6c0") | |
119 elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.8.0") | |
120 set(ORTHANC_FRAMEWORK_MD5 "f8ec7554ef5d23ea4ce474b1e8214de9") | |
49
9e466631660a
ugrade to Orthanc SDK 1.8.1
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
48
diff
changeset
|
121 elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.8.1") |
9e466631660a
ugrade to Orthanc SDK 1.8.1
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
48
diff
changeset
|
122 set(ORTHANC_FRAMEWORK_MD5 "db094f96399cbe8b9bbdbce34884c220") |
56
23f3099bed47
upgrade to year 2021
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
49
diff
changeset
|
123 elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.8.2") |
23f3099bed47
upgrade to year 2021
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
49
diff
changeset
|
124 set(ORTHANC_FRAMEWORK_MD5 "8bfa10e66c9931e74111be0bfb1f4548") |
69 | 125 elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.9.0") |
126 set(ORTHANC_FRAMEWORK_MD5 "cea0b02ce184671eaf1bd668beefbf28") | |
127 elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.9.1") | |
128 set(ORTHANC_FRAMEWORK_MD5 "08eebc66ef93c3b40115c38501db5fbd") | |
129 elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.9.2") | |
130 set(ORTHANC_FRAMEWORK_MD5 "3ea66c09f64aca990016683b6375734e") | |
131 elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.9.3") | |
132 set(ORTHANC_FRAMEWORK_MD5 "9b86e6f00e03278293cd15643cc0233f") | |
78 | 133 elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.9.4") |
134 set(ORTHANC_FRAMEWORK_MD5 "6d5ca4a73ac7d42445041ca79de1624d") | |
135 elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.9.5") | |
136 set(ORTHANC_FRAMEWORK_MD5 "10fc64de1254a095e5d3ed3931f0cfbb") | |
137 elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.9.6") | |
138 set(ORTHANC_FRAMEWORK_MD5 "4b5d05683d747c29b2860ad79d11e62e") | |
36
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
139 |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
140 # Below this point are development snapshots that were used to |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
141 # release some plugin, before an official release of the Orthanc |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
142 # framework was available. Here is the command to be used to |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
143 # generate a proper archive: |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
144 # |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
145 # $ hg archive /tmp/Orthanc-`hg id -i | sed 's/\+//'`.tar.gz |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
146 # |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
147 elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "ae0e3fd609df") |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
148 # DICOMweb 1.1 (framework pre-1.6.0) |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
149 set(ORTHANC_FRAMEWORK_MD5 "7e09e9b530a2f527854f0b782d7e0645") |
49
9e466631660a
ugrade to Orthanc SDK 1.8.1
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
48
diff
changeset
|
150 elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "82652c5fc04f") |
9e466631660a
ugrade to Orthanc SDK 1.8.1
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
48
diff
changeset
|
151 # Stone Web viewer 1.0 (framework pre-1.8.1) |
9e466631660a
ugrade to Orthanc SDK 1.8.1
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
48
diff
changeset
|
152 set(ORTHANC_FRAMEWORK_MD5 "d77331d68917e66a3f4f9b807bbdab7f") |
56
23f3099bed47
upgrade to year 2021
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
49
diff
changeset
|
153 elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "4a3ba4bf4ba7") |
23f3099bed47
upgrade to year 2021
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
49
diff
changeset
|
154 # PostgreSQL 3.3 (framework pre-1.8.2) |
23f3099bed47
upgrade to year 2021
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
49
diff
changeset
|
155 set(ORTHANC_FRAMEWORK_MD5 "2d82bddf06f9cfe82095495cb3b8abde") |
23f3099bed47
upgrade to year 2021
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
49
diff
changeset
|
156 elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "23ad1b9c7800") |
23f3099bed47
upgrade to year 2021
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
49
diff
changeset
|
157 # For "Toolbox::ReadJson()" and "Toolbox::Write{...}Json()" (pre-1.9.0) |
23f3099bed47
upgrade to year 2021
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
49
diff
changeset
|
158 set(ORTHANC_FRAMEWORK_MD5 "9af92080e57c60dd288eba46ce606c00") |
36
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
159 endif() |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
160 endif() |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
161 endif() |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
162 |
46 | 163 elseif (ORTHANC_FRAMEWORK_SOURCE STREQUAL "path") |
36
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
164 message("Using the Orthanc framework from a path of the filesystem. Assuming mainline version.") |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
165 set(ORTHANC_FRAMEWORK_MAJOR 999) |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
166 set(ORTHANC_FRAMEWORK_MINOR 999) |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
167 set(ORTHANC_FRAMEWORK_REVISION 999) |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
168 endif() |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
169 |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
170 |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
171 |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
172 ## |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
173 ## Detection of the third-party software |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
174 ## |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
175 |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
176 if (ORTHANC_FRAMEWORK_SOURCE STREQUAL "hg") |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
177 find_program(ORTHANC_FRAMEWORK_HG hg) |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
178 |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
179 if (${ORTHANC_FRAMEWORK_HG} MATCHES "ORTHANC_FRAMEWORK_HG-NOTFOUND") |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
180 message(FATAL_ERROR "Please install Mercurial") |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
181 endif() |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
182 endif() |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
183 |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
184 |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
185 if (ORTHANC_FRAMEWORK_SOURCE STREQUAL "archive" OR |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
186 ORTHANC_FRAMEWORK_SOURCE STREQUAL "web") |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
187 if ("${CMAKE_HOST_SYSTEM_NAME}" STREQUAL "Windows") |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
188 find_program(ORTHANC_FRAMEWORK_7ZIP 7z |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
189 PATHS |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
190 "$ENV{ProgramFiles}/7-Zip" |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
191 "$ENV{ProgramW6432}/7-Zip" |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
192 ) |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
193 |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
194 if (${ORTHANC_FRAMEWORK_7ZIP} MATCHES "ORTHANC_FRAMEWORK_7ZIP-NOTFOUND") |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
195 message(FATAL_ERROR "Please install the '7-zip' software (http://www.7-zip.org/)") |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
196 endif() |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
197 |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
198 else() |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
199 find_program(ORTHANC_FRAMEWORK_TAR tar) |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
200 if (${ORTHANC_FRAMEWORK_TAR} MATCHES "ORTHANC_FRAMEWORK_TAR-NOTFOUND") |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
201 message(FATAL_ERROR "Please install the 'tar' package") |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
202 endif() |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
203 endif() |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
204 endif() |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
205 |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
206 |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
207 |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
208 ## |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
209 ## Case of the Orthanc framework specified as a path on the filesystem |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
210 ## |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
211 |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
212 if (ORTHANC_FRAMEWORK_SOURCE STREQUAL "path") |
46 | 213 if (NOT DEFINED ORTHANC_FRAMEWORK_ROOT OR |
214 ORTHANC_FRAMEWORK_ROOT STREQUAL "") | |
36
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
215 message(FATAL_ERROR "The variable ORTHANC_FRAMEWORK_ROOT must provide the path to the sources of Orthanc") |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
216 endif() |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
217 |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
218 if (NOT EXISTS ${ORTHANC_FRAMEWORK_ROOT}) |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
219 message(FATAL_ERROR "Non-existing directory: ${ORTHANC_FRAMEWORK_ROOT}") |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
220 endif() |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
221 endif() |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
222 |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
223 |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
224 |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
225 ## |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
226 ## Case of the Orthanc framework cloned using Mercurial |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
227 ## |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
228 |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
229 if (ORTHANC_FRAMEWORK_SOURCE STREQUAL "hg") |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
230 if (NOT STATIC_BUILD AND NOT ALLOW_DOWNLOADS) |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
231 message(FATAL_ERROR "CMake is not allowed to download from Internet. Please set the ALLOW_DOWNLOADS option to ON") |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
232 endif() |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
233 |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
234 set(ORTHANC_ROOT ${CMAKE_BINARY_DIR}/orthanc) |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
235 |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
236 if (EXISTS ${ORTHANC_ROOT}) |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
237 message("Updating the Orthanc source repository using Mercurial") |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
238 execute_process( |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
239 COMMAND ${ORTHANC_FRAMEWORK_HG} pull |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
240 WORKING_DIRECTORY ${ORTHANC_ROOT} |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
241 RESULT_VARIABLE Failure |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
242 ) |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
243 else() |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
244 message("Forking the Orthanc source repository using Mercurial") |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
245 execute_process( |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
246 COMMAND ${ORTHANC_FRAMEWORK_HG} clone "https://hg.orthanc-server.com/orthanc/" |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
247 WORKING_DIRECTORY ${CMAKE_BINARY_DIR} |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
248 RESULT_VARIABLE Failure |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
249 ) |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
250 endif() |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
251 |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
252 if (Failure OR NOT EXISTS ${ORTHANC_ROOT}) |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
253 message(FATAL_ERROR "Cannot fork the Orthanc repository") |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
254 endif() |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
255 |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
256 message("Setting branch of the Orthanc repository to: ${ORTHANC_FRAMEWORK_BRANCH}") |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
257 |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
258 execute_process( |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
259 COMMAND ${ORTHANC_FRAMEWORK_HG} update -c ${ORTHANC_FRAMEWORK_BRANCH} |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
260 WORKING_DIRECTORY ${ORTHANC_ROOT} |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
261 RESULT_VARIABLE Failure |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
262 ) |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
263 |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
264 if (Failure) |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
265 message(FATAL_ERROR "Error while running Mercurial") |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
266 endif() |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
267 endif() |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
268 |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
269 |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
270 |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
271 ## |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
272 ## Case of the Orthanc framework provided as a source archive on the |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
273 ## filesystem |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
274 ## |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
275 |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
276 if (ORTHANC_FRAMEWORK_SOURCE STREQUAL "archive") |
46 | 277 if (NOT DEFINED ORTHANC_FRAMEWORK_ARCHIVE OR |
278 ORTHANC_FRAMEWORK_ARCHIVE STREQUAL "") | |
36
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
279 message(FATAL_ERROR "The variable ORTHANC_FRAMEWORK_ARCHIVE must provide the path to the sources of Orthanc") |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
280 endif() |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
281 endif() |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
282 |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
283 |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
284 |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
285 ## |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
286 ## Case of the Orthanc framework downloaded from the Web |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
287 ## |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
288 |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
289 if (ORTHANC_FRAMEWORK_SOURCE STREQUAL "web") |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
290 if (DEFINED ORTHANC_FRAMEWORK_URL) |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
291 string(REGEX REPLACE "^.*/" "" ORTHANC_FRAMEMORK_FILENAME "${ORTHANC_FRAMEWORK_URL}") |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
292 else() |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
293 # Default case: Download from the official Web site |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
294 set(ORTHANC_FRAMEMORK_FILENAME Orthanc-${ORTHANC_FRAMEWORK_VERSION}.tar.gz) |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
295 set(ORTHANC_FRAMEWORK_URL "http://orthanc.osimis.io/ThirdPartyDownloads/orthanc-framework/${ORTHANC_FRAMEMORK_FILENAME}") |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
296 endif() |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
297 |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
298 set(ORTHANC_FRAMEWORK_ARCHIVE "${CMAKE_SOURCE_DIR}/ThirdPartyDownloads/${ORTHANC_FRAMEMORK_FILENAME}") |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
299 |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
300 if (NOT EXISTS "${ORTHANC_FRAMEWORK_ARCHIVE}") |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
301 if (NOT STATIC_BUILD AND NOT ALLOW_DOWNLOADS) |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
302 message(FATAL_ERROR "CMake is not allowed to download from Internet. Please set the ALLOW_DOWNLOADS option to ON") |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
303 endif() |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
304 |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
305 message("Downloading: ${ORTHANC_FRAMEWORK_URL}") |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
306 |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
307 file(DOWNLOAD |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
308 "${ORTHANC_FRAMEWORK_URL}" "${ORTHANC_FRAMEWORK_ARCHIVE}" |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
309 SHOW_PROGRESS EXPECTED_MD5 "${ORTHANC_FRAMEWORK_MD5}" |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
310 TIMEOUT 60 |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
311 INACTIVITY_TIMEOUT 60 |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
312 ) |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
313 else() |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
314 message("Using local copy of: ${ORTHANC_FRAMEWORK_URL}") |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
315 endif() |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
316 endif() |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
317 |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
318 |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
319 |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
320 |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
321 ## |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
322 ## Uncompressing the Orthanc framework, if it was retrieved from a |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
323 ## source archive on the filesystem, or from the official Web site |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
324 ## |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
325 |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
326 if (ORTHANC_FRAMEWORK_SOURCE STREQUAL "archive" OR |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
327 ORTHANC_FRAMEWORK_SOURCE STREQUAL "web") |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
328 |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
329 if (NOT DEFINED ORTHANC_FRAMEWORK_ARCHIVE OR |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
330 NOT DEFINED ORTHANC_FRAMEWORK_VERSION OR |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
331 NOT DEFINED ORTHANC_FRAMEWORK_MD5) |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
332 message(FATAL_ERROR "Internal error") |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
333 endif() |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
334 |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
335 if (ORTHANC_FRAMEWORK_MD5 STREQUAL "") |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
336 message(FATAL_ERROR "Unknown release of Orthanc: ${ORTHANC_FRAMEWORK_VERSION}") |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
337 endif() |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
338 |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
339 file(MD5 ${ORTHANC_FRAMEWORK_ARCHIVE} ActualMD5) |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
340 |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
341 if (NOT "${ActualMD5}" STREQUAL "${ORTHANC_FRAMEWORK_MD5}") |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
342 message(FATAL_ERROR "The MD5 hash of the Orthanc archive is invalid: ${ORTHANC_FRAMEWORK_ARCHIVE}") |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
343 endif() |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
344 |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
345 set(ORTHANC_ROOT "${CMAKE_BINARY_DIR}/Orthanc-${ORTHANC_FRAMEWORK_VERSION}") |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
346 |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
347 if (NOT IS_DIRECTORY "${ORTHANC_ROOT}") |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
348 if (NOT ORTHANC_FRAMEWORK_ARCHIVE MATCHES ".tar.gz$") |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
349 message(FATAL_ERROR "Archive should have the \".tar.gz\" extension: ${ORTHANC_FRAMEWORK_ARCHIVE}") |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
350 endif() |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
351 |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
352 message("Uncompressing: ${ORTHANC_FRAMEWORK_ARCHIVE}") |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
353 |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
354 if ("${CMAKE_HOST_SYSTEM_NAME}" STREQUAL "Windows") |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
355 # How to silently extract files using 7-zip |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
356 # http://superuser.com/questions/331148/7zip-command-line-extract-silently-quietly |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
357 |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
358 execute_process( |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
359 COMMAND ${ORTHANC_FRAMEWORK_7ZIP} e -y ${ORTHANC_FRAMEWORK_ARCHIVE} |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
360 WORKING_DIRECTORY ${CMAKE_BINARY_DIR} |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
361 RESULT_VARIABLE Failure |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
362 OUTPUT_QUIET |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
363 ) |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
364 |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
365 if (Failure) |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
366 message(FATAL_ERROR "Error while running the uncompression tool") |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
367 endif() |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
368 |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
369 get_filename_component(TMP_FILENAME "${ORTHANC_FRAMEWORK_ARCHIVE}" NAME) |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
370 string(REGEX REPLACE ".gz$" "" TMP_FILENAME2 "${TMP_FILENAME}") |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
371 |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
372 execute_process( |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
373 COMMAND ${ORTHANC_FRAMEWORK_7ZIP} x -y ${TMP_FILENAME2} |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
374 WORKING_DIRECTORY ${CMAKE_BINARY_DIR} |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
375 RESULT_VARIABLE Failure |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
376 OUTPUT_QUIET |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
377 ) |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
378 |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
379 else() |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
380 execute_process( |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
381 COMMAND sh -c "${ORTHANC_FRAMEWORK_TAR} xfz ${ORTHANC_FRAMEWORK_ARCHIVE}" |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
382 WORKING_DIRECTORY ${CMAKE_BINARY_DIR} |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
383 RESULT_VARIABLE Failure |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
384 ) |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
385 endif() |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
386 |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
387 if (Failure) |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
388 message(FATAL_ERROR "Error while running the uncompression tool") |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
389 endif() |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
390 |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
391 if (NOT IS_DIRECTORY "${ORTHANC_ROOT}") |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
392 message(FATAL_ERROR "The Orthanc framework was not uncompressed at the proper location. Check the CMake instructions.") |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
393 endif() |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
394 endif() |
46 | 395 endif() |
396 | |
397 | |
398 | |
399 ## | |
400 ## Determine the path to the sources of the Orthanc framework | |
401 ## | |
402 | |
403 if (ORTHANC_FRAMEWORK_SOURCE STREQUAL "archive" OR | |
404 ORTHANC_FRAMEWORK_SOURCE STREQUAL "hg" OR | |
405 ORTHANC_FRAMEWORK_SOURCE STREQUAL "web") | |
406 if (NOT DEFINED ORTHANC_ROOT OR | |
407 NOT DEFINED ORTHANC_FRAMEWORK_MAJOR OR | |
408 NOT DEFINED ORTHANC_FRAMEWORK_MINOR OR | |
409 NOT DEFINED ORTHANC_FRAMEWORK_REVISION) | |
410 message(FATAL_ERROR "Internal error in the DownloadOrthancFramework.cmake file") | |
411 endif() | |
36
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
412 |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
413 unset(ORTHANC_FRAMEWORK_ROOT CACHE) |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
414 |
46 | 415 if ("${ORTHANC_FRAMEWORK_MAJOR}.${ORTHANC_FRAMEWORK_MINOR}.${ORTHANC_FRAMEWORK_REVISION}" VERSION_LESS "1.7.2") |
416 set(ORTHANC_FRAMEWORK_ROOT "${ORTHANC_ROOT}/Core" CACHE | |
417 STRING "Path to the Orthanc framework source directory") | |
418 set(ENABLE_PLUGINS_VERSION_SCRIPT OFF) | |
419 else() | |
420 set(ORTHANC_FRAMEWORK_ROOT "${ORTHANC_ROOT}/OrthancFramework/Sources" CACHE | |
421 STRING "Path to the Orthanc framework source directory") | |
36
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
422 endif() |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
423 |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
424 unset(ORTHANC_ROOT) |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
425 endif() |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
426 |
46 | 427 if (NOT ORTHANC_FRAMEWORK_SOURCE STREQUAL "system") |
428 if (NOT EXISTS ${ORTHANC_FRAMEWORK_ROOT}/OrthancException.h OR | |
429 NOT EXISTS ${ORTHANC_FRAMEWORK_ROOT}/../Resources/CMake/OrthancFrameworkParameters.cmake) | |
430 message(FATAL_ERROR "Directory not containing the source code of the Orthanc framework: ${ORTHANC_FRAMEWORK_ROOT}") | |
431 endif() | |
432 endif() | |
433 | |
36
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
434 |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
435 |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
436 ## |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
437 ## Case of the Orthanc framework installed as a shared library in a |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
438 ## GNU/Linux distribution (typically Debian). New in Orthanc 1.7.2. |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
439 ## |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
440 |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
441 if (ORTHANC_FRAMEWORK_SOURCE STREQUAL "system") |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
442 set(ORTHANC_FRAMEWORK_LIBDIR "" CACHE PATH "") |
69 | 443 set(ORTHANC_FRAMEWORK_USE_SHARED ON CACHE BOOL "Whether to use the shared library or the static library") |
444 set(ORTHANC_FRAMEWORK_ADDITIONAL_LIBRARIES "" CACHE STRING "Additional libraries to link against, separated by whitespaces, typically needed if using the static library (a common minimal value is \"boost_filesystem boost_iostreams boost_locale boost_regex boost_thread jsoncpp pugixml uuid\")") | |
36
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
445 |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
446 if (CMAKE_SYSTEM_NAME STREQUAL "Windows" AND |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
447 CMAKE_COMPILER_IS_GNUCXX) # MinGW |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
448 set(DYNAMIC_MINGW_STDLIB ON) # Disable static linking against libc (to throw exceptions) |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
449 set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -static-libstdc++") |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
450 set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-libstdc++") |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
451 endif() |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
452 |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
453 include(CheckIncludeFile) |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
454 include(CheckIncludeFileCXX) |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
455 include(FindPythonInterp) |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
456 include(${CMAKE_CURRENT_LIST_DIR}/Compiler.cmake) |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
457 include(${CMAKE_CURRENT_LIST_DIR}/DownloadPackage.cmake) |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
458 include(${CMAKE_CURRENT_LIST_DIR}/AutoGeneratedCode.cmake) |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
459 set(EMBED_RESOURCES_PYTHON ${CMAKE_CURRENT_LIST_DIR}/EmbedResources.py) |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
460 |
69 | 461 if (ORTHANC_FRAMEWORK_USE_SHARED) |
462 list(GET CMAKE_FIND_LIBRARY_PREFIXES 0 Prefix) | |
463 list(GET CMAKE_FIND_LIBRARY_SUFFIXES 0 Suffix) | |
36
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
464 else() |
69 | 465 list(GET CMAKE_FIND_LIBRARY_PREFIXES 0 Prefix) |
466 list(GET CMAKE_FIND_LIBRARY_SUFFIXES 1 Suffix) | |
467 endif() | |
468 | |
469 # The "OrthancFramework" library must be the first one to be included | |
470 if ("${ORTHANC_FRAMEWORK_LIBDIR}" STREQUAL "") | |
471 set(ORTHANC_FRAMEWORK_LIBRARIES ${Prefix}OrthancFramework${Suffix}) | |
472 else () | |
473 set(ORTHANC_FRAMEWORK_LIBRARIES ${ORTHANC_FRAMEWORK_LIBDIR}/${Prefix}OrthancFramework${Suffix}) | |
474 endif() | |
475 | |
476 if (NOT ORTHANC_FRAMEWORK_ADDITIONAL_LIBRARIES STREQUAL "") | |
477 # https://stackoverflow.com/a/5272993/881731 | |
478 string(REPLACE " " ";" tmp ${ORTHANC_FRAMEWORK_ADDITIONAL_LIBRARIES}) | |
479 list(APPEND ORTHANC_FRAMEWORK_LIBRARIES ${tmp}) | |
480 endif() | |
481 | |
482 # Look for the version of the mandatory dependency JsonCpp (cf. JsonCppConfiguration.cmake) | |
483 if (CMAKE_CROSSCOMPILING) | |
484 set(JSONCPP_INCLUDE_DIR ${ORTHANC_FRAMEWORK_ROOT}/..) | |
485 else() | |
36
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
486 find_path(JSONCPP_INCLUDE_DIR json/reader.h |
69 | 487 ${ORTHANC_FRAMEWORK_ROOT}/.. |
36
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
488 /usr/include/jsoncpp |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
489 /usr/local/include/jsoncpp |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
490 ) |
69 | 491 endif() |
36
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
492 |
69 | 493 message("JsonCpp include dir: ${JSONCPP_INCLUDE_DIR}") |
494 include_directories(${JSONCPP_INCLUDE_DIR}) | |
36
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
495 |
69 | 496 CHECK_INCLUDE_FILE_CXX(${JSONCPP_INCLUDE_DIR}/json/reader.h HAVE_JSONCPP_H) |
497 if (NOT HAVE_JSONCPP_H) | |
498 message(FATAL_ERROR "Please install the libjsoncpp-dev package") | |
499 endif() | |
46 | 500 |
69 | 501 # Switch to the C++11 standard if the version of JsonCpp is 1.y.z |
502 # (same as variable JSONCPP_CXX11 in the source code of Orthanc) | |
503 if (EXISTS ${JSONCPP_INCLUDE_DIR}/json/version.h) | |
504 file(STRINGS | |
505 "${JSONCPP_INCLUDE_DIR}/json/version.h" | |
506 JSONCPP_VERSION_MAJOR1 REGEX | |
507 ".*define JSONCPP_VERSION_MAJOR.*") | |
46 | 508 |
69 | 509 if (NOT JSONCPP_VERSION_MAJOR1) |
510 message(FATAL_ERROR "Unable to extract the major version of JsonCpp") | |
36
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
511 endif() |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
512 |
69 | 513 string(REGEX REPLACE |
514 ".*JSONCPP_VERSION_MAJOR.*([0-9]+)$" "\\1" | |
515 JSONCPP_VERSION_MAJOR ${JSONCPP_VERSION_MAJOR1}) | |
516 message("JsonCpp major version: ${JSONCPP_VERSION_MAJOR}") | |
36
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
517 |
69 | 518 if (JSONCPP_VERSION_MAJOR GREATER 0) |
519 message("Switching to C++11 standard, as version of JsonCpp is >= 1.0.0") | |
520 if (CMAKE_COMPILER_IS_GNUCXX) | |
521 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11") | |
522 elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") | |
523 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") | |
524 endif() | |
36
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
525 endif() |
69 | 526 else() |
527 message("Unable to detect the major version of JsonCpp, assuming < 1.0.0") | |
36
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
528 endif() |
69 | 529 |
36
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
530 # Look for Orthanc framework shared library |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
531 include(CheckCXXSymbolExists) |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
532 |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
533 if ("${CMAKE_SYSTEM_NAME}" STREQUAL "Windows") |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
534 set(ORTHANC_FRAMEWORK_INCLUDE_DIR ${ORTHANC_FRAMEWORK_ROOT}) |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
535 else() |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
536 find_path(ORTHANC_FRAMEWORK_INCLUDE_DIR OrthancFramework.h |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
537 /usr/include/orthanc-framework |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
538 /usr/local/include/orthanc-framework |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
539 ${ORTHANC_FRAMEWORK_ROOT} |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
540 ) |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
541 endif() |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
542 |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
543 if (${ORTHANC_FRAMEWORK_INCLUDE_DIR} STREQUAL "ORTHANC_FRAMEWORK_INCLUDE_DIR-NOTFOUND") |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
544 message(FATAL_ERROR "Cannot locate the OrthancFramework.h header") |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
545 endif() |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
546 |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
547 message("Orthanc framework include dir: ${ORTHANC_FRAMEWORK_INCLUDE_DIR}") |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
548 include_directories(${ORTHANC_FRAMEWORK_INCLUDE_DIR}) |
69 | 549 |
550 if (ORTHANC_FRAMEWORK_USE_SHARED) | |
551 set(CMAKE_REQUIRED_INCLUDES "${ORTHANC_FRAMEWORK_INCLUDE_DIR}") | |
552 set(CMAKE_REQUIRED_LIBRARIES "${ORTHANC_FRAMEWORK_LIBRARIES}") | |
553 | |
554 check_cxx_symbol_exists("Orthanc::InitializeFramework" "OrthancFramework.h" HAVE_ORTHANC_FRAMEWORK) | |
555 if (NOT HAVE_ORTHANC_FRAMEWORK) | |
556 message(FATAL_ERROR "Cannot find the Orthanc framework") | |
36
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
557 endif() |
69 | 558 |
559 unset(CMAKE_REQUIRED_INCLUDES) | |
560 unset(CMAKE_REQUIRED_LIBRARIES) | |
36
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
561 endif() |
fd58eb5749ed
CMake simplification using DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
562 endif() |