forked from openenclave/openenclave
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
47 lines (36 loc) · 1.28 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
# Copyright (c) Open Enclave SDK contributors.
# Licensed under the MIT License.
cmake_minimum_required(VERSION 3.11)
if (NOT UNIX)
message(FATAL "oeapkman is currently supported only on Linux.")
endif ()
project("OEAPKMAN Sample" LANGUAGES C)
# Currently the `OpenEnclave` package depends on `project()`.
find_package(OpenEnclave CONFIG REQUIRED)
set(OE_CRYPTO_LIB
mbedtls
CACHE STRING "Crypto library used by enclaves.")
add_subdirectory(enclave)
add_subdirectory(host)
# Generate key
add_custom_command(
OUTPUT private.pem public.pem
COMMAND openssl genrsa -out private.pem -3 3072
COMMAND openssl rsa -in private.pem -pubout -out public.pem)
# Sign enclave
add_custom_command(
OUTPUT enclave/enclave.signed
DEPENDS enclave enclave/sqlite.conf private.pem
COMMAND openenclave::oesign sign -e $<TARGET_FILE:enclave> -c
${CMAKE_SOURCE_DIR}/enclave/sqlite.conf -k private.pem)
add_custom_target(sign ALL DEPENDS enclave/enclave.signed)
if ((NOT DEFINED ENV{OE_SIMULATION}) OR (NOT $ENV{OE_SIMULATION}))
add_custom_target(
run
DEPENDS sqlite_host sign
COMMAND sqlite_host ${CMAKE_BINARY_DIR}/enclave/enclave.signed)
endif ()
add_custom_target(
simulate
DEPENDS sqlite_host sign
COMMAND sqlite_host ${CMAKE_BINARY_DIR}/enclave/enclave.signed --simulate)