-
Notifications
You must be signed in to change notification settings - Fork 24
/
Copy pathCMakeLists.txt
46 lines (36 loc) · 1.06 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
cmake_minimum_required(VERSION 3.0)
project(Town-Crier)
# build options
option(BUILD_TESTS "build tc-test target" on)
option(CMAKE_BUILD_TYPE "(Debug|Prerelease|Release)" Debug)
# only support x64
set(SGX_ARCH x64)
# set SDK path
if (DEFINED ENV{SGX_SDK})
set(SGX_SDK $ENV{SGX_SDK})
else()
set(SGX_SDK /opt/intel/sgxsdk)
endif()
include(cmake/Init.cmake)
IF(CMAKE_BUILD_TYPE MATCHES Debug)
set(SGX_MODE SIM)
set(SGX_BUILD DEBUG)
ELSEIF(CMAKE_BUILD_TYPE MATCHES Prerelease)
set(SGX_MODE HW)
set(SGX_BUILD PRERELEASE)
ELSEIF(CMAKE_BUILD_TYPE MATCHES Release)
set(SGX_MODE HW)
set(SGX_BUILD RELEASE)
ELSE()
message(FATAL_ERROR "unknown build type ${CMAKE_BUILD_TYPE}")
ENDIF()
include(cmake/ConfigSGX.cmake)
set(TC_ROOT_DIR ${CMAKE_SOURCE_DIR}/src)
set(MBEDTLS_LIB_DIR ${TC_ROOT_DIR}/Enclave/mbedtls-SGX)
# check cmake configuration
message(STATUS "Building ${CMAKE_BUILD_TYPE} with CFLAGS ${CMAKE_C_FLAGS}")
add_subdirectory(src/App)
add_subdirectory(src/Enclave)
if(BUILD_TESTS)
add_subdirectory(src/vendor/gtest)
endif(BUILD_TESTS)