#ohos #build #cc #env

ohos_ndk_env

set ohos build env for cc

5 releases

0.1.4 Feb 27, 2024
0.1.3 Feb 27, 2024
0.1.2 Feb 27, 2024
0.1.1 Feb 27, 2024
0.1.0 Feb 27, 2024

#3 in #ohos

Download history 4/week @ 2024-09-21

66 downloads per month

MIT license

3KB

Add denpendencies

//Cargo.toml

[build-dependencies]
...
ohos_ndk_env = { version = "*" }

Use crate

// 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

No runtime deps