This repository has been archived by the owner on Jan 3, 2023. It is now read-only.
forked from esonghori/TinyGarble
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
90 lines (76 loc) · 2.14 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
cmake_minimum_required (VERSION 3.1.0 FATAL_ERROR)
project (TinyGarble
VERSION 3.0.0
LANGUAGES CXX)
##############
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "4.6.3")
message(FATAL_ERROR "Insufficient gcc version, should be at least 4.6.3")
endif()
endif()
#############
enable_testing()
include_directories (${CMAKE_CURRENT_SOURCE_DIR})
include_directories(${PROJECT_BINARY_DIR})
##############
# build type
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Debug)
endif()
if (CMAKE_BUILD_TYPE MATCHES Debug)
message("Debug build.")
elseif (CMAKE_BUILD_TYPE MATCHES Release)
message("Release build.")
else()
message("Some other build type.")
endif ()
###############
# Compiler flags
set(CMAKE_CXX_FLAGS
"${CMAKE_CXX_FLAGS} -Wall -Wno-strict-aliasing -march=native")
# set -lrt for minunit testing lib.
if (UNIX)
set(CMAKE_CXX_STANDARD_LIBRARIES "-lrt -lpthread -ldl")
endif (UNIX)
set (CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O0 -g -DDEBUG")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3 -DNDEBUG")
###############
# Library
## Boost
set (Boost_USE_STATIC_LIBS OFF)
set (Boost_USE_MULTITHREADED ON)
set (Boost_USE_STATIC_RUNTIME OFF)
find_package (Boost 1.45.0
REQUIRED
COMPONENTS program_options)
if (Boost_FOUND)
include_directories (${Boost_INCLUDE_DIRS})
endif (Boost_FOUND)
## OpenSSL
find_package (OpenSSL)
if (OPENSSL_FOUND)
include_directories (${OPENSSL_INCLUDE_DIR})
endif (OPENSSL_FOUND)
###############
# Options
option (ENABLE_DUMP "Enable dump hex feature" OFF)
option (ENABLE_LOG "Enable log feature" OFF)
if (CMAKE_BUILD_TYPE MATCHES Debug)
message("Turn Log on.")
SET(ENABLE_LOG ON BOOL "Turn on logs in debug mode.")
endif (CMAKE_BUILD_TYPE MATCHES Debug)
# configure a header file to pass some of the CMake settings
# to the source code
configure_file (
"util/tinygarble_config.h.in"
"util/tinygarble_config.h")
###############
# Subdirectory
add_subdirectory ("a23")
add_subdirectory ("crypto")
add_subdirectory ("garbled_circuit")
add_subdirectory ("scd")
add_subdirectory ("tcpip")
add_subdirectory ("util")
add_subdirectory(library)