-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
CMakeLists.txt
108 lines (87 loc) · 2.35 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
cmake_minimum_required( VERSION 3.10.2 )
project(PyZPK)
# The set instruction sets environment variables
# Note: If this environment variable already exist in the cache, it is shadowed by the set value here
# We use the value CACHE in order to keep the value cached (and avoid shadowing)
set(
CURVE # Variable name
"ALT_BN128" # Variable value
CACHE
STRING
"Default curve: one of ALT_BN128, BN128, EDWARDS, MNT4, MNT6"
)
set(
DEPENDS_DIR
"${CMAKE_CURRENT_SOURCE_DIR}/third_party"
CACHE
STRING
"Optionally specify the dependency installation directory relative to the source directory (default: inside dependency folder)"
)
set(
OPT_FLAGS
""
CACHE
STRING
"Override C++ compiler optimization flags"
)
option(
MULTICORE
"Enable parallelized execution, using OpenMP"
OFF
)
option(
WITH_PROCPS
"Use procps for memory profiling"
ON
)
option(
VERBOSE
"Print internal messages"
ON
)
option(
DEBUG
"Enable debugging mode"
OFF
)
option(
CPPDEBUG
"Enable debugging of C++ STL (does not imply DEBUG)"
ON
)
if(CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
# Common compilation flags and warning configuration
# The CMAKE_CXX_FLAGS variable allows to change the compiler settings
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -Wextra -Wfatal-errors -pthread")
if("${MULTICORE}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fopenmp")
endif()
# Default optimizations flags (to override, use -DOPT_FLAGS=...)
if("${OPT_FLAGS}" STREQUAL "")
set(OPT_FLAGS "-ggdb3 -O2 -march=native -mtune=native")
endif()
endif()
# add_definitions() and remove_definitions() allow to modify the preprocessor settings
add_definitions(-DCURVE_${CURVE})
if(${CURVE} STREQUAL "BN128")
add_definitions(-DBN_SUPPORT_SNARK=1)
endif()
if("${VERBOSE}")
add_definitions(-DVERBOSE=1)
endif()
if("${MULTICORE}")
add_definitions(-DMULTICORE=1)
endif()
add_definitions(-DDEBUG=1)
if("${CPPDEBUG}")
add_definitions(-D_GLIBCXX_DEBUG -D_GLIBCXX_DEBUG_PEDANTIC)
endif()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OPT_FLAGS}")
include(FindPkgConfig)
if("${WITH_PROCPS}")
pkg_check_modules(PROCPS REQUIRED libprocps)
else()
add_definitions(-DNO_PROCPS)
endif()
add_subdirectory(third_party)
add_subdirectory(src)