annotate OrthancFramework/Resources/CMake/MongooseConfiguration.cmake @ 5651:c4e33e0f907b

merge
author Alain Mazy <am@orthanc.team>
date Wed, 05 Jun 2024 11:04:37 +0200
parents f7adfb22e20e
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
5640
f7adfb22e20e updated copyright, as Orthanc Team now replaces Osimis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5485
diff changeset
4 # Copyright (C) 2017-2023 Osimis S.A., Belgium
f7adfb22e20e updated copyright, as Orthanc Team now replaces Osimis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5485
diff changeset
5 # Copyright (C) 2024-2024 Orthanc Team SRL, Belgium
5485
48b8dae6dc77 upgrade to year 2024
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5434
diff changeset
6 # Copyright (C) 2021-2024 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
4120
304842a0d152 adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4045
diff changeset
7 #
304842a0d152 adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4045
diff changeset
8 # 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
9 # 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
10 # 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
11 # the License, or (at your option) any later version.
304842a0d152 adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4045
diff changeset
12 #
304842a0d152 adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4045
diff changeset
13 # 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
14 # WITHOUT ANY WARRANTY; without even the implied warranty of
304842a0d152 adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4045
diff changeset
15 # 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
16 # Lesser General Public License for more details.
304842a0d152 adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4045
diff changeset
17 #
304842a0d152 adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4045
diff changeset
18 # 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
19 # License along with this program. If not, see
304842a0d152 adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4045
diff changeset
20 # <http://www.gnu.org/licenses/>.
304842a0d152 adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4045
diff changeset
21
304842a0d152 adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4045
diff changeset
22
735
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
23 if (STATIC_BUILD OR NOT USE_SYSTEM_MONGOOSE)
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
24 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
25
1537
fbf763bb1fa3 error detection in patches
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1415
diff changeset
26 if (IS_DIRECTORY "${MONGOOSE_SOURCES_DIR}")
fbf763bb1fa3 error detection in patches
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1415
diff changeset
27 set(FirstRun OFF)
fbf763bb1fa3 error detection in patches
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1415
diff changeset
28 else()
fbf763bb1fa3 error detection in patches
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1415
diff changeset
29 set(FirstRun ON)
fbf763bb1fa3 error detection in patches
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1415
diff changeset
30 endif()
fbf763bb1fa3 error detection in patches
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1415
diff changeset
31
1116
96a280b815f4 Upgrade to Mongoose 3.8
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1114
diff changeset
32 if (0)
1112
a119f9ae3640 upgrade to Mongoose 3.8
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1110
diff changeset
33 # Use Mongoose 3.1
a119f9ae3640 upgrade to Mongoose 3.8
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1110
diff changeset
34 DownloadPackage(
a119f9ae3640 upgrade to Mongoose 3.8
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1110
diff changeset
35 "e718fc287b4eb1bd523be3fa00942bb0"
5434
aa1c09fa6632 changed location of third-party downloads
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5271
diff changeset
36 "https://orthanc.uclouvain.be/downloads/third-party-downloads/mongoose-3.1.tgz"
1112
a119f9ae3640 upgrade to Mongoose 3.8
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1110
diff changeset
37 "${MONGOOSE_SOURCES_DIR}")
a119f9ae3640 upgrade to Mongoose 3.8
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1110
diff changeset
38
a119f9ae3640 upgrade to Mongoose 3.8
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1110
diff changeset
39 add_definitions(-DMONGOOSE_USE_CALLBACKS=0)
4045
05b8fd21089c fix path
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
40 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
41
a119f9ae3640 upgrade to Mongoose 3.8
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1110
diff changeset
42 else()
a119f9ae3640 upgrade to Mongoose 3.8
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1110
diff changeset
43 # Use Mongoose 3.8
a119f9ae3640 upgrade to Mongoose 3.8
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1110
diff changeset
44 DownloadPackage(
a119f9ae3640 upgrade to Mongoose 3.8
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1110
diff changeset
45 "7e3296295072792cdc3c633f9404e0c3"
5434
aa1c09fa6632 changed location of third-party downloads
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5271
diff changeset
46 "https://orthanc.uclouvain.be/downloads/third-party-downloads/mongoose-3.8.tgz"
1112
a119f9ae3640 upgrade to Mongoose 3.8
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1110
diff changeset
47 "${MONGOOSE_SOURCES_DIR}")
a119f9ae3640 upgrade to Mongoose 3.8
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1110
diff changeset
48
a119f9ae3640 upgrade to Mongoose 3.8
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1110
diff changeset
49 add_definitions(-DMONGOOSE_USE_CALLBACKS=1)
4045
05b8fd21089c fix path
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
50 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
51 endif()
735
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
52
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
53 # Patch mongoose
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
54 execute_process(
1546
17a3814fd8a1 fix patches on windows
jodogne
parents: 1543
diff changeset
55 COMMAND ${PATCH_EXECUTABLE} -N mongoose.c
17a3814fd8a1 fix patches on windows
jodogne
parents: 1543
diff changeset
56 INPUT_FILE ${MONGOOSE_PATCH}
735
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
57 WORKING_DIRECTORY ${MONGOOSE_SOURCES_DIR}
1537
fbf763bb1fa3 error detection in patches
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1415
diff changeset
58 RESULT_VARIABLE Failure
735
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
59 )
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
60
1537
fbf763bb1fa3 error detection in patches
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1415
diff changeset
61 if (Failure AND FirstRun)
fbf763bb1fa3 error detection in patches
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1415
diff changeset
62 message(FATAL_ERROR "Error while patching a file")
fbf763bb1fa3 error detection in patches
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1415
diff changeset
63 endif()
fbf763bb1fa3 error detection in patches
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1415
diff changeset
64
735
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
65 include_directories(
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
66 ${MONGOOSE_SOURCES_DIR}
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
67 )
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
68
1414
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1337
diff changeset
69 set(MONGOOSE_SOURCES
735
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
70 ${MONGOOSE_SOURCES_DIR}/mongoose.c
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
71 )
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
72
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
73
1415
728c22ade2e2 cleaning
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1414
diff changeset
74 if (ENABLE_SSL)
735
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
75 add_definitions(
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
76 -DNO_SSL_DL=1
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
77 )
890
816dccaeb7cf Support of kFreeBSD
jodogne
parents: 735
diff changeset
78 if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux" OR
816dccaeb7cf Support of kFreeBSD
jodogne
parents: 735
diff changeset
79 ${CMAKE_SYSTEM_NAME} STREQUAL "kFreeBSD")
735
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
80 link_libraries(dl)
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
81 endif()
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
82
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
83 else()
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
84 add_definitions(
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
85 -DNO_SSL=1 # Remove SSL support from mongoose
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
86 )
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
87 endif()
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
88
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
89
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
90 if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
1415
728c22ade2e2 cleaning
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1414
diff changeset
91 if (CMAKE_COMPILER_IS_GNUCXX)
735
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
92 # This is a patch for MinGW64
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
93 add_definitions(-D_TIMESPEC_DEFINED=1)
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
94 endif()
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
95 endif()
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
96
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
97 source_group(ThirdParty\\Mongoose REGULAR_EXPRESSION ${MONGOOSE_SOURCES_DIR}/.*)
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
98
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
99 else()
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
100 CHECK_INCLUDE_FILE_CXX(mongoose.h HAVE_MONGOOSE_H)
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
101 if (NOT HAVE_MONGOOSE_H)
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
102 message(FATAL_ERROR "Please install the mongoose-devel package")
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
103 endif()
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
104
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
105 CHECK_LIBRARY_EXISTS(mongoose mg_start "" HAVE_MONGOOSE_LIB)
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
106 if (NOT HAVE_MONGOOSE_LIB)
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
107 message(FATAL_ERROR "Please install the mongoose-devel package")
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
108 endif()
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
109
1112
a119f9ae3640 upgrade to Mongoose 3.8
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1110
diff changeset
110 if (SYSTEM_MONGOOSE_USE_CALLBACKS)
a119f9ae3640 upgrade to Mongoose 3.8
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1110
diff changeset
111 add_definitions(-DMONGOOSE_USE_CALLBACKS=1)
a119f9ae3640 upgrade to Mongoose 3.8
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1110
diff changeset
112 else()
a119f9ae3640 upgrade to Mongoose 3.8
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1110
diff changeset
113 add_definitions(-DMONGOOSE_USE_CALLBACKS=0)
a119f9ae3640 upgrade to Mongoose 3.8
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1110
diff changeset
114 endif()
a119f9ae3640 upgrade to Mongoose 3.8
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1110
diff changeset
115
735
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
116 link_libraries(mongoose)
ee0d5abf7958 dos2unix
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 634
diff changeset
117 endif()