-
Notifications
You must be signed in to change notification settings - Fork 3
/
CMakeLists.txt
115 lines (98 loc) · 2.66 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
cmake_minimum_required(VERSION 3.12)
project(PPDA VERSION 3.6.0 LANGUAGES C CXX)
set(EXECUTABLE main)
set(CLIENT client)
set(SERVER server)
set(MASK mask)
set(LINEAR linear)
# Executable will be in ../bin
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PPDA_SOURCE_DIR}/bin)
set(CMAKE_CXX_STANDARD 17)
include(CheckCCompilerFlag)
function(check_c_compiler_flag_and_add flag result)
check_c_compiler_flag("${flag}" ${result})
if(${result})
add_compile_options("${flag}")
endif()
endfunction()
check_c_compiler_flag_and_add(-pedantic CC_SUPPORTS_PEDANTIC)
check_c_compiler_flag_and_add(-Wall CC_SUPPORTS_WALL)
check_c_compiler_flag_and_add(-Wextra CC_SUPPORTS_WEXTRA)
check_c_compiler_flag_and_add(-Wshadow CC_SUPPORTS_WSHADOW)
check_c_compiler_flag_and_add(-Werror=vla CC_SUPPORTS_ERRORVLA)
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING "Choose the type of build." FORCE)
endif()
set(CMP_CLIENT_PLAIN ON)
# configure keccak
add_subdirectory(keccak)
add_executable(${EXECUTABLE} main.cpp)
target_sources(${EXECUTABLE}
PRIVATE
src/Client.cpp
src/Server.cpp
src/uniformDouble.cpp
src/shake.cpp
src/circuit_priv.cpp
)
add_executable(${CLIENT} client_standalone.cpp)
if(CMP_CLIENT_PLAIN)
target_sources(${CLIENT}
PRIVATE
src/Client.cpp
src/Server.cpp # just for plain compuation
src/uniformDouble.cpp
src/shake.cpp
src/circuit_priv.cpp
)
add_definitions("-DCMP_CLIENT_PLAIN")
else()
target_sources(${CLIENT}
PRIVATE
src/Client.cpp
)
endif()
add_executable(${SERVER} server_standalone.cpp )
target_sources(${SERVER}
PRIVATE
src/Server.cpp
src/uniformDouble.cpp
src/shake.cpp
src/circuit_priv.cpp
)
add_executable(${MASK} mask_demo.cpp)
target_sources(${MASK}
PRIVATE
src/Client.cpp
src/Server.cpp
src/uniformDouble.cpp
src/shake.cpp
src/circuit_priv.cpp
)
add_executable(${LINEAR} linear.cpp)
target_sources(${LINEAR}
PRIVATE
src/Client.cpp
src/Server.cpp
src/uniformDouble.cpp
src/shake.cpp
src/circuit_priv.cpp
)
# Import Microsoft SEAL
find_package(SEAL 3.6 REQUIRED
# Optionaly providing a path so this can be built without installing SEAL
PATHS ${PPDA_SOURCE_DIR}/SEAL/build/cmake
)
target_link_libraries(${EXECUTABLE} SEAL::seal keccak)
if(CMP_CLIENT_PLAIN)
target_link_libraries(${CLIENT} SEAL::seal keccak)
else()
target_link_libraries(${CLIENT} SEAL::seal)
endif()
target_link_libraries(${SERVER} SEAL::seal keccak)
target_link_libraries(${MASK} SEAL::seal keccak)
target_link_libraries(${LINEAR} SEAL::seal keccak)
add_custom_target(run
COMMAND ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${EXECUTABLE}
DEPENDS ${EXECUTABLE}
)