generated from microsoft/ccf-app-template
-
Notifications
You must be signed in to change notification settings - Fork 6
/
CMakeLists.txt
88 lines (73 loc) · 2.22 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
# Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the
# MIT License.
cmake_minimum_required(VERSION 3.16)
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/version.cmake)
project(
lskv
LANGUAGES C CXX
VERSION ${LSKV_VERSION_SHORT})
option(
COMPILE_TARGET
"Compile target to build for, one of [virtual;sgx;snp], defaults to virtual"
virtual)
set(CCF "ccf_${COMPILE_TARGET}")
option(CCF_UNSAFE "build with unsafe options" OFF)
if(${CCF_UNSAFE})
if(${COMPILE_TARGET} STREQUAL "sgx")
message(WARNING "Building with unsafe options")
set(CCF "${CCF}_unsafe")
else()
message(
FATAL_ERROR "CCF_UNSAFE is not support for target ${COMPILE_TARGET}")
endif()
endif()
if(NOT TARGET ${CCF})
find_package(${CCF} REQUIRED)
endif()
add_subdirectory(proto)
option(PUBLIC_LEASES
"If enabled, leases are recorded in plaintext in the ledger (insecure!)"
OFF)
option(VERBOSE_LOGGING "enable verbose logging" OFF)
add_compile_definitions(LSKV_VERSION="${LSKV_VERSION}")
add_compile_definitions(CCF_LOGGER_NO_DEPRECATE)
# work around an issue in outdated protobuf from CCF
# https://github.com/protocolbuffers/protobuf/issues/10108
add_compile_definitions(GOOGLE_PROTOBUF_INTERNAL_DONATE_STEAL_INLINE=0)
add_ccf_app(
lskv
SRCS
src/app/app.cpp
src/app/kvstore.cpp
src/app/index.cpp
src/app/leases.cpp
INCLUDE_DIRS
"${CMAKE_BINARY_DIR}/proto"
"${CCF_DIR}/include/ccf/_private"
LINK_LIBS_ENCLAVE
etcd.enclave
lskvserver.enclave
status.enclave
protobuf.enclave
LINK_LIBS_VIRTUAL
etcd.virtual
lskvserver.virtual
status.virtual
protobuf.virtual
INSTALL_LIBS
ON)
if(VERBOSE_LOGGING)
message(STATUS "Using verbose logging")
add_compile_definitions(VERBOSE_LOGGING)
else()
message(STATUS "Using terse logging")
endif()
# Generate an ephemeral signing key
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/signing_key.pem
COMMAND openssl genrsa -out ${CMAKE_CURRENT_BINARY_DIR}/signing_key.pem -3
3072)
add_custom_target(app_signing_key ALL
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/signing_key.pem)
sign_app_library(lskv.enclave ${CMAKE_CURRENT_SOURCE_DIR}/oe_sign.conf
${CMAKE_CURRENT_BINARY_DIR}/signing_key.pem INSTALL_LIBS ON)