-
Notifications
You must be signed in to change notification settings - Fork 3
/
CMakeLists.txt
98 lines (70 loc) · 3.23 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
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 -DGSL_UNENFORCED_ON_CONTRACT_VIOLATION")
SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO " -O2 -g -ggdb")
SET(CMAKE_CXX_FLAGS_DEBUG "-O0 -g -ggdb")
endif()
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION_RELEASE TRUE)
endif()
#############################################
# CONFIGURE #
#############################################
option(ENABLE_RELIC "use the relic library" OFF)
option(ENABLE_SODIUM "use libsodium" OFF)
option(ENABLE_CIRCUITS "compile the circuit module" OFF)
option(ENABLE_CPP_14 "compile with the c++14" ON)
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_AVX "compile with AVX instrctions" ON)
option(ENABLE_BOOST "compile with BOOST networing integration" ON)
set(ENABLE_FULL_GSL ${ENABLE_CPP_14})
message(STATUS "cryptoTools options\n=======================================================")
message(STATUS "Option: CMAKE_BUILD_TYPE = ${CMAKE_BUILD_TYPE}\n\tRelease\n\tDebug\n\tRelWithDebInfo")
message(STATUS "Option: ENABLE_RELIC = ${ENABLE_RELIC}")
message(STATUS "Option: ENABLE_SODIUM = ${ENABLE_SODIUM}")
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}")
message(STATUS "Option: ENABLE_AVX = ${ENABLE_AVX}")
message(STATUS "Option: ENABLE_BOOST = ${ENABLE_BOOST}\n\n")
if(NOT ENABLE_CPP_14)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-narrowing")
endif()
#############################################
# 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")