Mercurial > hg > orthanc
annotate OrthancFramework/Resources/CMake/MongooseConfiguration.cmake @ 4962:501411a67f10 more-tags
merge
author | Alain Mazy <am@osimis.io> |
---|---|
date | Wed, 23 Mar 2022 12:23:11 +0100 |
parents | 43e613a7756b |
children | 0ea402b4d901 |
rev | line source |
---|---|
4120
304842a0d152
adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4045
diff
changeset
|
1 # Orthanc - A Lightweight, RESTful DICOM Store |
304842a0d152
adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4045
diff
changeset
|
2 # Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics |
304842a0d152
adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4045
diff
changeset
|
3 # Department, University Hospital of Liege, Belgium |
4870
43e613a7756b
upgrade to year 2022
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4831
diff
changeset
|
4 # Copyright (C) 2017-2022 Osimis S.A., Belgium |
43e613a7756b
upgrade to year 2022
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4831
diff
changeset
|
5 # Copyright (C) 2021-2022 Sebastien Jodogne, ICTEAM UCLouvain, Belgium |
4120
304842a0d152
adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4045
diff
changeset
|
6 # |
304842a0d152
adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4045
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:
4045
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:
4045
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:
4045
diff
changeset
|
10 # the License, or (at your option) any later version. |
304842a0d152
adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4045
diff
changeset
|
11 # |
304842a0d152
adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4045
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:
4045
diff
changeset
|
13 # WITHOUT ANY WARRANTY; without even the implied warranty of |
304842a0d152
adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4045
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:
4045
diff
changeset
|
15 # Lesser General Public License for more details. |
304842a0d152
adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4045
diff
changeset
|
16 # |
304842a0d152
adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4045
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:
4045
diff
changeset
|
18 # License along with this program. If not, see |
304842a0d152
adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4045
diff
changeset
|
19 # <http://www.gnu.org/licenses/>. |
304842a0d152
adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4045
diff
changeset
|
20 |
304842a0d152
adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4045
diff
changeset
|
21 |
735 | 22 if (STATIC_BUILD OR NOT USE_SYSTEM_MONGOOSE) |
23 SET(MONGOOSE_SOURCES_DIR ${CMAKE_BINARY_DIR}/mongoose) | |
1112
a119f9ae3640
upgrade to Mongoose 3.8
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1110
diff
changeset
|
24 |
1537
fbf763bb1fa3
error detection in patches
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1415
diff
changeset
|
25 if (IS_DIRECTORY "${MONGOOSE_SOURCES_DIR}") |
fbf763bb1fa3
error detection in patches
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1415
diff
changeset
|
26 set(FirstRun OFF) |
fbf763bb1fa3
error detection in patches
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1415
diff
changeset
|
27 else() |
fbf763bb1fa3
error detection in patches
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1415
diff
changeset
|
28 set(FirstRun ON) |
fbf763bb1fa3
error detection in patches
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1415
diff
changeset
|
29 endif() |
fbf763bb1fa3
error detection in patches
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1415
diff
changeset
|
30 |
1116
96a280b815f4
Upgrade to Mongoose 3.8
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1114
diff
changeset
|
31 if (0) |
1112
a119f9ae3640
upgrade to Mongoose 3.8
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1110
diff
changeset
|
32 # Use Mongoose 3.1 |
a119f9ae3640
upgrade to Mongoose 3.8
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1110
diff
changeset
|
33 DownloadPackage( |
a119f9ae3640
upgrade to Mongoose 3.8
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1110
diff
changeset
|
34 "e718fc287b4eb1bd523be3fa00942bb0" |
3133
0c2a8d5e0097
moving third-party dependencies to another server
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2384
diff
changeset
|
35 "http://orthanc.osimis.io/ThirdPartyDownloads/mongoose-3.1.tgz" |
1112
a119f9ae3640
upgrade to Mongoose 3.8
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1110
diff
changeset
|
36 "${MONGOOSE_SOURCES_DIR}") |
a119f9ae3640
upgrade to Mongoose 3.8
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1110
diff
changeset
|
37 |
a119f9ae3640
upgrade to Mongoose 3.8
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1110
diff
changeset
|
38 add_definitions(-DMONGOOSE_USE_CALLBACKS=0) |
4045 | 39 set(MONGOOSE_PATCH ${CMAKE_CURRENT_LIST_DIR}/../Patches/mongoose-3.1-patch.diff) |
1112
a119f9ae3640
upgrade to Mongoose 3.8
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1110
diff
changeset
|
40 |
a119f9ae3640
upgrade to Mongoose 3.8
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1110
diff
changeset
|
41 else() |
a119f9ae3640
upgrade to Mongoose 3.8
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1110
diff
changeset
|
42 # Use Mongoose 3.8 |
a119f9ae3640
upgrade to Mongoose 3.8
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1110
diff
changeset
|
43 DownloadPackage( |
a119f9ae3640
upgrade to Mongoose 3.8
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1110
diff
changeset
|
44 "7e3296295072792cdc3c633f9404e0c3" |
3133
0c2a8d5e0097
moving third-party dependencies to another server
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2384
diff
changeset
|
45 "http://orthanc.osimis.io/ThirdPartyDownloads/mongoose-3.8.tgz" |
1112
a119f9ae3640
upgrade to Mongoose 3.8
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1110
diff
changeset
|
46 "${MONGOOSE_SOURCES_DIR}") |
a119f9ae3640
upgrade to Mongoose 3.8
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1110
diff
changeset
|
47 |
a119f9ae3640
upgrade to Mongoose 3.8
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1110
diff
changeset
|
48 add_definitions(-DMONGOOSE_USE_CALLBACKS=1) |
4045 | 49 set(MONGOOSE_PATCH ${CMAKE_CURRENT_LIST_DIR}/../Patches/mongoose-3.8-patch.diff) |
1112
a119f9ae3640
upgrade to Mongoose 3.8
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1110
diff
changeset
|
50 endif() |
735 | 51 |
52 # Patch mongoose | |
53 execute_process( | |
1546 | 54 COMMAND ${PATCH_EXECUTABLE} -N mongoose.c |
55 INPUT_FILE ${MONGOOSE_PATCH} | |
735 | 56 WORKING_DIRECTORY ${MONGOOSE_SOURCES_DIR} |
1537
fbf763bb1fa3
error detection in patches
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1415
diff
changeset
|
57 RESULT_VARIABLE Failure |
735 | 58 ) |
59 | |
1537
fbf763bb1fa3
error detection in patches
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1415
diff
changeset
|
60 if (Failure AND FirstRun) |
fbf763bb1fa3
error detection in patches
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1415
diff
changeset
|
61 message(FATAL_ERROR "Error while patching a file") |
fbf763bb1fa3
error detection in patches
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1415
diff
changeset
|
62 endif() |
fbf763bb1fa3
error detection in patches
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1415
diff
changeset
|
63 |
735 | 64 include_directories( |
65 ${MONGOOSE_SOURCES_DIR} | |
66 ) | |
67 | |
1414 | 68 set(MONGOOSE_SOURCES |
735 | 69 ${MONGOOSE_SOURCES_DIR}/mongoose.c |
70 ) | |
71 | |
72 | |
1415 | 73 if (ENABLE_SSL) |
735 | 74 add_definitions( |
75 -DNO_SSL_DL=1 | |
76 ) | |
890 | 77 if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux" OR |
78 ${CMAKE_SYSTEM_NAME} STREQUAL "kFreeBSD") | |
735 | 79 link_libraries(dl) |
80 endif() | |
81 | |
82 else() | |
83 add_definitions( | |
84 -DNO_SSL=1 # Remove SSL support from mongoose | |
85 ) | |
86 endif() | |
87 | |
88 | |
89 if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows") | |
1415 | 90 if (CMAKE_COMPILER_IS_GNUCXX) |
735 | 91 # This is a patch for MinGW64 |
92 add_definitions(-D_TIMESPEC_DEFINED=1) | |
93 endif() | |
94 endif() | |
95 | |
96 source_group(ThirdParty\\Mongoose REGULAR_EXPRESSION ${MONGOOSE_SOURCES_DIR}/.*) | |
97 | |
98 else() | |
99 CHECK_INCLUDE_FILE_CXX(mongoose.h HAVE_MONGOOSE_H) | |
100 if (NOT HAVE_MONGOOSE_H) | |
101 message(FATAL_ERROR "Please install the mongoose-devel package") | |
102 endif() | |
103 | |
104 CHECK_LIBRARY_EXISTS(mongoose mg_start "" HAVE_MONGOOSE_LIB) | |
105 if (NOT HAVE_MONGOOSE_LIB) | |
106 message(FATAL_ERROR "Please install the mongoose-devel package") | |
107 endif() | |
108 | |
1112
a119f9ae3640
upgrade to Mongoose 3.8
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1110
diff
changeset
|
109 if (SYSTEM_MONGOOSE_USE_CALLBACKS) |
a119f9ae3640
upgrade to Mongoose 3.8
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1110
diff
changeset
|
110 add_definitions(-DMONGOOSE_USE_CALLBACKS=1) |
a119f9ae3640
upgrade to Mongoose 3.8
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1110
diff
changeset
|
111 else() |
a119f9ae3640
upgrade to Mongoose 3.8
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1110
diff
changeset
|
112 add_definitions(-DMONGOOSE_USE_CALLBACKS=0) |
a119f9ae3640
upgrade to Mongoose 3.8
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1110
diff
changeset
|
113 endif() |
a119f9ae3640
upgrade to Mongoose 3.8
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1110
diff
changeset
|
114 |
735 | 115 link_libraries(mongoose) |
116 endif() |