cxx and bindgen tests

Issue: https://gitee.com/openharmony/third_party_rust_cxx/issues/I717LF
Signed-off-by: xxlight <xiaoxiaoliang2@huawei.com>
Change-Id: I46fefbe0979305aca135968cf200598ceb7b8f92
This commit is contained in:
xxlight 2023-05-08 14:13:54 +08:00
parent 8662694c64
commit 9908d7bdae
2 changed files with 1 additions and 21 deletions

View File

@ -24,10 +24,7 @@ ohos_cargo_crate("lib") {
cargo_pkg_authors = "David Tolnay <dtolnay@gmail.com>" cargo_pkg_authors = "David Tolnay <dtolnay@gmail.com>"
cargo_pkg_name = "cxx" cargo_pkg_name = "cxx"
cargo_pkg_description = "Safe interop between Rust and C++" cargo_pkg_description = "Safe interop between Rust and C++"
deps = [ deps = [ "//third_party/rust/crates/cxx/macro:lib(${host_toolchain})" ]
"//third_party/rust/crates/cxx/macro:lib(${host_toolchain})",
"//third_party/rust/crates/link-cplusplus:lib",
]
features = [ features = [
"alloc", "alloc",
"std", "std",

View File

@ -3,23 +3,6 @@ use std::path::Path;
use std::process::Command; use std::process::Command;
fn main() { fn main() {
cc::Build::new()
.file("src/cxx.cc")
.cpp(true)
.cpp_link_stdlib(None) // linked via link-cplusplus crate
.flag_if_supported(cxxbridge_flags::STD)
.warnings_into_errors(cfg!(deny_warnings))
.compile("cxxbridge1");
println!("cargo:rerun-if-changed=src/cxx.cc");
println!("cargo:rerun-if-changed=include/cxx.h");
println!("cargo:rustc-cfg=built_with_cargo");
if let Some(manifest_dir) = env::var_os("CARGO_MANIFEST_DIR") {
let cxx_h = Path::new(&manifest_dir).join("include").join("cxx.h");
println!("cargo:HEADER={}", cxx_h.to_string_lossy());
}
if let Some(rustc) = rustc_version() { if let Some(rustc) = rustc_version() {
if rustc.minor < 60 { if rustc.minor < 60 {
println!("cargo:warning=The cxx crate requires a rustc version 1.60.0 or newer."); println!("cargo:warning=The cxx crate requires a rustc version 1.60.0 or newer.");