feature gated occlum library and tonic build config

This commit is contained in:
Noor 2024-10-08 13:50:39 +00:00 committed by Valentyn Faychuk
parent 418e1b9dbf
commit b535df88d5

@ -1,13 +1,17 @@
fn main() {
// TODO: make this conditional on occlum feature
// TODO: should be conditional on the target platform (musl vs glibc)
println!("cargo:rustc-link-search=/opt/occlum/toolchains/dcap_lib/musl");
// Cargo will automatically know it must look for `libocclum_dcap.a`
println!("cargo:rustc-link-lib=occlum_dcap");
// TODO: make this conditional if compiling grpcs examples
#[cfg(feature = "occlum")]
{
println!("cargo:rustc-link-search=/opt/occlum/toolchains/dcap_lib/musl");
println!("cargo:rustc-link-lib=occlum_dcap");
}
// Cargo will automatically know it must look for `libocclum_dcap.a`
#[cfg(feature = "tonic")]
tonic_build::configure()
.build_server(true)
.compile(&["examples/echo.proto"], &["examples"])
.compile_protos(&["examples/echo.proto"], &["examples"])
.unwrap_or_else(|e| panic!("Failed to compile protos {:?}", e));
}