Crates.io | ohos_ndk_env |
lib.rs | ohos_ndk_env |
version | 0.1.4 |
source | src |
created_at | 2024-02-27 05:05:42.659022 |
updated_at | 2024-02-27 14:17:54.990219 |
description | set ohos build env for cc |
homepage | |
repository | |
max_upload_size | |
id | 1154533 |
size | 4,056 |
//Cargo.toml
[build-dependencies]
...
ohos_ndk_env = { version = "*" }
// 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");
...
}
OHOS_NDK_HOME="/path/to/ohos-sdk/linux" cargo +nightly build