comparison Common/CryptoPPConfiguration.cmake @ 38:9c0dfd10d5d0

statically link against libcrypto++
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 20 Jan 2021 12:35:23 +0100
parents
children a360eb28089d
comparison
equal deleted inserted replaced
37:f55b2afdf53d 38:9c0dfd10d5d0
1 # Cloud storage plugins for Orthanc
2 # Copyright (C) 2020-2021 Osimis S.A., Belgium
3 #
4 # This program is free software: you can redistribute it and/or
5 # modify it under the terms of the GNU Affero General Public License
6 # as published by the Free Software Foundation, either version 3 of
7 # the License, or (at your option) any later version.
8 #
9 # This program is distributed in the hope that it will be useful, but
10 # WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 # Affero General Public License for more details.
13 #
14 # You should have received a copy of the GNU Affero General Public License
15 # along with this program. If not, see <http://www.gnu.org/licenses/>.
16
17
18 if (STATIC_BUILD OR NOT USE_SYSTEM_CRYPTOPP)
19 # The .tar.gz package was created by "./CryptoPPPackage.sh"
20 SET(CRYPTOPP_SOURCES_DIR ${CMAKE_BINARY_DIR}/cryptopp-840)
21 SET(CRYPTOPP_URL "http://orthanc.osimis.io/ThirdPartyDownloads/cryptopp-840.tar.gz")
22 SET(CRYPTOPP_MD5 "d42363e8a12c06a000720335a4da70d3")
23
24 DownloadPackage(${CRYPTOPP_MD5} ${CRYPTOPP_URL} "${CRYPTOPP_SOURCES_DIR}")
25
26 include_directories(
27 ${CRYPTOPP_SOURCES_DIR}
28 )
29
30 # TODO - Consider adding SIMD support
31 add_definitions(
32 -DCRYPTOPP_DISABLE_ASM
33 )
34
35 set(CRYPTOPP_SOURCES
36 # ${CRYPTOPP_SOURCES_DIR}/cryptopp/aria_simd.cpp
37 # ${CRYPTOPP_SOURCES_DIR}/cryptopp/bench1.cpp
38 # ${CRYPTOPP_SOURCES_DIR}/cryptopp/bench2.cpp
39 # ${CRYPTOPP_SOURCES_DIR}/cryptopp/bench3.cpp
40 # ${CRYPTOPP_SOURCES_DIR}/cryptopp/blake2b_simd.cpp
41 # ${CRYPTOPP_SOURCES_DIR}/cryptopp/blake2s_simd.cpp
42 # ${CRYPTOPP_SOURCES_DIR}/cryptopp/chacha_avx.cpp
43 # ${CRYPTOPP_SOURCES_DIR}/cryptopp/chacha_simd.cpp
44 # ${CRYPTOPP_SOURCES_DIR}/cryptopp/cham_simd.cpp
45 # ${CRYPTOPP_SOURCES_DIR}/cryptopp/crc_simd.cpp
46 # ${CRYPTOPP_SOURCES_DIR}/cryptopp/datatest.cpp
47 # ${CRYPTOPP_SOURCES_DIR}/cryptopp/dlltest.cpp
48 # ${CRYPTOPP_SOURCES_DIR}/cryptopp/fipsalgt.cpp
49 # ${CRYPTOPP_SOURCES_DIR}/cryptopp/fipstest.cpp
50 # ${CRYPTOPP_SOURCES_DIR}/cryptopp/gcm_simd.cpp
51 # ${CRYPTOPP_SOURCES_DIR}/cryptopp/gf2n_simd.cpp
52 # ${CRYPTOPP_SOURCES_DIR}/cryptopp/keccak_simd.cpp
53 # ${CRYPTOPP_SOURCES_DIR}/cryptopp/lea_simd.cpp
54 # ${CRYPTOPP_SOURCES_DIR}/cryptopp/neon_simd.cpp
55 # ${CRYPTOPP_SOURCES_DIR}/cryptopp/ppc_simd.cpp
56 # ${CRYPTOPP_SOURCES_DIR}/cryptopp/regtest1.cpp
57 # ${CRYPTOPP_SOURCES_DIR}/cryptopp/regtest2.cpp
58 # ${CRYPTOPP_SOURCES_DIR}/cryptopp/regtest3.cpp
59 # ${CRYPTOPP_SOURCES_DIR}/cryptopp/regtest4.cpp
60 # ${CRYPTOPP_SOURCES_DIR}/cryptopp/rijndael_simd.cpp
61 # ${CRYPTOPP_SOURCES_DIR}/cryptopp/sha_simd.cpp
62 # ${CRYPTOPP_SOURCES_DIR}/cryptopp/shacal2_simd.cpp
63 # ${CRYPTOPP_SOURCES_DIR}/cryptopp/simon128_simd.cpp
64 # ${CRYPTOPP_SOURCES_DIR}/cryptopp/sm4_simd.cpp
65 # ${CRYPTOPP_SOURCES_DIR}/cryptopp/speck128_simd.cpp
66 # ${CRYPTOPP_SOURCES_DIR}/cryptopp/sse_simd.cpp
67 # ${CRYPTOPP_SOURCES_DIR}/cryptopp/test.cpp
68 # ${CRYPTOPP_SOURCES_DIR}/cryptopp/validat0.cpp
69 # ${CRYPTOPP_SOURCES_DIR}/cryptopp/validat1.cpp
70 # ${CRYPTOPP_SOURCES_DIR}/cryptopp/validat10.cpp
71 # ${CRYPTOPP_SOURCES_DIR}/cryptopp/validat2.cpp
72 # ${CRYPTOPP_SOURCES_DIR}/cryptopp/validat3.cpp
73 # ${CRYPTOPP_SOURCES_DIR}/cryptopp/validat4.cpp
74 # ${CRYPTOPP_SOURCES_DIR}/cryptopp/validat5.cpp
75 # ${CRYPTOPP_SOURCES_DIR}/cryptopp/validat6.cpp
76 # ${CRYPTOPP_SOURCES_DIR}/cryptopp/validat7.cpp
77 # ${CRYPTOPP_SOURCES_DIR}/cryptopp/validat8.cpp
78 # ${CRYPTOPP_SOURCES_DIR}/cryptopp/validat9.cpp
79
80 ${CRYPTOPP_SOURCES_DIR}/cryptopp/3way.cpp
81 ${CRYPTOPP_SOURCES_DIR}/cryptopp/adler32.cpp
82 ${CRYPTOPP_SOURCES_DIR}/cryptopp/algebra.cpp
83 ${CRYPTOPP_SOURCES_DIR}/cryptopp/algparam.cpp
84 ${CRYPTOPP_SOURCES_DIR}/cryptopp/allocate.cpp
85 ${CRYPTOPP_SOURCES_DIR}/cryptopp/arc4.cpp
86 ${CRYPTOPP_SOURCES_DIR}/cryptopp/aria.cpp
87 ${CRYPTOPP_SOURCES_DIR}/cryptopp/ariatab.cpp
88 ${CRYPTOPP_SOURCES_DIR}/cryptopp/asn.cpp
89 ${CRYPTOPP_SOURCES_DIR}/cryptopp/authenc.cpp
90 ${CRYPTOPP_SOURCES_DIR}/cryptopp/base32.cpp
91 ${CRYPTOPP_SOURCES_DIR}/cryptopp/base64.cpp
92 ${CRYPTOPP_SOURCES_DIR}/cryptopp/basecode.cpp
93 ${CRYPTOPP_SOURCES_DIR}/cryptopp/bfinit.cpp
94 ${CRYPTOPP_SOURCES_DIR}/cryptopp/blake2.cpp
95 ${CRYPTOPP_SOURCES_DIR}/cryptopp/blowfish.cpp
96 ${CRYPTOPP_SOURCES_DIR}/cryptopp/blumshub.cpp
97 ${CRYPTOPP_SOURCES_DIR}/cryptopp/camellia.cpp
98 ${CRYPTOPP_SOURCES_DIR}/cryptopp/cast.cpp
99 ${CRYPTOPP_SOURCES_DIR}/cryptopp/casts.cpp
100 ${CRYPTOPP_SOURCES_DIR}/cryptopp/cbcmac.cpp
101 ${CRYPTOPP_SOURCES_DIR}/cryptopp/ccm.cpp
102 ${CRYPTOPP_SOURCES_DIR}/cryptopp/chacha.cpp
103 ${CRYPTOPP_SOURCES_DIR}/cryptopp/chachapoly.cpp
104 ${CRYPTOPP_SOURCES_DIR}/cryptopp/cham.cpp
105 ${CRYPTOPP_SOURCES_DIR}/cryptopp/channels.cpp
106 ${CRYPTOPP_SOURCES_DIR}/cryptopp/cmac.cpp
107 ${CRYPTOPP_SOURCES_DIR}/cryptopp/cpu.cpp
108 ${CRYPTOPP_SOURCES_DIR}/cryptopp/crc.cpp
109 ${CRYPTOPP_SOURCES_DIR}/cryptopp/cryptlib.cpp
110 ${CRYPTOPP_SOURCES_DIR}/cryptopp/darn.cpp
111 ${CRYPTOPP_SOURCES_DIR}/cryptopp/default.cpp
112 ${CRYPTOPP_SOURCES_DIR}/cryptopp/des.cpp
113 ${CRYPTOPP_SOURCES_DIR}/cryptopp/dessp.cpp
114 ${CRYPTOPP_SOURCES_DIR}/cryptopp/dh.cpp
115 ${CRYPTOPP_SOURCES_DIR}/cryptopp/dh2.cpp
116 ${CRYPTOPP_SOURCES_DIR}/cryptopp/dll.cpp
117 ${CRYPTOPP_SOURCES_DIR}/cryptopp/donna_32.cpp
118 ${CRYPTOPP_SOURCES_DIR}/cryptopp/donna_64.cpp
119 ${CRYPTOPP_SOURCES_DIR}/cryptopp/donna_sse.cpp
120 ${CRYPTOPP_SOURCES_DIR}/cryptopp/dsa.cpp
121 ${CRYPTOPP_SOURCES_DIR}/cryptopp/eax.cpp
122 ${CRYPTOPP_SOURCES_DIR}/cryptopp/ec2n.cpp
123 ${CRYPTOPP_SOURCES_DIR}/cryptopp/eccrypto.cpp
124 ${CRYPTOPP_SOURCES_DIR}/cryptopp/ecp.cpp
125 ${CRYPTOPP_SOURCES_DIR}/cryptopp/elgamal.cpp
126 ${CRYPTOPP_SOURCES_DIR}/cryptopp/emsa2.cpp
127 ${CRYPTOPP_SOURCES_DIR}/cryptopp/eprecomp.cpp
128 ${CRYPTOPP_SOURCES_DIR}/cryptopp/esign.cpp
129 ${CRYPTOPP_SOURCES_DIR}/cryptopp/files.cpp
130 ${CRYPTOPP_SOURCES_DIR}/cryptopp/filters.cpp
131 ${CRYPTOPP_SOURCES_DIR}/cryptopp/fips140.cpp
132 ${CRYPTOPP_SOURCES_DIR}/cryptopp/gcm.cpp
133 ${CRYPTOPP_SOURCES_DIR}/cryptopp/gf256.cpp
134 ${CRYPTOPP_SOURCES_DIR}/cryptopp/gf2_32.cpp
135 ${CRYPTOPP_SOURCES_DIR}/cryptopp/gf2n.cpp
136 ${CRYPTOPP_SOURCES_DIR}/cryptopp/gfpcrypt.cpp
137 ${CRYPTOPP_SOURCES_DIR}/cryptopp/gost.cpp
138 ${CRYPTOPP_SOURCES_DIR}/cryptopp/gzip.cpp
139 ${CRYPTOPP_SOURCES_DIR}/cryptopp/hc128.cpp
140 ${CRYPTOPP_SOURCES_DIR}/cryptopp/hc256.cpp
141 ${CRYPTOPP_SOURCES_DIR}/cryptopp/hex.cpp
142 ${CRYPTOPP_SOURCES_DIR}/cryptopp/hight.cpp
143 ${CRYPTOPP_SOURCES_DIR}/cryptopp/hmac.cpp
144 ${CRYPTOPP_SOURCES_DIR}/cryptopp/hrtimer.cpp
145 ${CRYPTOPP_SOURCES_DIR}/cryptopp/ida.cpp
146 ${CRYPTOPP_SOURCES_DIR}/cryptopp/idea.cpp
147 ${CRYPTOPP_SOURCES_DIR}/cryptopp/integer.cpp
148 ${CRYPTOPP_SOURCES_DIR}/cryptopp/iterhash.cpp
149 ${CRYPTOPP_SOURCES_DIR}/cryptopp/kalyna.cpp
150 ${CRYPTOPP_SOURCES_DIR}/cryptopp/kalynatab.cpp
151 ${CRYPTOPP_SOURCES_DIR}/cryptopp/keccak.cpp
152 ${CRYPTOPP_SOURCES_DIR}/cryptopp/keccak_core.cpp
153 ${CRYPTOPP_SOURCES_DIR}/cryptopp/lea.cpp
154 ${CRYPTOPP_SOURCES_DIR}/cryptopp/luc.cpp
155 ${CRYPTOPP_SOURCES_DIR}/cryptopp/mars.cpp
156 ${CRYPTOPP_SOURCES_DIR}/cryptopp/marss.cpp
157 ${CRYPTOPP_SOURCES_DIR}/cryptopp/md2.cpp
158 ${CRYPTOPP_SOURCES_DIR}/cryptopp/md4.cpp
159 ${CRYPTOPP_SOURCES_DIR}/cryptopp/md5.cpp
160 ${CRYPTOPP_SOURCES_DIR}/cryptopp/misc.cpp
161 ${CRYPTOPP_SOURCES_DIR}/cryptopp/modes.cpp
162 ${CRYPTOPP_SOURCES_DIR}/cryptopp/mqueue.cpp
163 ${CRYPTOPP_SOURCES_DIR}/cryptopp/mqv.cpp
164 ${CRYPTOPP_SOURCES_DIR}/cryptopp/nbtheory.cpp
165 ${CRYPTOPP_SOURCES_DIR}/cryptopp/oaep.cpp
166 ${CRYPTOPP_SOURCES_DIR}/cryptopp/osrng.cpp
167 ${CRYPTOPP_SOURCES_DIR}/cryptopp/padlkrng.cpp
168 ${CRYPTOPP_SOURCES_DIR}/cryptopp/panama.cpp
169 ${CRYPTOPP_SOURCES_DIR}/cryptopp/pch.cpp
170 ${CRYPTOPP_SOURCES_DIR}/cryptopp/pkcspad.cpp
171 ${CRYPTOPP_SOURCES_DIR}/cryptopp/poly1305.cpp
172 ${CRYPTOPP_SOURCES_DIR}/cryptopp/polynomi.cpp
173 ${CRYPTOPP_SOURCES_DIR}/cryptopp/ppc_power7.cpp
174 ${CRYPTOPP_SOURCES_DIR}/cryptopp/ppc_power8.cpp
175 ${CRYPTOPP_SOURCES_DIR}/cryptopp/ppc_power9.cpp
176 ${CRYPTOPP_SOURCES_DIR}/cryptopp/pssr.cpp
177 ${CRYPTOPP_SOURCES_DIR}/cryptopp/pubkey.cpp
178 ${CRYPTOPP_SOURCES_DIR}/cryptopp/queue.cpp
179 ${CRYPTOPP_SOURCES_DIR}/cryptopp/rabbit.cpp
180 ${CRYPTOPP_SOURCES_DIR}/cryptopp/rabin.cpp
181 ${CRYPTOPP_SOURCES_DIR}/cryptopp/randpool.cpp
182 ${CRYPTOPP_SOURCES_DIR}/cryptopp/rc2.cpp
183 ${CRYPTOPP_SOURCES_DIR}/cryptopp/rc5.cpp
184 ${CRYPTOPP_SOURCES_DIR}/cryptopp/rc6.cpp
185 ${CRYPTOPP_SOURCES_DIR}/cryptopp/rdrand.cpp
186 ${CRYPTOPP_SOURCES_DIR}/cryptopp/rdtables.cpp
187 ${CRYPTOPP_SOURCES_DIR}/cryptopp/rijndael.cpp
188 ${CRYPTOPP_SOURCES_DIR}/cryptopp/ripemd.cpp
189 ${CRYPTOPP_SOURCES_DIR}/cryptopp/rng.cpp
190 ${CRYPTOPP_SOURCES_DIR}/cryptopp/rsa.cpp
191 ${CRYPTOPP_SOURCES_DIR}/cryptopp/rw.cpp
192 ${CRYPTOPP_SOURCES_DIR}/cryptopp/safer.cpp
193 ${CRYPTOPP_SOURCES_DIR}/cryptopp/salsa.cpp
194 ${CRYPTOPP_SOURCES_DIR}/cryptopp/scrypt.cpp
195 ${CRYPTOPP_SOURCES_DIR}/cryptopp/seal.cpp
196 ${CRYPTOPP_SOURCES_DIR}/cryptopp/seed.cpp
197 ${CRYPTOPP_SOURCES_DIR}/cryptopp/serpent.cpp
198 ${CRYPTOPP_SOURCES_DIR}/cryptopp/sha.cpp
199 ${CRYPTOPP_SOURCES_DIR}/cryptopp/sha3.cpp
200 ${CRYPTOPP_SOURCES_DIR}/cryptopp/shacal2.cpp
201 ${CRYPTOPP_SOURCES_DIR}/cryptopp/shake.cpp
202 ${CRYPTOPP_SOURCES_DIR}/cryptopp/shark.cpp
203 ${CRYPTOPP_SOURCES_DIR}/cryptopp/sharkbox.cpp
204 ${CRYPTOPP_SOURCES_DIR}/cryptopp/simeck.cpp
205 ${CRYPTOPP_SOURCES_DIR}/cryptopp/simon.cpp
206 ${CRYPTOPP_SOURCES_DIR}/cryptopp/simple.cpp
207 ${CRYPTOPP_SOURCES_DIR}/cryptopp/skipjack.cpp
208 ${CRYPTOPP_SOURCES_DIR}/cryptopp/sm3.cpp
209 ${CRYPTOPP_SOURCES_DIR}/cryptopp/sm4.cpp
210 ${CRYPTOPP_SOURCES_DIR}/cryptopp/sosemanuk.cpp
211 ${CRYPTOPP_SOURCES_DIR}/cryptopp/speck.cpp
212 ${CRYPTOPP_SOURCES_DIR}/cryptopp/square.cpp
213 ${CRYPTOPP_SOURCES_DIR}/cryptopp/squaretb.cpp
214 ${CRYPTOPP_SOURCES_DIR}/cryptopp/strciphr.cpp
215 ${CRYPTOPP_SOURCES_DIR}/cryptopp/tea.cpp
216 ${CRYPTOPP_SOURCES_DIR}/cryptopp/tftables.cpp
217 ${CRYPTOPP_SOURCES_DIR}/cryptopp/threefish.cpp
218 ${CRYPTOPP_SOURCES_DIR}/cryptopp/tiger.cpp
219 ${CRYPTOPP_SOURCES_DIR}/cryptopp/tigertab.cpp
220 ${CRYPTOPP_SOURCES_DIR}/cryptopp/ttmac.cpp
221 ${CRYPTOPP_SOURCES_DIR}/cryptopp/tweetnacl.cpp
222 ${CRYPTOPP_SOURCES_DIR}/cryptopp/twofish.cpp
223 ${CRYPTOPP_SOURCES_DIR}/cryptopp/vmac.cpp
224 ${CRYPTOPP_SOURCES_DIR}/cryptopp/wake.cpp
225 ${CRYPTOPP_SOURCES_DIR}/cryptopp/whrlpool.cpp
226 ${CRYPTOPP_SOURCES_DIR}/cryptopp/xed25519.cpp
227 ${CRYPTOPP_SOURCES_DIR}/cryptopp/xtr.cpp
228 ${CRYPTOPP_SOURCES_DIR}/cryptopp/xtrcrypt.cpp
229 ${CRYPTOPP_SOURCES_DIR}/cryptopp/xts.cpp
230 ${CRYPTOPP_SOURCES_DIR}/cryptopp/zdeflate.cpp
231 ${CRYPTOPP_SOURCES_DIR}/cryptopp/zinflate.cpp
232 ${CRYPTOPP_SOURCES_DIR}/cryptopp/zlib.cpp
233 )
234
235 source_group(ThirdParty\\cryptopp REGULAR_EXPRESSION ${CRYPTOPP_SOURCES_DIR}/.*)
236
237 else()
238 ##
239 ## Inclusion of system-wide crypto++
240 ##
241 check_include_file_cxx(cryptopp/cryptlib.h HAVE_CRYPTOPP_H)
242 if (NOT HAVE_CRYPTOPP_H)
243 message(FATAL_ERROR "Please install the libcrypto++-dev package")
244 endif()
245
246 include(CheckCXXSymbolExists)
247 set(CMAKE_REQUIRED_LIBRARIES cryptopp)
248 check_cxx_symbol_exists("CryptoPP::SHA1::InitState" cryptopp/sha.h HAVE_LIBCRYPTOPP)
249 if (NOT HAVE_LIBCRYPTOPP)
250 message(FATAL_ERROR "Unable to find the cryptopp library")
251 endif()
252
253 set(CRYPTOPP_LIBRARIES cryptopp)
254 endif()