fn main() { //println!("cargo:rerun-if-env-changed=CARGO_CFG_TARGET_ENV"); #[cfg(feature = "occlum")] { let target = std::env::var("CARGO_CFG_TARGET_ENV").unwrap_or_default(); let dcap_lib_path = match target.as_str() { "musl" => "/opt/occlum/toolchains/dcap_lib/musl", _ => "/opt/occlum/toolchains/dcap_lib/glibc", // gnu, msvc, sgx... }; // Doesn't use standard C library, safe to compile with both musl and glibc //println!("cargo:rustc-link-search=/opt/intel/sgxsdk/lib64"); //println!("cargo:rustc-link-lib=sgx_tservice"); //println!("cargo:rustc-link-lib=sgx_tcrypto"); //println!("cargo:rustc-link-lib=sgx_trts"); //println!("cargo:rustc-link-lib=sgx_pthread"); //println!("cargo:rustc-link-lib=sgx_tstdc"); // Cargo will look for `libocclum_dcap.a` println!("cargo:rustc-link-search={}", dcap_lib_path); println!("cargo:rustc-link-lib=occlum_dcap"); // println!("cargo:rustc-link-lib=static:+whole-archive=occlum_dcap"); } #[cfg(feature = "tonic")] tonic_build::configure() .build_server(true) .compile_protos(&["examples/echo.proto"], &["examples"]) .unwrap_or_else(|e| panic!("Failed to compile protos {:?}", e)); }