forked from yamanalab/latency-aware-cnn-inference
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
82 lines (72 loc) · 1.78 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
cmake_minimum_required(VERSION 3.15)
project(seal-experiment VERSION 1.0.0 LANGUAGES CXX)
find_package(OpenMP REQUIRED)
find_package(SEAL 3.6 REQUIRED)
if(OpenMP_FOUND)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
endif()
function(setup_property TARGETS)
message("Setup")
foreach(target IN LISTS TARGETS)
message("Setting ${target}...")
set_target_properties("${target}"
PROPERTIES
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/bin"
)
target_compile_features("${target}" PUBLIC cxx_std_17)
target_compile_options("${target}"
PUBLIC
-Wall
$<$<CONFIG:Debug>:-O0 -g3> # -D CMAKE_BUILD_TYPE=Debug
$<$<CONFIG:Release>:-O3> # -D CMAKE_BUILD_TYPE=Release
$<$<CONFIG:MinSizeRel>:-Os> # -D CMAKE_BUILD_TYPE=MinSizeRel
$<$<CONFIG:RelWithDebInfo>:-O3 -g3> # -D CMAKE_BUILD_TYPE=RelWithDebInfo
)
target_link_options("${target}" PUBLIC -Wall)
target_include_directories("${target}"
PRIVATE ${CMAKE_SOURCE_DIR}/src
PRIVATE ${CMAKE_SOURCE_DIR}/include
)
endforeach()
endfunction()
file(GLOB common_sources src/utils/*.cpp)
add_executable(gen_keys
src/gen_keys.cpp
${common_sources}
)
add_executable(example
src/example.cpp
${common_sources}
)
add_executable(network_sample
src/network_sample.cpp
${common_sources}
)
add_executable(main
src/main.cpp
${common_sources}
)
target_link_libraries(gen_keys
SEAL::seal
stdc++fs
)
target_link_libraries(example
SEAL::seal
)
target_link_libraries(network_sample
SEAL::seal
cnn
)
target_link_libraries(main
SEAL::seal
cnn
)
add_subdirectory(src/cnn)
set(TARGETS
gen_keys
example
network_sample
main
)
setup_property("${TARGETS}")