forked from NilFoundation/crypto3-block
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
508 lines (425 loc) · 21.4 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
#---------------------------------------------------------------------------#
# Copyright (c) 2018-2020 Mikhail Komarov <[email protected]>
#
# Distributed under the Boost Software License, Version 1.0
# See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt
#---------------------------------------------------------------------------#
cmake_minimum_required(VERSION 3.12.4)
cmake_policy(SET CMP0028 NEW)
cmake_policy(SET CMP0042 NEW)
cmake_policy(SET CMP0048 NEW)
cmake_policy(SET CMP0057 NEW)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake"
"${CMAKE_CURRENT_LIST_DIR}/cmake/packages"
"${CMAKE_CURRENT_LIST_DIR}/cmake/modules/share/modules/cmake")
include(CMConfig)
include(CMDeploy)
include(CMSetupVersion)
if(NOT CMAKE_WORKSPACE_NAME OR NOT ("${CMAKE_WORKSPACE_NAME}" STREQUAL "crypto3"))
cm_workspace(crypto3)
endif()
cm_project(block WORKSPACE_NAME ${CMAKE_WORKSPACE_NAME} LANGUAGES C CXX)
if((NOT Boost_CONTAINER_FOUND OR NOT Boost_FOUND) AND NOT CMAKE_CROSSCOMPILING)
find_package(Boost COMPONENTS REQUIRED container)
endif()
include(TargetArchitecture)
include(TargetConfiguration)
include(PlatformConfiguration)
include(CheckSSE)
include(CheckAVX)
option(${CMAKE_UPPER_WORKSPACE_NAME}_${CURRENT_UPPER_PROJECT_NAME}_AES
"Build with AES block encryption support" TRUE)
option(${CMAKE_UPPER_WORKSPACE_NAME}_${CURRENT_UPPER_PROJECT_NAME}_ARIA
"Build with ARIA block encryption support" TRUE)
option(${CMAKE_UPPER_WORKSPACE_NAME}_${CURRENT_UPPER_PROJECT_NAME}_BLOWFISH
"Build with Blowfish block encryption support" TRUE)
option(${CMAKE_UPPER_WORKSPACE_NAME}_${CURRENT_UPPER_PROJECT_NAME}_CAMELLIA
"Build with Camellia block encryption support" TRUE)
option(${CMAKE_UPPER_WORKSPACE_NAME}_${CURRENT_UPPER_PROJECT_NAME}_CAST
"Build with Cast block encryption support" TRUE)
option(${CMAKE_UPPER_WORKSPACE_NAME}_${CURRENT_UPPER_PROJECT_NAME}_DES
"Build with DES block encryption support" TRUE)
option(${CMAKE_UPPER_WORKSPACE_NAME}_${CURRENT_UPPER_PROJECT_NAME}_GOST_28147_89
"Build with GOST.28147.89 block encryption support" TRUE)
option(${CMAKE_UPPER_WORKSPACE_NAME}_${CURRENT_UPPER_PROJECT_NAME}_IDEA
"Build with IDEA block encryption support" TRUE)
option(${CMAKE_UPPER_WORKSPACE_NAME}_${CURRENT_UPPER_PROJECT_NAME}_KASUMI
"Build with Kasumi block encryption support" TRUE)
option(${CMAKE_UPPER_WORKSPACE_NAME}_${CURRENT_UPPER_PROJECT_NAME}_MD4
"Build with MD4 block encryption support" TRUE)
option(${CMAKE_UPPER_WORKSPACE_NAME}_${CURRENT_UPPER_PROJECT_NAME}_MD5
"Build with MD5 block encryption support" TRUE)
option(${CMAKE_UPPER_WORKSPACE_NAME}_${CURRENT_UPPER_PROJECT_NAME}_MISTY1
"Build with Misty1 block encryption support" TRUE)
option(${CMAKE_UPPER_WORKSPACE_NAME}_${CURRENT_UPPER_PROJECT_NAME}_NOEKEON
"Build with Noekeon block encryption support" TRUE)
option(${CMAKE_UPPER_WORKSPACE_NAME}_${CURRENT_UPPER_PROJECT_NAME}_NOEKEON_SIMD
"Build with Noekeon block encryption through SMID instruction set support" TRUE)
option(${CMAKE_UPPER_WORKSPACE_NAME}_${CURRENT_UPPER_PROJECT_NAME}_SEED
"Build with Seed block encryption support" TRUE)
option(${CMAKE_UPPER_WORKSPACE_NAME}_${CURRENT_UPPER_PROJECT_NAME}_SERPENT
"Build with Serpent block encryption support" TRUE)
option(${CMAKE_UPPER_WORKSPACE_NAME}_${CURRENT_UPPER_PROJECT_NAME}_SHACAL2
"Build with Shacal2 block encryption support" TRUE)
option(${CMAKE_UPPER_WORKSPACE_NAME}_${CURRENT_UPPER_PROJECT_NAME}_SM4
"Build with SM4 block encryption support" TRUE)
option(${CMAKE_UPPER_WORKSPACE_NAME}_${CURRENT_UPPER_PROJECT_NAME}_TWOFISH
"Build with Twofish block encryption support" TRUE)
option(${CMAKE_UPPER_WORKSPACE_NAME}_${CURRENT_UPPER_PROJECT_NAME}_THREEFISH
"Build with Threefish block encryption support" TRUE)
option(${CMAKE_UPPER_WORKSPACE_NAME}_${CURRENT_UPPER_PROJECT_NAME}_XTEA
"Build with XTEA block encryption support" TRUE)
set(BUILD_WITH_TARGET_ARCHITECTURE "" CACHE STRING "Target build architecture")
if(BUILD_WITH_TARGET_ARCHITECTURE)
set(CMAKE_TARGET_ARCHITECTURE ${BUILD_WITH_TARGET_ARCHITECTURE})
else()
target_architecture(CMAKE_TARGET_ARCHITECTURE)
endif()
define_target_architecture(${CMAKE_UPPER_WORKSPACE_NAME} ${CMAKE_TARGET_ARCHITECTURE})
define_target_endianness(${CMAKE_UPPER_WORKSPACE_NAME} ${CMAKE_TARGET_ARCHITECTURE})
define_target_platform_features(${CMAKE_UPPER_WORKSPACE_NAME})
check_sse()
check_avx()
set(BUILD_WITH_CONFIGURATION_FILE_DIR "${CMAKE_CURRENT_LIST_DIR}/cmake" CACHE STRING "Directory for build.hpp lookup")
list(APPEND ${CURRENT_PROJECT_NAME}_PUBLIC_HEADERS
include/nil/crypto3/block/algorithm/encrypt.hpp
include/nil/crypto3/block/algorithm/decrypt.hpp
include/nil/crypto3/block/algorithm/move.hpp
include/nil/crypto3/block/algorithm/copy_n_if.hpp
include/nil/crypto3/block/cipher.hpp
include/nil/crypto3/block/cipher_state.hpp
include/nil/crypto3/block/cipher_value.hpp
include/nil/crypto3/block/detail/stream_endian.hpp
include/nil/crypto3/block/detail/pack.hpp
include/nil/crypto3/block/detail/digest.hpp
include/nil/crypto3/block/detail/exploder.hpp
include/nil/crypto3/block/detail/imploder.hpp
include/nil/crypto3/block/detail/state_adder.hpp
include/nil/crypto3/block/detail/unbounded_shift.hpp)
list(APPEND ${CURRENT_PROJECT_NAME}_UNGROUPED_SOURCES)
if(${CMAKE_UPPER_WORKSPACE_NAME}_${CURRENT_UPPER_PROJECT_NAME}_AES)
list(APPEND ${CURRENT_PROJECT_NAME}_RIJNDAEL_HEADERS
include/nil/crypto3/block/rijndael.hpp
include/nil/crypto3/block/detail/rijndael/rijndael_functions.hpp
include/nil/crypto3/block/detail/rijndael/rijndael_impl.hpp
include/nil/crypto3/block/detail/rijndael/rijndael_policy.hpp)
add_definitions(-D${CMAKE_UPPER_WORKSPACE_NAME}_HAS_RIJNDAEL)
if(("x86_64" IN_LIST CMAKE_TARGET_ARCHITECTURE) OR ("x86" IN_LIST CMAKE_TARGET_ARCHITECTUREß))
if(SSE2_FOUND)
list(APPEND ${CURRENT_PROJECT_NAME}_RIJNDAEL_HEADERS
include/nil/crypto3/block/detail/rijndael/rijndael_ni_impl.hpp)
elseif(SSSE3_FOUND)
list(APPEND ${CURRENT_PROJECT_NAME}_RIJNDAEL_HEADERS
include/nil/crypto3/block/detail/rijndael/rijndael_ssse3_impl.hpp)
endif()
elseif("armv8" IN_LIST CMAKE_TARGET_ARCHITECTURE OR "arm64" IN_LIST CMAKE_TARGET_ARCHITECTURE)
list(APPEND ${CURRENT_PROJECT_NAME}_RIJNDAEL_HEADERS
include/nil/crypto3/block/detail/rijndael/rijndael_armv8_impl.hpp)
add_definitions(-D${CMAKE_UPPER_WORKSPACE_NAME}_HAS_RIJNDAEL_ARMV8)
elseif("ppc64" IN_LIST CMAKE_TARGET_ARCHITECTURE)
add_definitions(-D${CMAKE_UPPER_WORKSPACE_NAME}_HAS_RIJNDAEL_POWER8)
list(APPEND ${CURRENT_PROJECT_NAME}_RIJNDAEL_HEADERS
include/nil/crypto3/block/detail/rijndael/rijndael_power8_impl.hpp)
endif()
list(APPEND ${CURRENT_PROJECT_NAME}_PUBLIC_HEADERS
${${CURRENT_PROJECT_NAME}_RIJNDAEL_HEADERS}
)
list(APPEND ${CURRENT_PROJECT_NAME}_SOURCES
${${CURRENT_PROJECT_NAME}_RIJNDAEL_SOURCES})
endif()
if(${CMAKE_UPPER_WORKSPACE_NAME}_${CURRENT_UPPER_PROJECT_NAME}_ARIA)
list(APPEND ${CURRENT_PROJECT_NAME}_ARIA_HEADERS
include/nil/crypto3/block/aria.hpp
include/nil/crypto3/block/detail/aria/aria_functions.hpp
include/nil/crypto3/block/detail/aria/aria_policy.hpp)
list(APPEND ${CURRENT_PROJECT_NAME}_ARIA_SOURCES
)
add_definitions(-D${CMAKE_UPPER_WORKSPACE_NAME}_HAS_ARIA)
list(APPEND ${CURRENT_PROJECT_NAME}_PUBLIC_HEADERS
${${CURRENT_PROJECT_NAME}_ARIA_HEADERS}
)
list(APPEND ${CURRENT_PROJECT_NAME}_SOURCES
${${CURRENT_PROJECT_NAME}_ARIA_SOURCES}
)
endif()
if(${CMAKE_UPPER_WORKSPACE_NAME}_${CURRENT_UPPER_PROJECT_NAME}_BLOWFISH)
list(APPEND ${CURRENT_PROJECT_NAME}_BLOWFISH_HEADERS
include/nil/crypto3/block/blowfish.hpp
include/nil/crypto3/block/detail/blowfish/blowfish_functions.hpp
include/nil/crypto3/block/detail/blowfish/blowfish_policy.hpp
)
add_definitions(-D${CMAKE_UPPER_WORKSPACE_NAME}_HAS_BLOWFISH)
list(APPEND ${CURRENT_PROJECT_NAME}_PUBLIC_HEADERS
${${CURRENT_PROJECT_NAME}_BLOWFISH_HEADERS}
)
list(APPEND ${CURRENT_PROJECT_NAME}_SOURCES
${${CURRENT_PROJECT_NAME}_BLOWFISH_SOURCES}
)
endif()
if(${CMAKE_UPPER_WORKSPACE_NAME}_${CURRENT_UPPER_PROJECT_NAME}_CAMELLIA)
list(APPEND ${CURRENT_PROJECT_NAME}_CAMELLIA_HEADERS
include/nil/crypto3/block/camellia.hpp
include/nil/crypto3/block/detail/camellia/camellia_functions.hpp
include/nil/crypto3/block/detail/camellia/camellia_policy.hpp
include/nil/crypto3/block/detail/camellia/basic_camellia_policy.hpp
)
add_definitions(-D${CMAKE_UPPER_WORKSPACE_NAME}_HAS_CAMELLIA)
list(APPEND ${CURRENT_PROJECT_NAME}_PUBLIC_HEADERS
${${CURRENT_PROJECT_NAME}_CAMELLIA_HEADERS}
)
list(APPEND ${CURRENT_PROJECT_NAME}_SOURCES
${${CURRENT_PROJECT_NAME}_CAMELLIA_SOURCES}
)
endif()
if(${CMAKE_UPPER_WORKSPACE_NAME}_${CURRENT_UPPER_PROJECT_NAME}_CAST128)
list(APPEND ${CURRENT_PROJECT_NAME}_CAST_PUBLIC_HEADERS
include/nil/crypto3/block/cast.hpp
include/nil/crypto3/block/detail/cast/cast_functions.hpp
include/nil/crypto3/block/detail/cast/basic_cast_policy.hpp
include/nil/crypto3/block/detail/cast/cast_policy.hpp
)
add_definitions(-D${CMAKE_UPPER_WORKSPACE_NAME}_HAS_CAST -D${CMAKE_UPPER_WORKSPACE_NAME}_HAS_CAST_128
-D${CMAKE_UPPER_WORKSPACE_NAME}_HAS_CAST_256)
list(APPEND ${CURRENT_PROJECT_NAME}_PUBLIC_HEADERS
${${CURRENT_PROJECT_NAME}_CAST_PUBLIC_HEADERS}
)
list(APPEND ${CURRENT_PROJECT_NAME}_PRIVATE_HEADERS
${${CURRENT_PROJECT_NAME}_CAST_PRIVATE_HEADERS}
)
list(APPEND ${CURRENT_PROJECT_NAME}_SOURCES
${${CURRENT_PROJECT_NAME}_CAST_SOURCES}
)
endif()
if(${CMAKE_UPPER_WORKSPACE_NAME}_${CURRENT_UPPER_PROJECT_NAME}_DES)
list(APPEND ${CURRENT_PROJECT_NAME}_DES_HEADERS
include/nil/crypto3/block/des.hpp
include/nil/crypto3/block/detail/des/des_functions.hpp
include/nil/crypto3/block/detail/des/basic_des_policy.hpp
include/nil/crypto3/block/detail/des/des_policy.hpp
)
add_definitions(-D${CMAKE_UPPER_WORKSPACE_NAME}_HAS_DES)
list(APPEND ${CURRENT_PROJECT_NAME}_PUBLIC_HEADERS
${${CURRENT_PROJECT_NAME}_DES_HEADERS}
)
list(APPEND ${CURRENT_PROJECT_NAME}_SOURCES
${${CURRENT_PROJECT_NAME}_DES_SOURCES}
)
endif()
if(${CMAKE_UPPER_WORKSPACE_NAME}_${CURRENT_UPPER_PROJECT_NAME}_GOST_28147_89)
list(APPEND ${CURRENT_PROJECT_NAME}_GOST_28147_89_HEADERS
include/nil/crypto3/block/gost28147.hpp
include/nil/crypto3/block/detail/gost_28147_89/gost_28147_89_functions.hpp
include/nil/crypto3/block/detail/gost_28147_89/gost_28147_89_policy.hpp
include/nil/crypto3/block/detail/gost_28147_89/gost_28147_89_parameters.hpp
)
add_definitions(-D${CMAKE_UPPER_WORKSPACE_NAME}_HAS_GOST_28147_89)
list(APPEND ${CURRENT_PROJECT_NAME}_PUBLIC_HEADERS
${${CURRENT_PROJECT_NAME}_GOST_28147_89_HEADERS}
)
list(APPEND ${CURRENT_PROJECT_NAME}_SOURCES
${${CURRENT_PROJECT_NAME}_GOST_28147_89_SOURCES}
)
endif()
if(${CMAKE_UPPER_WORKSPACE_NAME}_${CURRENT_UPPER_PROJECT_NAME}_IDEA)
list(APPEND ${CURRENT_PROJECT_NAME}_IDEA_HEADERS
include/nil/crypto3/block/idea.hpp
include/nil/crypto3/block/detail/idea/idea_functions.hpp
include/nil/crypto3/block/detail/idea/idea_policy.hpp
)
add_definitions(-D${CMAKE_UPPER_WORKSPACE_NAME}_HAS_IDEA)
list(APPEND ${CURRENT_PROJECT_NAME}_PUBLIC_HEADERS
${${CURRENT_PROJECT_NAME}_IDEA_HEADERS}
)
list(APPEND ${CURRENT_PROJECT_NAME}_SOURCES
${${CURRENT_PROJECT_NAME}_IDEA_SOURCES}
)
endif()
if(${CMAKE_UPPER_WORKSPACE_NAME}_${CURRENT_UPPER_PROJECT_NAME}_KASUMI)
list(APPEND ${CURRENT_PROJECT_NAME}_KASUMI_HEADERS
include/nil/crypto3/block/kasumi.hpp
include/nil/crypto3/block/detail/kasumi/kasumi_functions.hpp
include/nil/crypto3/block/detail/kasumi/kasumi_policy.hpp
)
add_definitions(-D${CMAKE_UPPER_WORKSPACE_NAME}_HAS_KASUMI)
list(APPEND ${CURRENT_PROJECT_NAME}_PUBLIC_HEADERS
${${CURRENT_PROJECT_NAME}_KASUMI_HEADERS}
)
list(APPEND ${CURRENT_PROJECT_NAME}_SOURCES
${${CURRENT_PROJECT_NAME}_KASUMI_SOURCES}
)
endif()
if(${CMAKE_UPPER_WORKSPACE_NAME}_${CURRENT_UPPER_PROJECT_NAME}_MISTY1)
list(APPEND ${CURRENT_PROJECT_NAME}_MISTY1_HEADERS
include/nil/crypto3/block/misty1.hpp
include/nil/crypto3/block/detail/misty1/misty1_functions.hpp
include/nil/crypto3/block/detail/misty1/misty1_policy.hpp
)
add_definitions(-D${CMAKE_UPPER_WORKSPACE_NAME}_HAS_MISTY1)
list(APPEND ${CURRENT_PROJECT_NAME}_PUBLIC_HEADERS
${${CURRENT_PROJECT_NAME}_MISTY1_HEADERS}
)
list(APPEND ${CURRENT_PROJECT_NAME}_SOURCES
${${CURRENT_PROJECT_NAME}_MISTY1_SOURCES}
)
endif()
if(${CMAKE_UPPER_WORKSPACE_NAME}_${CURRENT_UPPER_PROJECT_NAME}_MD4)
list(APPEND ${CURRENT_PROJECT_NAME}_MD4_HEADERS
include/nil/crypto3/block/md4.hpp
)
add_definitions(-D${CMAKE_UPPER_WORKSPACE_NAME}_HAS_MD4)
list(APPEND ${CURRENT_PROJECT_NAME}_PUBLIC_HEADERS
${${CURRENT_PROJECT_NAME}_MD4_HEADERS}
)
endif()
if(${CMAKE_UPPER_WORKSPACE_NAME}_${CURRENT_UPPER_PROJECT_NAME}_MD5)
list(APPEND ${CURRENT_PROJECT_NAME}_MD5_HEADERS
include/nil/crypto3/block/md5.hpp
)
add_definitions(-D${CMAKE_UPPER_WORKSPACE_NAME}_HAS_MD5)
list(APPEND ${CURRENT_PROJECT_NAME}_PUBLIC_HEADERS
${${CURRENT_PROJECT_NAME}_MD5_HEADERS}
)
endif()
if(${CMAKE_UPPER_WORKSPACE_NAME}_${CURRENT_UPPER_PROJECT_NAME}_NOEKEON)
list(APPEND ${CURRENT_PROJECT_NAME}_NOEKEON_HEADERS
include/nil/crypto3/block/noekeon.hpp
include/nil/crypto3/block/detail/noekeon/noekeon_functions.hpp
include/nil/crypto3/block/detail/noekeon/noekeon_policy.hpp
)
add_definitions(-D${CMAKE_UPPER_WORKSPACE_NAME}_HAS_NOEKEON)
list(APPEND ${CURRENT_PROJECT_NAME}_PUBLIC_HEADERS
${${CURRENT_PROJECT_NAME}_NOEKEON_HEADERS}
)
list(APPEND ${CURRENT_PROJECT_NAME}_SOURCES
${${CURRENT_PROJECT_NAME}_NOEKEON_SOURCES}
)
endif()
if(${CMAKE_UPPER_WORKSPACE_NAME}_${CURRENT_UPPER_PROJECT_NAME}_SEED)
list(APPEND ${CURRENT_PROJECT_NAME}_SEED_HEADERS
include/nil/crypto3/block/seed.hpp
include/nil/crypto3/block/detail/seed/seed_functions.hpp
include/nil/crypto3/block/detail/seed/seed_policy.hpp
)
add_definitions(-D${CMAKE_UPPER_WORKSPACE_NAME}_HAS_SEED)
list(APPEND ${CURRENT_PROJECT_NAME}_PUBLIC_HEADERS
${${CURRENT_PROJECT_NAME}_SEED_HEADERS}
)
list(APPEND ${CURRENT_PROJECT_NAME}_SOURCES
${${CURRENT_PROJECT_NAME}_SEED_SOURCES}
)
endif()
if(${CMAKE_UPPER_WORKSPACE_NAME}_${CURRENT_UPPER_PROJECT_NAME}_SERPENT)
list(APPEND ${CURRENT_PROJECT_NAME}_PUBLIC_SERPENT_HEADERS
include/nil/crypto3/block/serpent.hpp
include/nil/crypto3/block/detail/serpent/serpent_policy.hpp
include/nil/crypto3/block/detail/serpent/serpent_functions.hpp
)
add_definitions(-D${CMAKE_UPPER_WORKSPACE_NAME}_HAS_SERPENT)
list(APPEND ${CURRENT_PROJECT_NAME}_PUBLIC_HEADERS
${${CURRENT_PROJECT_NAME}_PUBLIC_SERPENT_HEADERS}
)
list(APPEND ${CURRENT_PROJECT_NAME}_PRIVATE_HEADERS
${${CURRENT_PROJECT_NAME}_PRIVATE_SERPENT_HEADERS})
list(APPEND ${CURRENT_PROJECT_NAME}_SOURCES
${${CURRENT_PROJECT_NAME}_SERPENT_SOURCES})
endif()
if(${CMAKE_UPPER_WORKSPACE_NAME}_${CURRENT_UPPER_PROJECT_NAME}_SHACAL2)
list(APPEND ${CURRENT_PROJECT_NAME}_PUBLIC_SHACAL2_HEADERS
include/nil/crypto3/block/basic_shacal.hpp
include/nil/crypto3/block/shacal.hpp
include/nil/crypto3/block/shacal1.hpp
include/nil/crypto3/block/shacal2.hpp
include/nil/crypto3/block/detail/shacal/shacal_policy.hpp
include/nil/crypto3/block/detail/shacal/shacal_functions.hpp
include/nil/crypto3/block/detail/shacal/shacal1_policy.hpp
include/nil/crypto3/block/detail/shacal/shacal2_policy.hpp)
list(APPEND ${CURRENT_PROJECT_NAME}_SHACAL2_SOURCES)
add_definitions(-D${CMAKE_UPPER_WORKSPACE_NAME}_HAS_SHACAL2)
list(APPEND ${CURRENT_PROJECT_NAME}_PUBLIC_HEADERS
${${CURRENT_PROJECT_NAME}_PUBLIC_SHACAL2_HEADERS})
list(APPEND ${CURRENT_PROJECT_NAME}_SOURCES
${${CURRENT_PROJECT_NAME}_SHACAL2_SOURCES})
endif()
if(${CMAKE_UPPER_WORKSPACE_NAME}_${CURRENT_UPPER_PROJECT_NAME}_SM4)
list(APPEND ${CURRENT_PROJECT_NAME}_PUBLIC_SM4_HEADERS
include/nil/crypto3/block/detail/sm4/sm4_functions.hpp
include/nil/crypto3/block/detail/sm4/sm4_policy.hpp
include/nil/crypto3/block/sm4.hpp)
add_definitions(-D${CMAKE_UPPER_WORKSPACE_NAME}_HAS_SM4)
list(APPEND ${CURRENT_PROJECT_NAME}_PUBLIC_HEADERS
${${CURRENT_PROJECT_NAME}_PUBLIC_SM4_HEADERS})
list(APPEND ${CURRENT_PROJECT_NAME}_SOURCES
${${CURRENT_PROJECT_NAME}_SM4_SOURCES})
endif()
if(${CMAKE_UPPER_WORKSPACE_NAME}_${CURRENT_UPPER_PROJECT_NAME}_THREEFISH)
list(APPEND ${CURRENT_PROJECT_NAME}_THREEFISH_HEADERS
include/nil/crypto3/block/threefish.hpp
include/nil/crypto3/block/detail/threefish/threefish_policy.hpp)
list(APPEND ${CURRENT_PROJECT_NAME}_THREEFISH_SOURCES)
add_definitions(-D${CMAKE_UPPER_WORKSPACE_NAME}_HAS_THREEFISH)
list(APPEND ${CURRENT_PROJECT_NAME}_PUBLIC_HEADERS
${${CURRENT_PROJECT_NAME}_THREEFISH_HEADERS})
list(APPEND ${CURRENT_PROJECT_NAME}_SOURCES
${${CURRENT_PROJECT_NAME}_THREEFISH_SOURCES})
endif()
if(${CMAKE_UPPER_WORKSPACE_NAME}_${CURRENT_UPPER_PROJECT_NAME}_TWOFISH)
list(APPEND ${CURRENT_PROJECT_NAME}_TWOFISH_HEADERS
include/nil/crypto3/block/twofish.hpp
include/nil/crypto3/block/detail/twofish/basic_twofish_policy.hpp
include/nil/crypto3/block/detail/twofish/twofish_policy.hpp
include/nil/crypto3/block/detail/twofish/twofish_functions.hpp)
add_definitions(-D${CMAKE_UPPER_WORKSPACE_NAME}_HAS_TWOFISH)
list(APPEND ${CURRENT_PROJECT_NAME}_PUBLIC_HEADERS
${${CURRENT_PROJECT_NAME}_TWOFISH_HEADERS})
list(APPEND ${CURRENT_PROJECT_NAME}_SOURCES
${${CURRENT_PROJECT_NAME}_TWOFISH_SOURCES})
endif()
if(${CMAKE_UPPER_WORKSPACE_NAME}_${CURRENT_UPPER_PROJECT_NAME}_XTEA)
list(APPEND ${CURRENT_PROJECT_NAME}_XTEA_HEADERS
include/nil/crypto3/block/xtea.hpp
include/nil/crypto3/block/detail/xtea/xtea_functions.hpp
include/nil/crypto3/block/detail/xtea/xtea_policy.hpp)
add_definitions(-D${CMAKE_UPPER_WORKSPACE_NAME}_HAS_XTEA)
list(APPEND ${CURRENT_PROJECT_NAME}_PUBLIC_HEADERS
${${CURRENT_PROJECT_NAME}_XTEA_HEADERS})
list(APPEND ${CURRENT_PROJECT_NAME}_SOURCES
${${CURRENT_PROJECT_NAME}_XTEA_SOURCES})
endif()
list(APPEND ${CURRENT_PROJECT_NAME}_HEADERS
${${CURRENT_PROJECT_NAME}_PUBLIC_HEADERS}
${${CURRENT_PROJECT_NAME}_PRIVATE_HEADERS})
list(APPEND ${CURRENT_PROJECT_NAME}_SOURCES
${${CURRENT_PROJECT_NAME}_UNGROUPED_SOURCES})
cm_setup_version(VERSION 0.1.0 PREFIX ${CMAKE_WORKSPACE_NAME}_${CURRENT_PROJECT_NAME})
add_library(${CMAKE_WORKSPACE_NAME}_${CURRENT_PROJECT_NAME} INTERFACE)
set_target_properties(${CMAKE_WORKSPACE_NAME}_${CURRENT_PROJECT_NAME} PROPERTIES
EXPORT_NAME ${CURRENT_PROJECT_NAME})
if("x86_64" IN_LIST CMAKE_TARGET_ARCHITECTURE OR "x86" IN_LIST CMAKE_TARGET_ARCHITECTURE)
if(SSE2_FOUND)
target_compile_definitions(${CMAKE_WORKSPACE_NAME}_${CURRENT_PROJECT_NAME} INTERFACE
"${CMAKE_UPPER_WORKSPACE_NAME}_HAS_RIJNDAEL_NI")
target_compile_options(${CMAKE_WORKSPACE_NAME}_${CURRENT_PROJECT_NAME} INTERFACE "-maes;-mpclmul;-mssse3")
elseif(SSSE3_FOUND)
target_compile_definitions(${CMAKE_WORKSPACE_NAME}_${CURRENT_PROJECT_NAME} INTERFACE
"${CMAKE_UPPER_WORKSPACE_NAME}_HAS_RIJNDAEL_SSSE3")
target_compile_options(${CMAKE_WORKSPACE_NAME}_${CURRENT_PROJECT_NAME} INTERFACE "-maes;-mpclmul;-mssse3")
endif()
elseif("armv8" IN_LIST CMAKE_TARGET_ARCHITECTURE OR "arm64" IN_LIST CMAKE_TARGET_ARCHITECTURE)
target_compile_definitions(${CMAKE_WORKSPACE_NAME}_${CURRENT_PROJECT_NAME} INTERFACE
"${CMAKE_UPPER_WORKSPACE_NAME}_HAS_RIJNDAEL_ARMV8")
elseif("ppc64" IN_LIST CMAKE_TARGET_ARCHITECTURE)
target_compile_definitions(${CMAKE_WORKSPACE_NAME}_${CURRENT_PROJECT_NAME} INTERFACE
"${CMAKE_UPPER_WORKSPACE_NAME}_HAS_RIJNDAEL_POWER8")
endif()
target_link_libraries(${CMAKE_WORKSPACE_NAME}_${CURRENT_PROJECT_NAME} INTERFACE
${Boost_LIBRARIES})
target_include_directories(${CMAKE_WORKSPACE_NAME}_${CURRENT_PROJECT_NAME} INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/include>
${Boost_INCLUDE_DIRS})
cm_deploy(TARGETS ${CMAKE_WORKSPACE_NAME}_${CURRENT_PROJECT_NAME}
INCLUDE include
NAMESPACE ${CMAKE_WORKSPACE_NAME}::)
include(CMTest)
cm_add_test_subdirectory(test)