From 73f0962afdbd887adb42a7732342b3bc34a24381 Mon Sep 17 00:00:00 2001 From: xxlight Date: Tue, 27 Jun 2023 23:30:27 +0800 Subject: [PATCH] Description: fix problem about cxx deps Issue: https://gitee.com/openharmony/build/issues/I7GK8Y?from=project-issue Test: build Signed-off-by: xxlight Change-Id: I17d26a519ba13d55182ab13513f69eadc3f12251 Change-Id: I7cddb0b527edc801173d26a8005de35c45fcab9e --- BUILD.gn | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/BUILD.gn b/BUILD.gn index a8954ef3..76292b10 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -32,3 +32,19 @@ ohos_cargo_crate("lib") { build_root = "build.rs" build_sources = [ "build.rs" ] } + +ohos_static_library("cxx_cppdeps") { + part_name = "common" + subsystem_name = "common" + defines = [ "RUST_CXX_NO_EXCEPTIONS" ] + sources = [ + "//third_party/rust/crates/cxx/include/cxx.h", + "//third_party/rust/crates/cxx/src/cxx.cc", + ] + deps = [ "//third_party/rust/crates/cxx:lib" ] + if (is_win) { + defines += [ "CXX_RS_EXPORT=__declspec(dllexport)" ] + } else { + defines += [ "CXX_RS_EXPORT=__attribute__((visibility(\"default\")))" ] + } +}