From f88c7d28ae48ed2ca34f1ef99ff9eb4a0086de9a Mon Sep 17 00:00:00 2001 From: wangmeng Date: Thu, 20 Nov 2025 17:01:11 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=BC=BA=E5=A4=B1=E7=9A=84?= =?UTF-8?q?=E4=BE=9D=E8=B5=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: wangmeng --- BUILD.gn | 7 ++----- build.rs | 17 ----------------- 2 files changed, 2 insertions(+), 22 deletions(-) diff --git a/BUILD.gn b/BUILD.gn index dbfebea0..55858d22 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -24,10 +24,7 @@ ohos_cargo_crate("lib") { cargo_pkg_authors = "David Tolnay " cargo_pkg_name = "cxx" cargo_pkg_description = "Safe interop between Rust and C++" - deps = [ - "//third_party/rust/crates/cxx/macro:macro_lib(${host_toolchain})", - ":cxx_cppdeps" - ] + deps = [ "//third_party/rust/crates/cxx/macro:macro_lib(${host_toolchain})" ] features = [ "alloc", "std", @@ -51,7 +48,7 @@ ohos_static_library("cxx_cppdeps") { "//third_party/rust/crates/cxx/include/cxx.h", "//third_party/rust/crates/cxx/src/cxx.cc", ] - deps = [] + deps = [ "//third_party/rust/crates/cxx:lib" ] if (is_win) { defines += [ "CXX_RS_EXPORT=__declspec(dllexport)" ] } else { diff --git a/build.rs b/build.rs index 12f056c0..4112006a 100644 --- a/build.rs +++ b/build.rs @@ -9,23 +9,6 @@ fn main() { let manifest_dir_opt = env::var_os("CARGO_MANIFEST_DIR").map(PathBuf::from); let manifest_dir = manifest_dir_opt.as_deref().unwrap_or(Path::new("")); - cc::Build::new() - .file(manifest_dir.join("src/cxx.cc")) - .cpp(true) - .cpp_link_stdlib(None) // linked via link-cplusplus crate - .std(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) = &manifest_dir_opt { - let cxx_h = manifest_dir.join("include").join("cxx.h"); - println!("cargo:HEADER={}", cxx_h.to_string_lossy()); - } - if let Some(rustc) = rustc_version() { if rustc.minor >= 80 { println!("cargo:rustc-check-cfg=cfg(built_with_cargo)");