forked from ladnir/cryptoTools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
127 lines (93 loc) · 4.24 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
cmake_minimum_required (VERSION 3.15)
if (POLICY CMP0048)
cmake_policy(SET CMP0048 NEW)
endif (POLICY CMP0048)
project(cryptoTools VERSION 1.9.0)
if("${CMAKE_CURRENT_SOURCE_DIR}" STREQUAL "${CMAKE_SOURCE_DIR}")
############################################
# If top level cmake #
############################################
if(${CMAKE_VERSION} VERSION_LESS "3.12.0")
message("Please consider updating CMake to 3.12+")
endif()
# Set a default build type for single-configuration
# CMake generators if no build type is set.
if(NOT CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_BUILD_TYPE)
SET(CMAKE_BUILD_TYPE Release)
endif()
if(MSVC)
# optionally add the following to CMAKE_PREFIX_PATH
if(NOT DEFINED CMAKE_PREFIX_PATH AND NOT DEFINED NO_OC_DEFAULT_PREFIX)
set(CMAKE_PREFIX_PATH
"c:/libs"
"${CMAKE_CURRENT_SOURCE_DIR}/.."
)
endif()
else()
# Select flags.
set(CMAKE_C_FLAGS "-Wall -Wfatal-errors")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_C_FLAGS}")
SET(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG")
SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO " -O2 -g -ggdb")
SET(CMAKE_CXX_FLAGS_DEBUG "-O0 -g -ggdb")
endif()
endif()
macro(EVAL var)
if(${ARGN})
set(${var} ON)
else()
set(${var} OFF)
endif()
endmacro()
#############################################
# CONFIGURE #
#############################################
option(ENABLE_SPAN_LITE "use the span-lite library" ON)
option(ENABLE_RELIC "use the relic library" OFF)
option(ENABLE_SODIUM "use libsodium" OFF)
option(ENABLE_CIRCUITS "compile the circuit module" OFF)
option(ENABLE_NET_LOG "compile with network logging" OFF)
option(ENABLE_WOLFSSL "conpiler with WolfSSL enabled" OFF)
option(ENABLE_SSE "compile with SSE instrctions" ON)
option(ENABLE_BOOST "compile with BOOST networing integration" ON)
option(FETCH_AUTO "automaticly download and build dependancies" OFF)
#option(FETCH_SPAN_LITE "download and build span" OFF))
EVAL(FETCH_SPAN_LITE_IMPL
(DEFINED FETCH_SPAN_LITE AND FETCH_SPAN_LITE) OR
((NOT DEFINED FETCH_SPAN_LITE) AND (FETCH_AUTO AND ENABLE_SPAN_LITE)))
#option(FETCH_RELIC "download and build Relic" OFF))
EVAL(FETCH_RELIC_IMPL
(DEFINED FETCH_RELIC AND FETCH_RELIC) OR
((NOT DEFINED FETCH_RELIC) AND (FETCH_AUTO AND ENABLE_RELIC)))
#option(FETCH_SODIUM "download and build Sodium" OFF))
EVAL(FETCH_SODIUM_IMPL
(DEFINED FETCH_SODIUM AND FETCH_SODIUM) OR
((NOT DEFINED FETCH_SODIUM) AND (FETCH_AUTO AND ENABLE_SODIUM)))
#option(FETCH_SODIUM "download and build Boost" OFF))
EVAL(FETCH_BOOST_IMPL
(DEFINED FETCH_BOOST AND FETCH_BOOST) OR
((NOT DEFINED FETCH_BOOST) AND (FETCH_AUTO AND ENABLE_BOOST)))
message(STATUS "cryptoTools options\n=======================================================")
message(STATUS "Option: FETCH_AUTO = ${FETCH_AUTO}")
message(STATUS "Option: FETCH_SPAN_LITE = ${FETCH_SPAN_LITE}")
message(STATUS "Option: FETCH_RELIC = ${FETCH_RELIC}")
message(STATUS "Option: FETCH_SODIUM = ${FETCH_SODIUM}")
message(STATUS "Option: FETCH_BOOST = ${FETCH_BOOST}\n")
message(STATUS "Option: CMAKE_BUILD_TYPE = ${CMAKE_BUILD_TYPE}\n\tRelease\n\tDebug\n\tRelWithDebInfo")
message(STATUS "Option: ENABLE_SPAN_LITE = ${ENABLE_SPAN_LITE}")
message(STATUS "Option: ENABLE_RELIC = ${ENABLE_RELIC}")
message(STATUS "Option: ENABLE_SODIUM = ${ENABLE_SODIUM}")
message(STATUS "Option: ENABLE_BOOST = ${ENABLE_BOOST}\n")
message(STATUS "Option: ENABLE_CIRCUITS = ${ENABLE_CIRCUITS}")
message(STATUS "Option: ENABLE_NET_LOG = ${ENABLE_NET_LOG}")
message(STATUS "Option: ENABLE_WOLFSSL = ${ENABLE_WOLFSSL}")
message(STATUS "Option: ENABLE_SSE = ${ENABLE_SSE}\n\n")
#############################################
# cryptoTools, tests, frontend #
#############################################
include("${CMAKE_CURRENT_LIST_DIR}/cmake/cryptoToolsDepHelper.cmake")
add_subdirectory(cryptoTools)
add_subdirectory(tests_cryptoTools)
add_subdirectory(frontend_cryptoTools)
configure_file(cryptoTools/Common/config.h.in "cryptoTools/Common/config.h" )
include("cmake/install.cmake")