comparison OrthancFramework/Resources/CMake/OpenSslConfigurationStatic-1.0.2.cmake @ 4044:d25f4c0fa160 framework

splitting code into OrthancFramework and OrthancServer
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 10 Jun 2020 20:30:34 +0200
parents Resources/CMake/OpenSslConfigurationStatic-1.0.2.cmake@faa695f433d5
children 304842a0d152
comparison
equal deleted inserted replaced
4043:6c6239aec462 4044:d25f4c0fa160
1 SET(OPENSSL_SOURCES_DIR ${CMAKE_BINARY_DIR}/openssl-1.0.2p)
2 SET(OPENSSL_URL "http://orthanc.osimis.io/ThirdPartyDownloads/openssl-1.0.2p.tar.gz")
3 SET(OPENSSL_MD5 "ac5eb30bf5798aa14b1ae6d0e7da58df")
4
5 if (IS_DIRECTORY "${OPENSSL_SOURCES_DIR}")
6 set(FirstRun OFF)
7 else()
8 set(FirstRun ON)
9 endif()
10
11 DownloadPackage(${OPENSSL_MD5} ${OPENSSL_URL} "${OPENSSL_SOURCES_DIR}")
12
13 if (FirstRun)
14 file(MAKE_DIRECTORY ${OPENSSL_SOURCES_DIR}/include/openssl)
15
16 foreach(header
17 ${OPENSSL_SOURCES_DIR}/crypto/aes/aes.h
18 ${OPENSSL_SOURCES_DIR}/crypto/asn1/asn1.h
19 ${OPENSSL_SOURCES_DIR}/crypto/asn1/asn1_mac.h
20 ${OPENSSL_SOURCES_DIR}/crypto/asn1/asn1t.h
21 ${OPENSSL_SOURCES_DIR}/crypto/bf/blowfish.h
22 ${OPENSSL_SOURCES_DIR}/crypto/bio/bio.h
23 ${OPENSSL_SOURCES_DIR}/crypto/bn/bn.h
24 ${OPENSSL_SOURCES_DIR}/crypto/buffer/buffer.h
25 ${OPENSSL_SOURCES_DIR}/crypto/camellia/camellia.h
26 ${OPENSSL_SOURCES_DIR}/crypto/cast/cast.h
27 ${OPENSSL_SOURCES_DIR}/crypto/cmac/cmac.h
28 ${OPENSSL_SOURCES_DIR}/crypto/cms/cms.h
29 ${OPENSSL_SOURCES_DIR}/crypto/comp/comp.h
30 ${OPENSSL_SOURCES_DIR}/crypto/conf/conf.h
31 ${OPENSSL_SOURCES_DIR}/crypto/conf/conf_api.h
32 ${OPENSSL_SOURCES_DIR}/crypto/crypto.h
33 ${OPENSSL_SOURCES_DIR}/crypto/des/des.h
34 ${OPENSSL_SOURCES_DIR}/crypto/des/des_old.h
35 ${OPENSSL_SOURCES_DIR}/crypto/dh/dh.h
36 ${OPENSSL_SOURCES_DIR}/crypto/dsa/dsa.h
37 ${OPENSSL_SOURCES_DIR}/crypto/dso/dso.h
38 ${OPENSSL_SOURCES_DIR}/crypto/ebcdic.h
39 ${OPENSSL_SOURCES_DIR}/crypto/ec/ec.h
40 ${OPENSSL_SOURCES_DIR}/crypto/ecdh/ecdh.h
41 ${OPENSSL_SOURCES_DIR}/crypto/ecdsa/ecdsa.h
42 ${OPENSSL_SOURCES_DIR}/crypto/engine/engine.h
43 ${OPENSSL_SOURCES_DIR}/crypto/err/err.h
44 ${OPENSSL_SOURCES_DIR}/crypto/evp/evp.h
45 ${OPENSSL_SOURCES_DIR}/crypto/hmac/hmac.h
46 ${OPENSSL_SOURCES_DIR}/crypto/idea/idea.h
47 ${OPENSSL_SOURCES_DIR}/crypto/jpake/jpake.h
48 ${OPENSSL_SOURCES_DIR}/crypto/krb5/krb5_asn.h
49 ${OPENSSL_SOURCES_DIR}/crypto/lhash/lhash.h
50 ${OPENSSL_SOURCES_DIR}/crypto/md2/md2.h
51 ${OPENSSL_SOURCES_DIR}/crypto/md4/md4.h
52 ${OPENSSL_SOURCES_DIR}/crypto/md5/md5.h
53 ${OPENSSL_SOURCES_DIR}/crypto/mdc2/mdc2.h
54 ${OPENSSL_SOURCES_DIR}/crypto/modes/modes.h
55 ${OPENSSL_SOURCES_DIR}/crypto/objects/obj_mac.h
56 ${OPENSSL_SOURCES_DIR}/crypto/objects/objects.h
57 ${OPENSSL_SOURCES_DIR}/crypto/ocsp/ocsp.h
58 ${OPENSSL_SOURCES_DIR}/crypto/opensslconf.h
59 ${OPENSSL_SOURCES_DIR}/crypto/opensslv.h
60 ${OPENSSL_SOURCES_DIR}/crypto/ossl_typ.h
61 ${OPENSSL_SOURCES_DIR}/crypto/pem/pem.h
62 ${OPENSSL_SOURCES_DIR}/crypto/pem/pem2.h
63 ${OPENSSL_SOURCES_DIR}/crypto/pkcs12/pkcs12.h
64 ${OPENSSL_SOURCES_DIR}/crypto/pkcs7/pkcs7.h
65 ${OPENSSL_SOURCES_DIR}/crypto/pqueue/pqueue.h
66 ${OPENSSL_SOURCES_DIR}/crypto/rand/rand.h
67 ${OPENSSL_SOURCES_DIR}/crypto/rc2/rc2.h
68 ${OPENSSL_SOURCES_DIR}/crypto/rc4/rc4.h
69 ${OPENSSL_SOURCES_DIR}/crypto/rc5/rc5.h
70 ${OPENSSL_SOURCES_DIR}/crypto/ripemd/ripemd.h
71 ${OPENSSL_SOURCES_DIR}/crypto/rsa/rsa.h
72 ${OPENSSL_SOURCES_DIR}/crypto/seed/seed.h
73 ${OPENSSL_SOURCES_DIR}/crypto/sha/sha.h
74 ${OPENSSL_SOURCES_DIR}/crypto/srp/srp.h
75 ${OPENSSL_SOURCES_DIR}/crypto/stack/safestack.h
76 ${OPENSSL_SOURCES_DIR}/crypto/stack/stack.h
77 ${OPENSSL_SOURCES_DIR}/crypto/store/store.h
78 ${OPENSSL_SOURCES_DIR}/crypto/symhacks.h
79 ${OPENSSL_SOURCES_DIR}/crypto/ts/ts.h
80 ${OPENSSL_SOURCES_DIR}/crypto/txt_db/txt_db.h
81 ${OPENSSL_SOURCES_DIR}/crypto/ui/ui.h
82 ${OPENSSL_SOURCES_DIR}/crypto/ui/ui_compat.h
83 ${OPENSSL_SOURCES_DIR}/crypto/whrlpool/whrlpool.h
84 ${OPENSSL_SOURCES_DIR}/crypto/x509/x509.h
85 ${OPENSSL_SOURCES_DIR}/crypto/x509/x509_vfy.h
86 ${OPENSSL_SOURCES_DIR}/crypto/x509v3/x509v3.h
87 ${OPENSSL_SOURCES_DIR}/e_os2.h
88 ${OPENSSL_SOURCES_DIR}/ssl/dtls1.h
89 ${OPENSSL_SOURCES_DIR}/ssl/kssl.h
90 ${OPENSSL_SOURCES_DIR}/ssl/srtp.h
91 ${OPENSSL_SOURCES_DIR}/ssl/ssl.h
92 ${OPENSSL_SOURCES_DIR}/ssl/ssl2.h
93 ${OPENSSL_SOURCES_DIR}/ssl/ssl23.h
94 ${OPENSSL_SOURCES_DIR}/ssl/ssl3.h
95 ${OPENSSL_SOURCES_DIR}/ssl/tls1.h
96 )
97 file(COPY ${header} DESTINATION ${OPENSSL_SOURCES_DIR}/include/openssl)
98 endforeach()
99
100 file(RENAME
101 ${OPENSSL_SOURCES_DIR}/include/openssl/e_os2.h
102 ${OPENSSL_SOURCES_DIR}/include/openssl/e_os2_source.h)
103
104 # The following patch of "e_os2.h" prevents from building OpenSSL
105 # as a DLL under Windows. Otherwise, symbols have inconsistent
106 # linkage if ${OPENSSL_SOURCES} is used to create a DLL (notably
107 # if building an Orthanc plugin such as MySQL).
108 file(WRITE ${OPENSSL_SOURCES_DIR}/include/openssl/e_os2.h "
109 #include \"e_os2_source.h\"
110 #if defined(_WIN32)
111 # undef OPENSSL_EXPORT
112 # undef OPENSSL_IMPORT
113 # undef OPENSSL_EXTERN
114 # undef OPENSSL_GLOBAL
115 # define OPENSSL_EXPORT
116 # define OPENSSL_IMPORT
117 # define OPENSSL_EXTERN extern
118 # define OPENSSL_GLOBAL
119 #endif
120 ")
121 endif()
122
123 add_definitions(
124 -DOPENSSL_THREADS
125 -DOPENSSL_IA32_SSE2
126 -DOPENSSL_NO_ASM
127 -DOPENSSL_NO_DYNAMIC_ENGINE
128 -DNO_WINDOWS_BRAINDEATH
129
130 -DOPENSSL_NO_BF
131 -DOPENSSL_NO_CAMELLIA
132 -DOPENSSL_NO_CAST
133 -DOPENSSL_NO_EC_NISTP_64_GCC_128
134 -DOPENSSL_NO_GMP
135 -DOPENSSL_NO_GOST
136 -DOPENSSL_NO_HW
137 -DOPENSSL_NO_JPAKE
138 -DOPENSSL_NO_IDEA
139 -DOPENSSL_NO_KRB5
140 -DOPENSSL_NO_MD2
141 -DOPENSSL_NO_MDC2
142 #-DOPENSSL_NO_MD4 # MD4 is necessary for MariaDB/MySQL client
143 -DOPENSSL_NO_RC2
144 -DOPENSSL_NO_RC4
145 -DOPENSSL_NO_RC5
146 -DOPENSSL_NO_RFC3779
147 -DOPENSSL_NO_SCTP
148 -DOPENSSL_NO_STORE
149 -DOPENSSL_NO_SEED
150 -DOPENSSL_NO_WHIRLPOOL
151 -DOPENSSL_NO_RIPEMD
152 )
153
154 include_directories(
155 ${OPENSSL_SOURCES_DIR}
156 ${OPENSSL_SOURCES_DIR}/crypto
157 ${OPENSSL_SOURCES_DIR}/crypto/asn1
158 ${OPENSSL_SOURCES_DIR}/crypto/modes
159 ${OPENSSL_SOURCES_DIR}/crypto/evp
160 ${OPENSSL_SOURCES_DIR}/include
161 )
162
163 set(OPENSSL_SOURCES_SUBDIRS
164 ${OPENSSL_SOURCES_DIR}/crypto
165 ${OPENSSL_SOURCES_DIR}/crypto/aes
166 ${OPENSSL_SOURCES_DIR}/crypto/asn1
167 ${OPENSSL_SOURCES_DIR}/crypto/bio
168 ${OPENSSL_SOURCES_DIR}/crypto/bn
169 ${OPENSSL_SOURCES_DIR}/crypto/buffer
170 ${OPENSSL_SOURCES_DIR}/crypto/cmac
171 ${OPENSSL_SOURCES_DIR}/crypto/cms
172 ${OPENSSL_SOURCES_DIR}/crypto/comp
173 ${OPENSSL_SOURCES_DIR}/crypto/conf
174 ${OPENSSL_SOURCES_DIR}/crypto/des
175 ${OPENSSL_SOURCES_DIR}/crypto/dh
176 ${OPENSSL_SOURCES_DIR}/crypto/dsa
177 ${OPENSSL_SOURCES_DIR}/crypto/dso
178 ${OPENSSL_SOURCES_DIR}/crypto/engine
179 ${OPENSSL_SOURCES_DIR}/crypto/err
180 ${OPENSSL_SOURCES_DIR}/crypto/evp
181 ${OPENSSL_SOURCES_DIR}/crypto/hmac
182 ${OPENSSL_SOURCES_DIR}/crypto/lhash
183 ${OPENSSL_SOURCES_DIR}/crypto/md4
184 ${OPENSSL_SOURCES_DIR}/crypto/md5
185 ${OPENSSL_SOURCES_DIR}/crypto/modes
186 ${OPENSSL_SOURCES_DIR}/crypto/objects
187 ${OPENSSL_SOURCES_DIR}/crypto/ocsp
188 ${OPENSSL_SOURCES_DIR}/crypto/pem
189 ${OPENSSL_SOURCES_DIR}/crypto/pkcs12
190 ${OPENSSL_SOURCES_DIR}/crypto/pkcs7
191 ${OPENSSL_SOURCES_DIR}/crypto/pqueue
192 ${OPENSSL_SOURCES_DIR}/crypto/rand
193 ${OPENSSL_SOURCES_DIR}/crypto/rsa
194 ${OPENSSL_SOURCES_DIR}/crypto/sha
195 ${OPENSSL_SOURCES_DIR}/crypto/srp
196 ${OPENSSL_SOURCES_DIR}/crypto/stack
197 ${OPENSSL_SOURCES_DIR}/crypto/ts
198 ${OPENSSL_SOURCES_DIR}/crypto/txt_db
199 ${OPENSSL_SOURCES_DIR}/crypto/ui
200 ${OPENSSL_SOURCES_DIR}/crypto/x509
201 ${OPENSSL_SOURCES_DIR}/crypto/x509v3
202 ${OPENSSL_SOURCES_DIR}/ssl
203 )
204
205 if (ENABLE_OPENSSL_ENGINES)
206 list(APPEND OPENSSL_SOURCES_SUBDIRS
207 ${OPENSSL_SOURCES_DIR}/engines
208 )
209 endif()
210
211 list(APPEND OPENSSL_SOURCES_SUBDIRS
212 # EC, ECDH and ECDSA are necessary for PKCS11, and for contacting
213 # HTTPS servers that use TLS certificate encrypted with ECDSA
214 # (check the output of a recent version of the "sslscan"
215 # command). Until Orthanc <= 1.4.1, these features were only
216 # enabled if ENABLE_PKCS11 support was set to "ON".
217 # https://groups.google.com/d/msg/orthanc-users/2l-bhYIMEWg/oMmK33bYBgAJ
218 ${OPENSSL_SOURCES_DIR}/crypto/ec
219 ${OPENSSL_SOURCES_DIR}/crypto/ecdh
220 ${OPENSSL_SOURCES_DIR}/crypto/ecdsa
221 )
222
223 foreach(d ${OPENSSL_SOURCES_SUBDIRS})
224 AUX_SOURCE_DIRECTORY(${d} OPENSSL_SOURCES)
225 endforeach()
226
227 list(REMOVE_ITEM OPENSSL_SOURCES
228 ${OPENSSL_SOURCES_DIR}/crypto/LPdir_unix.c
229 ${OPENSSL_SOURCES_DIR}/crypto/LPdir_vms.c
230 ${OPENSSL_SOURCES_DIR}/crypto/LPdir_win.c
231 ${OPENSSL_SOURCES_DIR}/crypto/LPdir_win32.c
232 ${OPENSSL_SOURCES_DIR}/crypto/LPdir_wince.c
233 ${OPENSSL_SOURCES_DIR}/crypto/armcap.c
234 ${OPENSSL_SOURCES_DIR}/crypto/bf/bfs.cpp
235 ${OPENSSL_SOURCES_DIR}/crypto/bio/bss_rtcp.c
236 ${OPENSSL_SOURCES_DIR}/crypto/bn/exp.c
237 ${OPENSSL_SOURCES_DIR}/crypto/conf/cnf_save.c
238 ${OPENSSL_SOURCES_DIR}/crypto/conf/test.c
239 ${OPENSSL_SOURCES_DIR}/crypto/des/des.c
240 ${OPENSSL_SOURCES_DIR}/crypto/des/des3s.cpp
241 ${OPENSSL_SOURCES_DIR}/crypto/des/des_opts.c
242 ${OPENSSL_SOURCES_DIR}/crypto/des/dess.cpp
243 ${OPENSSL_SOURCES_DIR}/crypto/des/read_pwd.c
244 ${OPENSSL_SOURCES_DIR}/crypto/des/speed.c
245 ${OPENSSL_SOURCES_DIR}/crypto/evp/e_dsa.c
246 ${OPENSSL_SOURCES_DIR}/crypto/evp/m_ripemd.c
247 ${OPENSSL_SOURCES_DIR}/crypto/lhash/lh_test.c
248 ${OPENSSL_SOURCES_DIR}/crypto/md4/md4.c
249 ${OPENSSL_SOURCES_DIR}/crypto/md4/md4s.cpp
250 ${OPENSSL_SOURCES_DIR}/crypto/md4/md4test.c
251 ${OPENSSL_SOURCES_DIR}/crypto/md5/md5s.cpp
252 ${OPENSSL_SOURCES_DIR}/crypto/pkcs7/bio_ber.c
253 ${OPENSSL_SOURCES_DIR}/crypto/pkcs7/pk7_enc.c
254 ${OPENSSL_SOURCES_DIR}/crypto/ppccap.c
255 ${OPENSSL_SOURCES_DIR}/crypto/rand/randtest.c
256 ${OPENSSL_SOURCES_DIR}/crypto/s390xcap.c
257 ${OPENSSL_SOURCES_DIR}/crypto/sparcv9cap.c
258 ${OPENSSL_SOURCES_DIR}/crypto/x509v3/tabtest.c
259 ${OPENSSL_SOURCES_DIR}/crypto/x509v3/v3conf.c
260 ${OPENSSL_SOURCES_DIR}/ssl/ssl_task.c
261 ${OPENSSL_SOURCES_DIR}/crypto/LPdir_nyi.c
262 ${OPENSSL_SOURCES_DIR}/crypto/aes/aes_x86core.c
263 ${OPENSSL_SOURCES_DIR}/crypto/bio/bss_dgram.c
264 ${OPENSSL_SOURCES_DIR}/crypto/bn/bntest.c
265 ${OPENSSL_SOURCES_DIR}/crypto/bn/expspeed.c
266 ${OPENSSL_SOURCES_DIR}/crypto/bn/exptest.c
267 ${OPENSSL_SOURCES_DIR}/crypto/engine/enginetest.c
268 ${OPENSSL_SOURCES_DIR}/crypto/evp/evp_test.c
269 ${OPENSSL_SOURCES_DIR}/crypto/hmac/hmactest.c
270 ${OPENSSL_SOURCES_DIR}/crypto/md5/md5.c
271 ${OPENSSL_SOURCES_DIR}/crypto/md5/md5test.c
272 ${OPENSSL_SOURCES_DIR}/crypto/o_dir_test.c
273 ${OPENSSL_SOURCES_DIR}/crypto/pkcs7/dec.c
274 ${OPENSSL_SOURCES_DIR}/crypto/pkcs7/enc.c
275 ${OPENSSL_SOURCES_DIR}/crypto/pkcs7/sign.c
276 ${OPENSSL_SOURCES_DIR}/crypto/pkcs7/verify.c
277 ${OPENSSL_SOURCES_DIR}/crypto/rsa/rsa_test.c
278 ${OPENSSL_SOURCES_DIR}/crypto/sha/sha.c
279 ${OPENSSL_SOURCES_DIR}/crypto/sha/sha1.c
280 ${OPENSSL_SOURCES_DIR}/crypto/sha/sha1t.c
281 ${OPENSSL_SOURCES_DIR}/crypto/sha/sha1test.c
282 ${OPENSSL_SOURCES_DIR}/crypto/sha/sha256t.c
283 ${OPENSSL_SOURCES_DIR}/crypto/sha/sha512t.c
284 ${OPENSSL_SOURCES_DIR}/crypto/sha/shatest.c
285 ${OPENSSL_SOURCES_DIR}/crypto/srp/srptest.c
286
287 ${OPENSSL_SOURCES_DIR}/crypto/bn/divtest.c
288 ${OPENSSL_SOURCES_DIR}/crypto/bn/bnspeed.c
289 ${OPENSSL_SOURCES_DIR}/crypto/des/destest.c
290 ${OPENSSL_SOURCES_DIR}/crypto/dh/p192.c
291 ${OPENSSL_SOURCES_DIR}/crypto/dh/p512.c
292 ${OPENSSL_SOURCES_DIR}/crypto/dh/p1024.c
293 ${OPENSSL_SOURCES_DIR}/crypto/des/rpw.c
294 ${OPENSSL_SOURCES_DIR}/ssl/ssltest.c
295 ${OPENSSL_SOURCES_DIR}/crypto/dsa/dsagen.c
296 ${OPENSSL_SOURCES_DIR}/crypto/dsa/dsatest.c
297 ${OPENSSL_SOURCES_DIR}/crypto/dh/dhtest.c
298 ${OPENSSL_SOURCES_DIR}/crypto/pqueue/pq_test.c
299 ${OPENSSL_SOURCES_DIR}/crypto/des/ncbc_enc.c
300
301 ${OPENSSL_SOURCES_DIR}/crypto/evp/evp_extra_test.c
302 ${OPENSSL_SOURCES_DIR}/crypto/evp/verify_extra_test.c
303 ${OPENSSL_SOURCES_DIR}/crypto/x509/verify_extra_test.c
304 ${OPENSSL_SOURCES_DIR}/crypto/x509v3/v3prin.c
305 ${OPENSSL_SOURCES_DIR}/crypto/x509v3/v3nametest.c
306 ${OPENSSL_SOURCES_DIR}/crypto/constant_time_test.c
307
308 ${OPENSSL_SOURCES_DIR}/ssl/heartbeat_test.c
309 ${OPENSSL_SOURCES_DIR}/ssl/fatalerrtest.c
310 ${OPENSSL_SOURCES_DIR}/ssl/dtlstest.c
311 ${OPENSSL_SOURCES_DIR}/ssl/bad_dtls_test.c
312 ${OPENSSL_SOURCES_DIR}/ssl/clienthellotest.c
313 ${OPENSSL_SOURCES_DIR}/ssl/sslv2conftest.c
314
315 ${OPENSSL_SOURCES_DIR}/crypto/ec/ecp_nistz256.c
316 ${OPENSSL_SOURCES_DIR}/crypto/ec/ecp_nistz256_table.c
317 ${OPENSSL_SOURCES_DIR}/crypto/ec/ectest.c
318 ${OPENSSL_SOURCES_DIR}/crypto/ecdh/ecdhtest.c
319 ${OPENSSL_SOURCES_DIR}/crypto/ecdsa/ecdsatest.c
320 )
321
322
323 if ("${CMAKE_SYSTEM_NAME}" STREQUAL "Windows")
324 set_source_files_properties(
325 ${OPENSSL_SOURCES}
326 PROPERTIES COMPILE_DEFINITIONS
327 "OPENSSL_SYSNAME_WIN32;SO_WIN32;WIN32_LEAN_AND_MEAN;L_ENDIAN")
328
329 if (ENABLE_OPENSSL_ENGINES)
330 link_libraries(crypt32)
331 endif()
332 endif()