-
Notifications
You must be signed in to change notification settings - Fork 30
/
CMakeLists.txt
122 lines (111 loc) · 5.59 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
cmake_minimum_required(VERSION 3.9)
project(ascon LANGUAGES C ASM)
enable_testing()
# set the default version
set(DEFAULT_VERSIONS v12)
# default to all Ascon algorithms:
set(DEFAULT_ALGS ascon128 ascon128a ascon80pq
asconhash asconhasha asconxof asconxofa
asconmac asconmaca asconprf asconprfa asconprfs
ascon128bi32 ascon128abi32 asconhashbi32 asconhashabi32
ascon ascona asconabi32 asconbi32)
# default to all C implementations:
set(DEFAULT_IMPLS ref opt64 opt64_lowsize opt32 opt32_lowsize bi32 bi32_lowsize bi32_lowreg esp32 opt8 opt8_lowsize bi8)
# default flags, tests {genkat, getcycles}, emulator {"qemu-arm;-L;/usr/arm-linux-gnueabi", "sde;--"}
set(DEFAULT_COMPILE_DEFS)
set(DEFAULT_TESTS genkat)
set(DEFAULT_EMULATOR)
if(MSVC)
set(DEFAULT_REL_FLAGS /O2)
set(DEFAULT_DBG_FLAGS /Od)
else()
set(DEFAULT_REL_FLAGS -std=c99 -O2 -fomit-frame-pointer -march=native -mtune=native)
set(DEFAULT_DBG_FLAGS -std=c99 -O2 -Wall -Wextra -Wshadow)
endif()
if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.13.0" AND NOT WIN32 AND NOT CYGWIN AND NOT MSYS)
# use sanitizers in default Debug build (not on windows and only of target_link_option is available)
set(DEFAULT_DBG_FLAGS ${DEFAULT_DBG_FLAGS} -fsanitize=address,undefined)
endif()
# set cmake variables for version, algorithms, implementations, tests, flags, defs
set(VERSION_LIST ${DEFAULT_VERSIONS} CACHE STRING "Choose the ascon versions to include.")
set(ALG_LIST ${DEFAULT_ALGS} CACHE STRING "Choose the list of algorithms to include.")
set(IMPL_LIST ${DEFAULT_IMPLS} CACHE STRING "Choose the list of implementations to include.")
set(TEST_LIST ${DEFAULT_TESTS} CACHE STRING "Choose the list of tests to include.")
set(REL_FLAGS ${DEFAULT_REL_FLAGS} CACHE STRING "Define custom Release (performance) flags.")
set(DBG_FLAGS ${DEFAULT_DBG_FLAGS} CACHE STRING "Define custom Debug (NIST) flags.")
set(COMPILE_DEFS ${DEFAULT_COMPILE_DEFS} CACHE STRING "Define custom compile definitions.")