mirror of
https://github.com/openharmony/third_party_rust_cxx.git
synced 2026-07-01 05:39:22 -04:00
@@ -24,10 +24,7 @@ ohos_cargo_crate("lib") {
|
||||
cargo_pkg_authors = "David Tolnay <dtolnay@gmail.com>"
|
||||
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 {
|
||||
|
||||
@@ -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)");
|
||||
|
||||
Reference in New Issue
Block a user