## Add denpendencies ``` //Cargo.toml [build-dependencies] ... ohos_ndk_env = { version = "*" } ``` ## Use crate ```rust // build.rs extern ohos_ndk_env fn main() { ohos_ndk_env::setup_ohos_ndk_env(); let mut build = cc::Build::new(); build.file("src/hello.c"); build.compile("hello"); println!("cargo:rerun-if-changed=src/hello.c"); ... } ``` ## Build `OHOS_NDK_HOME="/path/to/ohos-sdk/linux" cargo +nightly build`