Mercurial > hg > orthanc
annotate OrthancFramework/Resources/CMake/JsonCppConfiguration.cmake @ 4836:ec1e9571b645
document number of dimensions in numpy arrays
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Sat, 27 Nov 2021 12:31:51 +0100 |
parents | 7053502fbf97 |
children | 044573b90881 |
rev | line source |
---|---|
4120
304842a0d152
adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
1 # Orthanc - A Lightweight, RESTful DICOM Store |
304842a0d152
adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
2 # Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics |
304842a0d152
adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
3 # Department, University Hospital of Liege, Belgium |
4437
d9473bd5ed43
upgrade to year 2021
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4391
diff
changeset
|
4 # Copyright (C) 2017-2021 Osimis S.A., Belgium |
4831
7053502fbf97
added copyright UCLouvain
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
5 # Copyright (C) 2021-2021 Sebastien Jodogne, ICTEAM UCLouvain, Belgium |
4120
304842a0d152
adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
6 # |
304842a0d152
adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
7 # This program is free software: you can redistribute it and/or |
304842a0d152
adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
8 # modify it under the terms of the GNU Lesser General Public License |
304842a0d152
adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
9 # as published by the Free Software Foundation, either version 3 of |
304842a0d152
adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
10 # the License, or (at your option) any later version. |
304842a0d152
adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
11 # |
304842a0d152
adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
12 # This program is distributed in the hope that it will be useful, but |
304842a0d152
adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
13 # WITHOUT ANY WARRANTY; without even the implied warranty of |
304842a0d152
adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
304842a0d152
adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
15 # Lesser General Public License for more details. |
304842a0d152
adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
16 # |
304842a0d152
adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
17 # You should have received a copy of the GNU Lesser General Public |
304842a0d152
adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
18 # License along with this program. If not, see |
304842a0d152
adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
19 # <http://www.gnu.org/licenses/>. |
304842a0d152
adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
20 |
304842a0d152
adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
21 |
2497
0611aa383e62
Upgrade to JsonCpp 1.8.4, and USE_LEGACY_JSONCPP option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2429
diff
changeset
|
22 set(JSONCPP_CXX11 OFF) |
0611aa383e62
Upgrade to JsonCpp 1.8.4, and USE_LEGACY_JSONCPP option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2429
diff
changeset
|
23 |
735 | 24 if (STATIC_BUILD OR NOT USE_SYSTEM_JSONCPP) |
2497
0611aa383e62
Upgrade to JsonCpp 1.8.4, and USE_LEGACY_JSONCPP option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2429
diff
changeset
|
25 if (USE_LEGACY_JSONCPP) |
3721
c575fb0adf91
upgraded jsoncpp to 0.10.7 for pre-C++11 compilers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3575
diff
changeset
|
26 set(JSONCPP_SOURCES_DIR ${CMAKE_BINARY_DIR}/jsoncpp-0.10.7) |
c575fb0adf91
upgraded jsoncpp to 0.10.7 for pre-C++11 compilers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3575
diff
changeset
|
27 set(JSONCPP_URL "http://orthanc.osimis.io/ThirdPartyDownloads/jsoncpp-0.10.7.tar.gz") |
c575fb0adf91
upgraded jsoncpp to 0.10.7 for pre-C++11 compilers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3575
diff
changeset
|
28 set(JSONCPP_MD5 "3a8072ca6a1fa9cbaf7715ae625f134f") |
2497
0611aa383e62
Upgrade to JsonCpp 1.8.4, and USE_LEGACY_JSONCPP option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2429
diff
changeset
|
29 add_definitions(-DORTHANC_LEGACY_JSONCPP=1) |
0611aa383e62
Upgrade to JsonCpp 1.8.4, and USE_LEGACY_JSONCPP option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2429
diff
changeset
|
30 else() |
4391
0c4ff5609548
upgraded to jsoncpp 1.9.4
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4390
diff
changeset
|
31 set(JSONCPP_SOURCES_DIR ${CMAKE_BINARY_DIR}/jsoncpp-1.9.4) |
0c4ff5609548
upgraded to jsoncpp 1.9.4
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4390
diff
changeset
|
32 set(JSONCPP_URL "http://orthanc.osimis.io/ThirdPartyDownloads/jsoncpp-1.9.4.tar.gz") |
0c4ff5609548
upgraded to jsoncpp 1.9.4
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4390
diff
changeset
|
33 set(JSONCPP_MD5 "4757b26ec89798c5247fa638edfdc446") |
2497
0611aa383e62
Upgrade to JsonCpp 1.8.4, and USE_LEGACY_JSONCPP option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2429
diff
changeset
|
34 add_definitions(-DORTHANC_LEGACY_JSONCPP=0) |
0611aa383e62
Upgrade to JsonCpp 1.8.4, and USE_LEGACY_JSONCPP option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2429
diff
changeset
|
35 set(JSONCPP_CXX11 ON) |
0611aa383e62
Upgrade to JsonCpp 1.8.4, and USE_LEGACY_JSONCPP option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2429
diff
changeset
|
36 endif() |
1537
fbf763bb1fa3
error detection in patches
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1502
diff
changeset
|
37 |
fbf763bb1fa3
error detection in patches
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1502
diff
changeset
|
38 DownloadPackage(${JSONCPP_MD5} ${JSONCPP_URL} "${JSONCPP_SOURCES_DIR}") |
735 | 39 |
1414 | 40 set(JSONCPP_SOURCES |
735 | 41 ${JSONCPP_SOURCES_DIR}/src/lib_json/json_reader.cpp |
42 ${JSONCPP_SOURCES_DIR}/src/lib_json/json_value.cpp | |
43 ${JSONCPP_SOURCES_DIR}/src/lib_json/json_writer.cpp | |
44 ) | |
45 | |
46 include_directories( | |
47 ${JSONCPP_SOURCES_DIR}/include | |
48 ) | |
49 | |
2782
64e3d4ab158d
find sandboxed builds
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2497
diff
changeset
|
50 if (NOT ENABLE_LOCALE) |
64e3d4ab158d
find sandboxed builds
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2497
diff
changeset
|
51 add_definitions(-DJSONCPP_NO_LOCALE_SUPPORT=1) |
64e3d4ab158d
find sandboxed builds
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2497
diff
changeset
|
52 endif() |
64e3d4ab158d
find sandboxed builds
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2497
diff
changeset
|
53 |
735 | 54 source_group(ThirdParty\\JsonCpp REGULAR_EXPRESSION ${JSONCPP_SOURCES_DIR}/.*) |
55 | |
56 else() | |
1344 | 57 find_path(JSONCPP_INCLUDE_DIR json/reader.h |
58 /usr/include/jsoncpp | |
59 /usr/local/include/jsoncpp | |
60 ) | |
61 | |
62 message("JsonCpp include dir: ${JSONCPP_INCLUDE_DIR}") | |
63 include_directories(${JSONCPP_INCLUDE_DIR}) | |
735 | 64 link_libraries(jsoncpp) |
65 | |
1405 | 66 CHECK_INCLUDE_FILE_CXX(${JSONCPP_INCLUDE_DIR}/json/reader.h HAVE_JSONCPP_H) |
67 if (NOT HAVE_JSONCPP_H) | |
68 message(FATAL_ERROR "Please install the libjsoncpp-dev package") | |
69 endif() | |
70 | |
1947
c1053112b323
Switch to the C++11 standard if the version of JsonCpp is 1.y.z
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1537
diff
changeset
|
71 # Switch to the C++11 standard if the version of JsonCpp is 1.y.z |
c1053112b323
Switch to the C++11 standard if the version of JsonCpp is 1.y.z
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1537
diff
changeset
|
72 if (EXISTS ${JSONCPP_INCLUDE_DIR}/json/version.h) |
c1053112b323
Switch to the C++11 standard if the version of JsonCpp is 1.y.z
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1537
diff
changeset
|
73 file(STRINGS |
c1053112b323
Switch to the C++11 standard if the version of JsonCpp is 1.y.z
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1537
diff
changeset
|
74 "${JSONCPP_INCLUDE_DIR}/json/version.h" |
c1053112b323
Switch to the C++11 standard if the version of JsonCpp is 1.y.z
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1537
diff
changeset
|
75 JSONCPP_VERSION_MAJOR1 REGEX |
1948 | 76 ".*define JSONCPP_VERSION_MAJOR.*") |
77 | |
78 if (NOT JSONCPP_VERSION_MAJOR1) | |
79 message(FATAL_ERROR "Unable to extract the major version of JsonCpp") | |
80 endif() | |
81 | |
1947
c1053112b323
Switch to the C++11 standard if the version of JsonCpp is 1.y.z
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1537
diff
changeset
|
82 string(REGEX REPLACE |
1948 | 83 ".*JSONCPP_VERSION_MAJOR.*([0-9]+)$" "\\1" |
1947
c1053112b323
Switch to the C++11 standard if the version of JsonCpp is 1.y.z
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1537
diff
changeset
|
84 JSONCPP_VERSION_MAJOR ${JSONCPP_VERSION_MAJOR1}) |
c1053112b323
Switch to the C++11 standard if the version of JsonCpp is 1.y.z
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1537
diff
changeset
|
85 message("JsonCpp major version: ${JSONCPP_VERSION_MAJOR}") |
c1053112b323
Switch to the C++11 standard if the version of JsonCpp is 1.y.z
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1537
diff
changeset
|
86 |
2497
0611aa383e62
Upgrade to JsonCpp 1.8.4, and USE_LEGACY_JSONCPP option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2429
diff
changeset
|
87 if (JSONCPP_VERSION_MAJOR GREATER 0) |
0611aa383e62
Upgrade to JsonCpp 1.8.4, and USE_LEGACY_JSONCPP option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2429
diff
changeset
|
88 set(JSONCPP_CXX11 ON) |
1947
c1053112b323
Switch to the C++11 standard if the version of JsonCpp is 1.y.z
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1537
diff
changeset
|
89 endif() |
c1053112b323
Switch to the C++11 standard if the version of JsonCpp is 1.y.z
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1537
diff
changeset
|
90 else() |
c1053112b323
Switch to the C++11 standard if the version of JsonCpp is 1.y.z
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1537
diff
changeset
|
91 message("Unable to detect the major version of JsonCpp, assuming < 1.0.0") |
c1053112b323
Switch to the C++11 standard if the version of JsonCpp is 1.y.z
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1537
diff
changeset
|
92 endif() |
2497
0611aa383e62
Upgrade to JsonCpp 1.8.4, and USE_LEGACY_JSONCPP option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2429
diff
changeset
|
93 endif() |
1947
c1053112b323
Switch to the C++11 standard if the version of JsonCpp is 1.y.z
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1537
diff
changeset
|
94 |
2497
0611aa383e62
Upgrade to JsonCpp 1.8.4, and USE_LEGACY_JSONCPP option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2429
diff
changeset
|
95 |
0611aa383e62
Upgrade to JsonCpp 1.8.4, and USE_LEGACY_JSONCPP option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2429
diff
changeset
|
96 if (JSONCPP_CXX11) |
0611aa383e62
Upgrade to JsonCpp 1.8.4, and USE_LEGACY_JSONCPP option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2429
diff
changeset
|
97 # Osimis has encountered problems when this macro is left at its |
0611aa383e62
Upgrade to JsonCpp 1.8.4, and USE_LEGACY_JSONCPP option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2429
diff
changeset
|
98 # default value (1000), so we increase this limit |
0611aa383e62
Upgrade to JsonCpp 1.8.4, and USE_LEGACY_JSONCPP option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2429
diff
changeset
|
99 # https://gitlab.kitware.com/third-party/jsoncpp/commit/56df2068470241f9043b676bfae415ed62a0c172 |
0611aa383e62
Upgrade to JsonCpp 1.8.4, and USE_LEGACY_JSONCPP option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2429
diff
changeset
|
100 add_definitions(-DJSONCPP_DEPRECATED_STACK_LIMIT=5000) |
0611aa383e62
Upgrade to JsonCpp 1.8.4, and USE_LEGACY_JSONCPP option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2429
diff
changeset
|
101 |
3575
1d403ecf3391
fix for DCMTK if MinGW combined with C++11
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
102 if (CMAKE_COMPILER_IS_GNUCXX) |
1d403ecf3391
fix for DCMTK if MinGW combined with C++11
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
103 message("Switching to C++11 standard in gcc, as version of JsonCpp is >= 1.0.0") |
4328
ce9284aebd40
new macro ORTHANC_DEPRECATED
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4120
diff
changeset
|
104 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11") |
3575
1d403ecf3391
fix for DCMTK if MinGW combined with C++11
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
105 elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") |
1d403ecf3391
fix for DCMTK if MinGW combined with C++11
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3133
diff
changeset
|
106 message("Switching to C++11 standard in clang, as version of JsonCpp is >= 1.0.0") |
4328
ce9284aebd40
new macro ORTHANC_DEPRECATED
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4120
diff
changeset
|
107 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") |
2497
0611aa383e62
Upgrade to JsonCpp 1.8.4, and USE_LEGACY_JSONCPP option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2429
diff
changeset
|
108 endif() |
735 | 109 endif() |