1 Star 0 Fork 3

lsjhw/rats-tls

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
CMakeLists.txt 3.44 KB
一键复制 编辑 原始数据 按行查看 历史
lsjhw 提交于 2024-06-13 17:18 +08:00 . add virtcca instance
# CMake version
cmake_minimum_required(VERSION 3.5.1)
# Project
project(rats-tls)
set(RTLS_LIB rats_tls)
set(RTLS_SRC_PATH ${CMAKE_CURRENT_LIST_DIR})
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
# Software version
file(STRINGS "VERSION" RATS_TLS_VERSION)
set(VERSION ${RATS_TLS_VERSION})
string(REPLACE "." ";" VERSION_LIST ${RATS_TLS_VERSION})
list(GET VERSION_LIST 0 VERSION_MAJOR)
list(GET VERSION_LIST 1 VERSION_MINOR)
list(GET VERSION_LIST 2 VERSION_PATCH)
# Build options
option(BUILD_SAMPLES "Compile sample code along with libraries" ON)
option(SGX_HW "Run SGX on hardware, OFF for simulation" ON)
option(SGX_LVI_MITIGATION "Mitigation flag, default on" ON)
option(BUILD_FUZZ "Use lib-fuzzer to fuzz the code, default OFF" OFF)
# Define build mode
set(RATS_TLS_BUILD_MODE "host"
CACHE STRING "Select build mode for rats-tls(normal|occlum|sgx|virtcca)")
# Print build mode
message(STATUS "Build Mode: ${RATS_TLS_BUILD_MODE}")
# CMake modules path
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
# Bulid mode macro
# normal: NORMAL
# occlum: OCCLUM
# sgx: SGX
# tdx: TDX
# virtcca: VirtCCA
if(RATS_TLS_BUILD_MODE STREQUAL "host")
set(HOST 1)
add_definitions(-DHOST)
elseif(RATS_TLS_BUILD_MODE STREQUAL "occlum")
set(OCCLUM 1)
add_definitions(-DOCCLUM)
elseif(RATS_TLS_BUILD_MODE STREQUAL "sgx")
include(FindSGX)
if(NOT SGX_FOUND)
message(FATAL_ERROR "Not found intel sgx sdk !")
else()
message(STATUS "Found intel sgx sdk.")
endif()
set(SGX 1)
add_definitions(-DSGX)
elseif(RATS_TLS_BUILD_MODE STREQUAL "tdx")
set(TDX 1)
add_definitions(-DTDX)
elseif(RATS_TLS_BUILD_MODE STREQUAL "virtcca")
set(VIRTCCA 1)
add_definitions(-DVIRTCCA)
else()
message(FATAL_ERROR "Invalid build mode!")
endif()
# Default build type
set(RATS_TLS_BUILD_TYPE "debug"
CACHE STRING "Select build type for rats-tls(debug|prerelease|release)"
)
# Print build type
message(STATUS "Build Type: ${RATS_TLS_BUILD_TYPE}")
# Build type macro
# debug: DEBUG
# prerelease: PRERELEASE
# release: RELEASE
if(RATS_TLS_BUILD_TYPE STREQUAL "debug")
set(DEBUG 1)
set(SGX_DEBUG 1)
elseif(RATS_TLS_BUILD_TYPE STREQUAL "prerelease")
set(PRERELEASE 1)
set(SGX_PRERELEASE 1)
elseif(RATS_TLS_BUILD_TYPE STREQUAL "release")
set(RELEASE 1)
set(SGX_RELEASE 1)
else()
message(FATAL_ERROR "Invalid build type!")
endif()
set(RATS_TLS_INSTALL_PATH_DEFAULT "/usr/lib/rats-tls")
# Define install path
set(RATS_TLS_INSTALL_PATH "${RATS_TLS_INSTALL_PATH_DEFAULT}" CACHE STRING
"Absoluate path to install the .so and .h")
# Define sample path
set(RATS_TLS_INSTALL_BIN_PATH "/usr/share/rats-tls/samples" CACHE STRING
"Absoluate path to install the sample bin")
# Include custom modules
include(CustomInstallDirs)
include(CompilerOptions)
if(SGX)
include(SGXCommon)
include(SGXSSL)
include(LibCBOR)
endif()
# Subdirectory
add_subdirectory(src)
if(BUILD_SAMPLES)
message(STATUS "Build Samples: on")
add_subdirectory(samples)
endif()
if(BUILD_FUZZ)
message(STATUS "Build Fuzz: on")
add_subdirectory(fuzz)
endif()
# Uninstall target
if(NOT TARGET uninstall)
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/CMakeUninstall.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
IMMEDIATE @ONLY)
add_custom_target(uninstall
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
endif()
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/lsjhw/rats-tls.git
git@gitee.com:lsjhw/rats-tls.git
lsjhw
rats-tls
rats-tls
master

搜索帮助