-
Notifications
You must be signed in to change notification settings - Fork 132
/
CMakeLists.txt
69 lines (58 loc) · 2.6 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
cmake_minimum_required(VERSION 3.12)
project(ABY LANGUAGES CXX)
if (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 8.0)
message(FATAL_ERROR "ABY requires at least g++-8")
endif()
option(ABY_BUILD_EXE "Build executables" OFF)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")
# Set build type to `Release` if non was specified:
# (cf. https://gitlab.kitware.com/cmake/community/wikis/FAQ#how-can-i-change-the-default-build-mode-and-see-it-reflected-in-the-gui)
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release CACHE STRING
"Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel."
FORCE)
endif(NOT CMAKE_BUILD_TYPE)
# Write built executables and libraries to bin/ and lib/, respectively.
if(NOT CMAKE_RUNTIME_OUTPUT_DIRECTORY)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/bin")
endif()
if(NOT CMAKE_LIBRARY_OUTPUT_DIRECTORY)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/lib")
endif()
if(NOT CMAKE_ARCHIVE_OUTPUT_DIRECTORY)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/lib")
endif()
find_package(ENCRYPTO_utils QUIET)
if(ENCRYPTO_utils_FOUND)
message(STATUS "Found ENCRYPTO_utils")
elseif(NOT ENCRYPTO_utils_FOUND AND NOT TARGET ENCRYPTO_utils::encrypto_utils)
message("ENCRYPTO_utils was not found: add ENCRYPTO_utils subdirectory")
if(NOT EXISTS "${PROJECT_SOURCE_DIR}/extern/ENCRYPTO_utils/CMakeLists.txt")
find_package(Git REQUIRED)
message("initialize Git submodule: extern/ENCRYPTO_utils")
execute_process(COMMAND git submodule update --init extern/ENCRYPTO_utils
WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}")
endif()
add_subdirectory(extern/ENCRYPTO_utils)
endif()
find_package(OTExtension QUIET)
if(OTExtension_FOUND)
message(STATUS "Found OTExtension")
elseif (NOT OTExtension_FOUND AND NOT TARGET OTExtension::otextension)
message("OTExtension was not found: add OTExtension subdirectory")
if(NOT EXISTS "${PROJECT_SOURCE_DIR}/extern/OTExtension/CMakeLists.txt")
find_package(Git REQUIRED)
message("initialize Git submodule: extern/OTExtension")
execute_process(COMMAND git submodule update --init extern/OTExtension
WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}")
endif()
add_subdirectory(extern/OTExtension)
endif()
find_package(GMP REQUIRED)
find_package(Threads REQUIRED)
find_package(Boost 1.66.0 REQUIRED COMPONENTS thread system)
add_subdirectory(src/abycore)
if(ABY_BUILD_EXE)
add_subdirectory(src/test)
add_subdirectory(src/examples)
endif(ABY_BUILD_EXE)