-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
60 lines (46 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
cmake_minimum_required(VERSION 3.10)
enable_language(C CXX ASM)
# check if SDK has been built and KEYSTONE_SDK_DIR environment variable exists
if (NOT DEFINED ENV{KEYSTONE_SDK_DIR})
message(FATAL_ERROR "Please set KEYSTONE_SDK_DIR environment variable to an installed SDK path")
endif()
set(KEYSTONE_SDK_DIR $ENV{KEYSTONE_SDK_DIR})
if (NOT DEFINED ENV{MBEDTLS_DIR_EAPP})
message(FATAL_ERROR "Please set MBEDTLS_DIR_EAPP")
endif()
set(MBEDTLS_DIR_EAPP $ENV{MBEDTLS_DIR_EAPP})
if (NOT DEFINED ENV{MBEDTLS_DIR_HOST})
message(FATAL_ERROR "Please set MBEDTLS_DIR_HOST")
endif()
set(MBEDTLS_DIR_HOST $ENV{MBEDTLS_DIR_HOST})
include($ENV{KEYSTONE_SDK_DIR}/cmake/macros.cmake)
if(RISCV32)
message(STATUS "riscv32")
set(BITS 32)
else()
message(STATUS "riscv64")
set(BITS 64)
endif()
use_riscv_toolchain(${BITS})
# export include directory
include_directories(include
${KEYSTONE_SDK_DIR}/include
${KEYSTONE_SDK_DIR}/include/host
${KEYSTONE_SDK_DIR}/include/edge
${KEYSTONE_SDK_DIR}/include/verifier)
# set paths to the libraries
set(KEYSTONE_LIB_HOST ${KEYSTONE_SDK_DIR}/lib/libkeystone-host.a)
set(KEYSTONE_LIB_EDGE ${KEYSTONE_SDK_DIR}/lib/libkeystone-edge.a)
set(KEYSTONE_LIB_VERIFIER ${KEYSTONE_SDK_DIR}/lib/libkeystone-verifier.a)
set(KEYSTONE_LIB_EAPP ${KEYSTONE_SDK_DIR}/lib/libkeystone-eapp.a)
set(MBEDTLS_LIB_CRYPTO_EAPP ${MBEDTLS_DIR_EAPP}/build/library/libmbedcrypto.a)
set(MBEDTLS_LIB_TLS_EAPP ${MBEDTLS_DIR_EAPP}/build/library/libmbedtls.a)
set(MBEDTLS_LIB_X509_EAPP ${MBEDTLS_DIR_EAPP}/build/library/libmbedx509.a)
set(MBEDTLS_LIB_CRYPTO_HOST ${MBEDTLS_DIR_HOST}/build/library/libmbedcrypto.a)
set(MBEDTLS_LIB_TLS_HOST ${MBEDTLS_DIR_HOST}/build/library/libmbedtls.a)
set(MBEDTLS_LIB_X509_HOST ${MBEDTLS_DIR_HOST}/build/library/libmbedx509.a)
# find program "makeself"
find_program(MAKESELF makeself)
# enclave
add_subdirectory(client)
add_subdirectory(hello)