annotate OrthancStone/Resources/Orthanc/CMake/DownloadOrthancFramework.cmake @ 1730:af4a2d08549c

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