-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
81 lines (67 loc) · 1.85 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
cmake_minimum_required(VERSION 3.13)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON) # for SonarLint
set(PROJECT_NAME
PocketHHE
)
set(SOURCE_DIR
src
)
set(PROJECT_SOURCE
${SOURCE_DIR}/main.cpp
${SOURCE_DIR}/examples/pktnn_examples.cpp
${SOURCE_DIR}/examples/hhe_pktnn_examples.cpp
# ${SOURCE_DIR}/examples/quantization.cpp
${SOURCE_DIR}/util/sealhelper.cpp
${SOURCE_DIR}/util/pastahelper.cpp
${SOURCE_DIR}/util/utils.cpp
${SOURCE_DIR}/pasta/pasta_3_plain.cpp
${SOURCE_DIR}/pasta/pasta_3_seal.cpp
${SOURCE_DIR}/pasta/SEAL_Cipher.cpp
configs/config.cpp
tests/ecg_tests.cpp
tests/mnist_tests.cpp
)
set(LIBRARIES_DIR
libs
)
set(LIBRARIES
pocketnn
aes
keccak
)
project(${PROJECT_NAME})
find_package(SEAL 4.0 REQUIRED)
# for AES code
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()
if(MSVC)
add_definitions("-DOC_ENABLE_SSE2")
message("-- Enabling SSE2 for AES")
add_definitions("-DOC_ENABLE_AESNI")
message("-- Enabling AES_NI")
else()
check_c_compiler_flag_and_add(-msse2 CC_SUPPORTS_SSE2)
if(CC_SUPPORTS_SSE2)
add_definitions("-DOC_ENABLE_SSE2")
message("-- Enabling SSE2 for AES")
endif()
check_c_compiler_flag_and_add(-maes CC_SUPPORTS_AES)
if(CC_SUPPORTS_AES)
add_definitions("-DOC_ENABLE_AESNI")
message("-- Enabling AES_NI")
else()
add_definitions("-DOC_ENABLE_PORTABLE_AES")
endif()
endif()
add_executable(${PROJECT_NAME} ${PROJECT_SOURCE})
foreach(LIBRARY ${LIBRARIES})
add_subdirectory("${LIBRARIES_DIR}/${LIBRARY}")
message(STATUS "Libraries included: ${LIBRARIES_DIR}/${LIBRARY}")
endforeach(LIBRARY)
target_link_libraries(${PROJECT_NAME} ${LIBRARIES})
target_link_libraries(${PROJECT_NAME} SEAL::seal)