permalink |
---|
/docs/build-system |
The Teaclave's build system utilizes CMake to coordinate compilation, linking, signing, etc. for various components written in different languages (e.g., Rust, C, Python) for different targets (e.g., Linux and SGX). In this document, we will introduce our build system in details.
$ mkdir build && cd build
TEST_MODE
on.$ cmake -DTEST_MODE=ON ..
$ make
When making changes, run:
make format
: Format current source code.make run-tests
: Make sure all tests are passed.You can find more detailed configurations and targets in the following sections.
There are a lot of variables and options you can configure to control the build system.
To set a variable or option, you can pass -DXXX=
to cmake
. For example,
cmake -DTEST_MODE=ON ..
to enable the TEST_MODE
option.
SGX_SDK
: Set (or get from env vars) the path of Intel SGX SDK. Defaults to
/opt/sgxsdk
.RUSTFLAGS
: Set (or get from env vars) flags passed to rustc.MESAPY_VERSION
: Set the commit hash to the upstream MesaPy version.RUSTUP_TOOLCHAIN
: Set the Rust toolchain version.CMAKE_BUILD_TYPE
: Set the build type. Defaults to debug.COV
: Build with coverage information. Defaults to OFF.OFFLINE
: Compile Rust code with cargo --offline
. Defaults to ON.TEST_MODE
: Build with mock data and disabling some functions for testing.
Defaults to OFF.SGX_SIM_MODE
: Build in SGX simulation mode. Defaults to OFF.DCAP
: Use DCAP instead of IAS as the attestation service. Defaults to OFF.GIT_SUBMODULE
: Sync submodules with the upstream repositories. Defaults to
ON.CLP
: Enable cargo clippy
to lint Rust code during the compilation.
Defaults to OFF.DOC
: Generate document with cargo doc
during the compilation. Defaults to OFF.USE_PREBUILT_MESAPY
: Whether to use the prebuilt MesaPy for SGX library. If
set to OFF, will build the library from the source code. Defaults to ON.The followings are supported targets you can call with make
. For example, to build a specific
service like execution service, you can just run make teaclave_execution_service
.
An SGX application has two parts: the app part and the enclave part. You can compile them separately or together using with these targets:
sgxapp-teaclave_{service_name}
: Build the app part of a service.sgxlib-teaclave_{service_name}
: Build the enclave part of a service.teaclave_{service_name}
: Build (compile, link and sign, etc.) the app and
enclave of a service.sgxapp-teaclave_{test_name}
: Build the app part of a test driver.sgxlib-teaclave_{test_name}
: Build the enclave part of a test driver.teaclave_{test_name}
: Build (compile, link, and sign, etc.) the app and
enclave of a test driver.These targets are automatically generated from the
cmake/tomls/Cargo.sgx_{}.toml
files. Basically, they are:
test_name
can be: function_tests
, unit_tests
, integration_tests
, etc.service_name
can be: access_control_service
, authentication_service
,
storage_service
, execution_service
, frontend_service
,
management_service
, scheduler_service
, etc.Build Teaclave client SDK and install the compiled dynamic/static libraries to the release folder.
teaclave_client_sdk
: Build the client SDK to both dynamic and static
libraries.teaclave_cli
: Build the Teclave command line tool.teaclave_dcap_ref_as
: Build the reference implementation of DCAP's
attestation service.teaclave_sgx_tool
: Build the SGX tool.Above targets are automatically generated from the
cmake/tomls/Cargo.unix_app.toml
files.
format
: Format all code.clippy
: Run cargo clippy
for linting. Same with make CLP=1
.doc
: Run cargo doc
to generate documents. Same with make DOC=1
.run-tests
: Run all test cases.run-integration-tests
: Run integration tests only.run-funtional-tests
: Run functional tests only.run-sdk-tests
: Run tests of client SDK only.run-examples
: Run all examples.cov
: Aggregate coverage results and generate report, needs to config cmake
with -DCOV=ON
.clean
: Cleanup all building intermediates.You can find source code to learn more about our build system in the
CMakeLists.txt
file and the cmake
directories.
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。