Mercurial > hg > orthanc
annotate Resources/DownloadOrthancFramework.cmake @ 3972:7f8b30416d50
minor clarification
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 22 May 2020 18:03:08 +0200 |
parents | 170667f08642 |
children | 7cd0fe733822 |
rev | line source |
---|---|
2531
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1 # Orthanc - A Lightweight, RESTful DICOM Store |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2 # Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3 # Department, University Hospital of Liege, Belgium |
3640
94f4a18a79cc
upgrade to year 2020
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3542
diff
changeset
|
4 # Copyright (C) 2017-2020 Osimis S.A., Belgium |
2531
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
5 # |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
6 # This program is free software: you can redistribute it and/or |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
7 # modify it under the terms of the GNU General Public License as |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
8 # published by the Free Software Foundation, either version 3 of the |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
9 # License, or (at your option) any later version. |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
10 # |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
11 # In addition, as a special exception, the copyright holders of this |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
12 # program give permission to link the code of its release with the |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
13 # OpenSSL project's "OpenSSL" library (or with modified versions of it |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
14 # that use the same license as the "OpenSSL" library), and distribute |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
15 # the linked executables. You must obey the GNU General Public License |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
16 # in all respects for all of the code used other than "OpenSSL". If you |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
17 # modify file(s) with this exception, you may extend this exception to |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
18 # your version of the file(s), but you are not obligated to do so. If |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
19 # you do not wish to do so, delete this exception statement from your |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
20 # version. If you delete this exception statement from all source files |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
21 # in the program, then also delete it here. |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
22 # |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
23 # This program is distributed in the hope that it will be useful, but |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
24 # WITHOUT ANY WARRANTY; without even the implied warranty of |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
25 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
26 # General Public License for more details. |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
27 # |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
28 # You should have received a copy of the GNU General Public License |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
29 # along with this program. If not, see <http://www.gnu.org/licenses/>. |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
30 |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
31 |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
32 |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
33 ## |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
34 ## Check whether the parent script sets the mandatory variables |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
35 ## |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
36 |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
37 if (NOT DEFINED ORTHANC_FRAMEWORK_SOURCE OR |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
38 (NOT ORTHANC_FRAMEWORK_SOURCE STREQUAL "hg" AND |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
39 NOT ORTHANC_FRAMEWORK_SOURCE STREQUAL "web" AND |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
40 NOT ORTHANC_FRAMEWORK_SOURCE STREQUAL "archive" AND |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
41 NOT ORTHANC_FRAMEWORK_SOURCE STREQUAL "path")) |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
42 message(FATAL_ERROR "The variable ORTHANC_FRAMEWORK_SOURCE must be set to \"hg\", \"web\", \"archive\" or \"path\"") |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
43 endif() |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
44 |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
45 |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
46 ## |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
47 ## Detection of the requested version |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
48 ## |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
49 |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
50 if (ORTHANC_FRAMEWORK_SOURCE STREQUAL "hg" OR |
2533 | 51 ORTHANC_FRAMEWORK_SOURCE STREQUAL "archive" OR |
2531
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
52 ORTHANC_FRAMEWORK_SOURCE STREQUAL "web") |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
53 if (NOT DEFINED ORTHANC_FRAMEWORK_VERSION) |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
54 message(FATAL_ERROR "The variable ORTHANC_FRAMEWORK_VERSION must be set") |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
55 endif() |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
56 |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
57 if (DEFINED ORTHANC_FRAMEWORK_MAJOR OR |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
58 DEFINED ORTHANC_FRAMEWORK_MINOR OR |
2533 | 59 DEFINED ORTHANC_FRAMEWORK_REVISION OR |
60 DEFINED ORTHANC_FRAMEWORK_MD5) | |
2531
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
61 message(FATAL_ERROR "Some internal variable has been set") |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
62 endif() |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
63 |
2533 | 64 set(ORTHANC_FRAMEWORK_MD5 "") |
65 | |
2688 | 66 if (NOT DEFINED ORTHANC_FRAMEWORK_BRANCH) |
67 if (ORTHANC_FRAMEWORK_VERSION STREQUAL "mainline") | |
68 set(ORTHANC_FRAMEWORK_BRANCH "default") | |
3407
b7728227a852
C++ wrappers: compatibility mode if missing OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3318
diff
changeset
|
69 set(ORTHANC_FRAMEWORK_MAJOR 999) |
b7728227a852
C++ wrappers: compatibility mode if missing OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3318
diff
changeset
|
70 set(ORTHANC_FRAMEWORK_MINOR 999) |
b7728227a852
C++ wrappers: compatibility mode if missing OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3318
diff
changeset
|
71 set(ORTHANC_FRAMEWORK_REVISION 999) |
2531
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
72 |
2688 | 73 else() |
74 set(ORTHANC_FRAMEWORK_BRANCH "Orthanc-${ORTHANC_FRAMEWORK_VERSION}") | |
2531
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
75 |
2688 | 76 set(RE "^([0-9]+)\\.([0-9]+)\\.([0-9]+)$") |
77 string(REGEX REPLACE ${RE} "\\1" ORTHANC_FRAMEWORK_MAJOR ${ORTHANC_FRAMEWORK_VERSION}) | |
78 string(REGEX REPLACE ${RE} "\\2" ORTHANC_FRAMEWORK_MINOR ${ORTHANC_FRAMEWORK_VERSION}) | |
79 string(REGEX REPLACE ${RE} "\\3" ORTHANC_FRAMEWORK_REVISION ${ORTHANC_FRAMEWORK_VERSION}) | |
2531
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
80 |
2688 | 81 if (NOT ORTHANC_FRAMEWORK_MAJOR MATCHES "^[0-9]+$" OR |
82 NOT ORTHANC_FRAMEWORK_MINOR MATCHES "^[0-9]+$" OR | |
83 NOT ORTHANC_FRAMEWORK_REVISION MATCHES "^[0-9]+$") | |
84 message("Bad version of the Orthanc framework: ${ORTHANC_FRAMEWORK_VERSION}") | |
85 endif() | |
2533 | 86 |
2688 | 87 if (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.3.1") |
88 set(ORTHANC_FRAMEWORK_MD5 "dac95bd6cf86fb19deaf4e612961f378") | |
89 elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.3.2") | |
90 set(ORTHANC_FRAMEWORK_MD5 "d0ccdf68e855d8224331f13774992750") | |
2740 | 91 elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.4.0") |
92 set(ORTHANC_FRAMEWORK_MD5 "81e15f34d97ac32bbd7d26e85698835a") | |
2915
9abcfd97a76b
Orthanc framework 1.4.1
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2838
diff
changeset
|
93 elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.4.1") |
9abcfd97a76b
Orthanc framework 1.4.1
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2838
diff
changeset
|
94 set(ORTHANC_FRAMEWORK_MD5 "9b6f6114264b17ed421b574cd6476127") |
2838
f3a2d109e361
new orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2740
diff
changeset
|
95 elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.4.2") |
f3a2d109e361
new orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2740
diff
changeset
|
96 set(ORTHANC_FRAMEWORK_MD5 "d1ee84927dcf668e60eb5868d24b9394") |
2993 | 97 elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.5.0") |
98 set(ORTHANC_FRAMEWORK_MD5 "4429d8d9dea4ff6648df80ec3c64d79e") | |
3044 | 99 elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.5.1") |
100 set(ORTHANC_FRAMEWORK_MD5 "099671538865e5da96208b37494d6718") | |
3152 | 101 elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.5.2") |
102 set(ORTHANC_FRAMEWORK_MD5 "8867050f3e9a1ce6157c1ea7a9433b1b") | |
3170 | 103 elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.5.3") |
104 set(ORTHANC_FRAMEWORK_MD5 "bf2f5ed1adb8b0fc5f10d278e68e1dfe") | |
3213 | 105 elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.5.4") |
106 set(ORTHANC_FRAMEWORK_MD5 "404baef5d4c43e7c5d9410edda8ef5a5") | |
3307 | 107 elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.5.5") |
108 set(ORTHANC_FRAMEWORK_MD5 "cfc437e0687ae4bd725fd93dc1f08bc4") | |
3318 | 109 elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.5.6") |
110 set(ORTHANC_FRAMEWORK_MD5 "3c29de1e289b5472342947168f0105c0") | |
3450 | 111 elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.5.7") |
112 set(ORTHANC_FRAMEWORK_MD5 "e1b76f01116d9b5d4ac8cc39980560e3") | |
3542 | 113 elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.5.8") |
114 set(ORTHANC_FRAMEWORK_MD5 "82323e8c49a667f658a3639ea4dbc336") | |
3780 | 115 elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.6.0") |
116 set(ORTHANC_FRAMEWORK_MD5 "eab428d6e53f61e847fa360bb17ebe25") | |
3856 | 117 elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.6.1") |
118 set(ORTHANC_FRAMEWORK_MD5 "3971f5de96ba71dc9d3f3690afeaa7c0") | |
3969 | 119 elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.7.0") |
120 set(ORTHANC_FRAMEWORK_MD5 "ce5f689e852b01d3672bd3d2f952a5ef") | |
3717
914f783ef085
development snapshot of the Orthanc framework for DICOMweb 1.1
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
121 |
914f783ef085
development snapshot of the Orthanc framework for DICOMweb 1.1
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
122 # Below this point are development snapshots that were used to |
914f783ef085
development snapshot of the Orthanc framework for DICOMweb 1.1
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
123 # release some plugin, before an official release of the Orthanc |
914f783ef085
development snapshot of the Orthanc framework for DICOMweb 1.1
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
124 # framework was available. Here is the command to be used to |
914f783ef085
development snapshot of the Orthanc framework for DICOMweb 1.1
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
125 # generate a proper archive: |
914f783ef085
development snapshot of the Orthanc framework for DICOMweb 1.1
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
126 # |
914f783ef085
development snapshot of the Orthanc framework for DICOMweb 1.1
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
127 # $ hg archive /tmp/Orthanc-`hg id -i | sed 's/\+//'`.tar.gz |
914f783ef085
development snapshot of the Orthanc framework for DICOMweb 1.1
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
128 # |
914f783ef085
development snapshot of the Orthanc framework for DICOMweb 1.1
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
129 elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "ae0e3fd609df") |
914f783ef085
development snapshot of the Orthanc framework for DICOMweb 1.1
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
130 # DICOMweb 1.1 (framework pre-1.6.0) |
914f783ef085
development snapshot of the Orthanc framework for DICOMweb 1.1
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
131 set(ORTHANC_FRAMEWORK_MD5 "7e09e9b530a2f527854f0b782d7e0645") |
2688 | 132 endif() |
2533 | 133 endif() |
2531
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
134 endif() |
3407
b7728227a852
C++ wrappers: compatibility mode if missing OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3318
diff
changeset
|
135 else() |
b7728227a852
C++ wrappers: compatibility mode if missing OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3318
diff
changeset
|
136 message("Using the Orthanc framework from a path of the filesystem. Assuming mainline version.") |
b7728227a852
C++ wrappers: compatibility mode if missing OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3318
diff
changeset
|
137 set(ORTHANC_FRAMEWORK_MAJOR 999) |
b7728227a852
C++ wrappers: compatibility mode if missing OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3318
diff
changeset
|
138 set(ORTHANC_FRAMEWORK_MINOR 999) |
b7728227a852
C++ wrappers: compatibility mode if missing OrthancPluginRegisterMultipartRestCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3318
diff
changeset
|
139 set(ORTHANC_FRAMEWORK_REVISION 999) |
2531
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
140 endif() |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
141 |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
142 |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
143 |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
144 ## |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
145 ## Detection of the third-party software |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
146 ## |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
147 |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
148 if (ORTHANC_FRAMEWORK_SOURCE STREQUAL "hg") |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
149 find_program(ORTHANC_FRAMEWORK_HG hg) |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
150 |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
151 if (${ORTHANC_FRAMEWORK_HG} MATCHES "ORTHANC_FRAMEWORK_HG-NOTFOUND") |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
152 message(FATAL_ERROR "Please install Mercurial") |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
153 endif() |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
154 endif() |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
155 |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
156 |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
157 if (ORTHANC_FRAMEWORK_SOURCE STREQUAL "archive" OR |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
158 ORTHANC_FRAMEWORK_SOURCE STREQUAL "web") |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
159 if ("${CMAKE_HOST_SYSTEM_NAME}" STREQUAL "Windows") |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
160 find_program(ORTHANC_FRAMEWORK_7ZIP 7z |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
161 PATHS |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
162 "$ENV{ProgramFiles}/7-Zip" |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
163 "$ENV{ProgramW6432}/7-Zip" |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
164 ) |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
165 |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
166 if (${ORTHANC_FRAMEWORK_7ZIP} MATCHES "ORTHANC_FRAMEWORK_7ZIP-NOTFOUND") |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
167 message(FATAL_ERROR "Please install the '7-zip' software (http://www.7-zip.org/)") |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
168 endif() |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
169 |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
170 else() |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
171 find_program(ORTHANC_FRAMEWORK_TAR tar) |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
172 if (${ORTHANC_FRAMEWORK_TAR} MATCHES "ORTHANC_FRAMEWORK_TAR-NOTFOUND") |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
173 message(FATAL_ERROR "Please install the 'tar' package") |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
174 endif() |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
175 endif() |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
176 endif() |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
177 |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
178 |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
179 |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
180 ## |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
181 ## Case of the Orthanc framework specified as a path on the filesystem |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
182 ## |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
183 |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
184 if (ORTHANC_FRAMEWORK_SOURCE STREQUAL "path") |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
185 if (NOT DEFINED ORTHANC_FRAMEWORK_ROOT) |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
186 message(FATAL_ERROR "The variable ORTHANC_FRAMEWORK_ROOT must provide the path to the sources of Orthanc") |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
187 endif() |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
188 |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
189 if (NOT EXISTS ${ORTHANC_FRAMEWORK_ROOT}) |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
190 message(FATAL_ERROR "Non-existing directory: ${ORTHANC_FRAMEWORK_ROOT}") |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
191 endif() |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
192 |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
193 if (NOT EXISTS ${ORTHANC_FRAMEWORK_ROOT}/Resources/CMake/OrthancFrameworkParameters.cmake) |
2533 | 194 message(FATAL_ERROR "Directory not containing the source code of Orthanc: ${ORTHANC_FRAMEWORK_ROOT}") |
2531
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
195 endif() |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
196 |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
197 set(ORTHANC_ROOT ${ORTHANC_FRAMEWORK_ROOT}) |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
198 endif() |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
199 |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
200 |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
201 |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
202 ## |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
203 ## Case of the Orthanc framework cloned using Mercurial |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
204 ## |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
205 |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
206 if (ORTHANC_FRAMEWORK_SOURCE STREQUAL "hg") |
2534 | 207 if (NOT STATIC_BUILD AND NOT ALLOW_DOWNLOADS) |
208 message(FATAL_ERROR "CMake is not allowed to download from Internet. Please set the ALLOW_DOWNLOADS option to ON") | |
209 endif() | |
210 | |
2531
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
211 set(ORTHANC_ROOT ${CMAKE_BINARY_DIR}/orthanc) |
2534 | 212 |
2537 | 213 if (EXISTS ${ORTHANC_ROOT}) |
214 message("Updating the Orthanc source repository using Mercurial") | |
215 execute_process( | |
216 COMMAND ${ORTHANC_FRAMEWORK_HG} pull | |
217 WORKING_DIRECTORY ${ORTHANC_ROOT} | |
218 RESULT_VARIABLE Failure | |
219 ) | |
220 else() | |
2531
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
221 message("Forking the Orthanc source repository using Mercurial") |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
222 execute_process( |
3853 | 223 COMMAND ${ORTHANC_FRAMEWORK_HG} clone "https://hg.orthanc-server.com/orthanc/" |
2531
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
224 WORKING_DIRECTORY ${CMAKE_BINARY_DIR} |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
225 RESULT_VARIABLE Failure |
2537 | 226 ) |
227 endif() | |
228 | |
229 if (Failure OR NOT EXISTS ${ORTHANC_ROOT}) | |
230 message(FATAL_ERROR "Cannot fork the Orthanc repository") | |
2531
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
231 endif() |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
232 |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
233 message("Setting branch of the Orthanc repository to: ${ORTHANC_FRAMEWORK_BRANCH}") |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
234 |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
235 execute_process( |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
236 COMMAND ${ORTHANC_FRAMEWORK_HG} update -c ${ORTHANC_FRAMEWORK_BRANCH} |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
237 WORKING_DIRECTORY ${ORTHANC_ROOT} |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
238 RESULT_VARIABLE Failure |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
239 ) |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
240 |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
241 if (Failure) |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
242 message(FATAL_ERROR "Error while running Mercurial") |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
243 endif() |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
244 endif() |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
245 |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
246 |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
247 |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
248 ## |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
249 ## Case of the Orthanc framework provided as a source archive on the |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
250 ## filesystem |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
251 ## |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
252 |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
253 if (ORTHANC_FRAMEWORK_SOURCE STREQUAL "archive") |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
254 if (NOT DEFINED ORTHANC_FRAMEWORK_ARCHIVE) |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
255 message(FATAL_ERROR "The variable ORTHANC_FRAMEWORK_ARCHIVE must provide the path to the sources of Orthanc") |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
256 endif() |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
257 endif() |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
258 |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
259 |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
260 |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
261 ## |
2547
8b6b0b6ece6b
MinGW, ORTHANC_FRAMEWORK_URL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2537
diff
changeset
|
262 ## Case of the Orthanc framework downloaded from the Web |
2531
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
263 ## |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
264 |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
265 if (ORTHANC_FRAMEWORK_SOURCE STREQUAL "web") |
2547
8b6b0b6ece6b
MinGW, ORTHANC_FRAMEWORK_URL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2537
diff
changeset
|
266 if (DEFINED ORTHANC_FRAMEWORK_URL) |
8b6b0b6ece6b
MinGW, ORTHANC_FRAMEWORK_URL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2537
diff
changeset
|
267 string(REGEX REPLACE "^.*/" "" ORTHANC_FRAMEMORK_FILENAME "${ORTHANC_FRAMEWORK_URL}") |
8b6b0b6ece6b
MinGW, ORTHANC_FRAMEWORK_URL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2537
diff
changeset
|
268 else() |
8b6b0b6ece6b
MinGW, ORTHANC_FRAMEWORK_URL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2537
diff
changeset
|
269 # Default case: Download from the official Web site |
8b6b0b6ece6b
MinGW, ORTHANC_FRAMEWORK_URL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2537
diff
changeset
|
270 set(ORTHANC_FRAMEMORK_FILENAME Orthanc-${ORTHANC_FRAMEWORK_VERSION}.tar.gz) |
3135 | 271 set(ORTHANC_FRAMEWORK_URL "http://orthanc.osimis.io/ThirdPartyDownloads/orthanc-framework/${ORTHANC_FRAMEMORK_FILENAME}") |
2547
8b6b0b6ece6b
MinGW, ORTHANC_FRAMEWORK_URL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2537
diff
changeset
|
272 endif() |
2531
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
273 |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
274 set(ORTHANC_FRAMEWORK_ARCHIVE "${CMAKE_SOURCE_DIR}/ThirdPartyDownloads/${ORTHANC_FRAMEMORK_FILENAME}") |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
275 |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
276 if (NOT EXISTS "${ORTHANC_FRAMEWORK_ARCHIVE}") |
2534 | 277 if (NOT STATIC_BUILD AND NOT ALLOW_DOWNLOADS) |
278 message(FATAL_ERROR "CMake is not allowed to download from Internet. Please set the ALLOW_DOWNLOADS option to ON") | |
279 endif() | |
280 | |
2547
8b6b0b6ece6b
MinGW, ORTHANC_FRAMEWORK_URL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2537
diff
changeset
|
281 message("Downloading: ${ORTHANC_FRAMEWORK_URL}") |
2531
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
282 |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
283 file(DOWNLOAD |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
284 "${ORTHANC_FRAMEWORK_URL}" "${ORTHANC_FRAMEWORK_ARCHIVE}" |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
285 SHOW_PROGRESS EXPECTED_MD5 "${ORTHANC_FRAMEWORK_MD5}" |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
286 TIMEOUT 60 |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
287 INACTIVITY_TIMEOUT 60 |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
288 ) |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
289 else() |
2533 | 290 message("Using local copy of: ${ORTHANC_FRAMEWORK_URL}") |
2531
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
291 endif() |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
292 endif() |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
293 |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
294 |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
295 |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
296 |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
297 ## |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
298 ## Uncompressing the Orthanc framework, if it was retrieved from a |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
299 ## source archive on the filesystem, or from the official Web site |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
300 ## |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
301 |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
302 if (ORTHANC_FRAMEWORK_SOURCE STREQUAL "archive" OR |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
303 ORTHANC_FRAMEWORK_SOURCE STREQUAL "web") |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
304 |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
305 if (NOT DEFINED ORTHANC_FRAMEWORK_ARCHIVE OR |
2533 | 306 NOT DEFINED ORTHANC_FRAMEWORK_VERSION OR |
307 NOT DEFINED ORTHANC_FRAMEWORK_MD5) | |
2531
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
308 message(FATAL_ERROR "Internal error") |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
309 endif() |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
310 |
2533 | 311 if (ORTHANC_FRAMEWORK_MD5 STREQUAL "") |
312 message(FATAL_ERROR "Unknown release of Orthanc: ${ORTHANC_FRAMEWORK_VERSION}") | |
313 endif() | |
314 | |
315 file(MD5 ${ORTHANC_FRAMEWORK_ARCHIVE} ActualMD5) | |
316 | |
317 if (NOT "${ActualMD5}" STREQUAL "${ORTHANC_FRAMEWORK_MD5}") | |
318 message(FATAL_ERROR "The MD5 hash of the Orthanc archive is invalid: ${ORTHANC_FRAMEWORK_ARCHIVE}") | |
319 endif() | |
320 | |
2531
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
321 set(ORTHANC_ROOT "${CMAKE_BINARY_DIR}/Orthanc-${ORTHANC_FRAMEWORK_VERSION}") |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
322 |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
323 if (NOT IS_DIRECTORY "${ORTHANC_ROOT}") |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
324 if (NOT ORTHANC_FRAMEWORK_ARCHIVE MATCHES ".tar.gz$") |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
325 message(FATAL_ERROR "Archive should have the \".tar.gz\" extension: ${ORTHANC_FRAMEWORK_ARCHIVE}") |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
326 endif() |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
327 |
2533 | 328 message("Uncompressing: ${ORTHANC_FRAMEWORK_ARCHIVE}") |
2531
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
329 |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
330 if ("${CMAKE_HOST_SYSTEM_NAME}" STREQUAL "Windows") |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
331 # How to silently extract files using 7-zip |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
332 # http://superuser.com/questions/331148/7zip-command-line-extract-silently-quietly |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
333 |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
334 execute_process( |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
335 COMMAND ${ORTHANC_FRAMEWORK_7ZIP} e -y ${ORTHANC_FRAMEWORK_ARCHIVE} |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
336 WORKING_DIRECTORY ${CMAKE_BINARY_DIR} |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
337 RESULT_VARIABLE Failure |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
338 OUTPUT_QUIET |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
339 ) |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
340 |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
341 if (Failure) |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
342 message(FATAL_ERROR "Error while running the uncompression tool") |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
343 endif() |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
344 |
2553 | 345 get_filename_component(TMP_FILENAME "${ORTHANC_FRAMEWORK_ARCHIVE}" NAME) |
346 string(REGEX REPLACE ".gz$" "" TMP_FILENAME2 "${TMP_FILENAME}") | |
2531
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
347 |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
348 execute_process( |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
349 COMMAND ${ORTHANC_FRAMEWORK_7ZIP} x -y ${TMP_FILENAME2} |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
350 WORKING_DIRECTORY ${CMAKE_BINARY_DIR} |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
351 RESULT_VARIABLE Failure |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
352 OUTPUT_QUIET |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
353 ) |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
354 |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
355 else() |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
356 execute_process( |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
357 COMMAND sh -c "${ORTHANC_FRAMEWORK_TAR} xfz ${ORTHANC_FRAMEWORK_ARCHIVE}" |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
358 WORKING_DIRECTORY ${CMAKE_BINARY_DIR} |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
359 RESULT_VARIABLE Failure |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
360 ) |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
361 endif() |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
362 |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
363 if (Failure) |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
364 message(FATAL_ERROR "Error while running the uncompression tool") |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
365 endif() |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
366 |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
367 if (NOT IS_DIRECTORY "${ORTHANC_ROOT}") |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
368 message(FATAL_ERROR "The Orthanc framework was not uncompressed at the proper location. Check the CMake instructions.") |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
369 endif() |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
370 endif() |
b7ed112ce56e
DownloadOrthancFramework.cmake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
371 endif() |