diff --git a/native/src/base/Android.mk b/native/src/base/Android.mk index fce9a9015..652e2dd7d 100644 --- a/native/src/base/Android.mk +++ b/native/src/base/Android.mk @@ -7,7 +7,6 @@ LOCAL_MODULE := libbase LOCAL_C_INCLUDES := \ src/include \ $(LOCAL_PATH)/include \ - src/external/cxx-rs/include \ out/generated LOCAL_EXPORT_C_INCLUDES := $(LOCAL_C_INCLUDES) LOCAL_EXPORT_STATIC_LIBRARIES := libcxx diff --git a/native/src/base/include/rust/cxx.h b/native/src/base/include/rust/cxx.h new file mode 120000 index 000000000..c72c3ce90 --- /dev/null +++ b/native/src/base/include/rust/cxx.h @@ -0,0 +1 @@ +../../../external/cxx-rs/include/cxx.h \ No newline at end of file diff --git a/native/src/base/misc.hpp b/native/src/base/misc.hpp index 4bf4e95c4..17b1f79e0 100644 --- a/native/src/base/misc.hpp +++ b/native/src/base/misc.hpp @@ -5,7 +5,7 @@ #include #include #include -#include +#include #include "xwrap.hpp" diff --git a/native/src/boot/bootimg.hpp b/native/src/boot/bootimg.hpp index 01924a340..ead64b486 100644 --- a/native/src/boot/bootimg.hpp +++ b/native/src/boot/bootimg.hpp @@ -3,7 +3,7 @@ #include #include #include -#include +#include /****************** * Special Headers diff --git a/native/src/core/include/sqlite.hpp b/native/src/core/include/sqlite.hpp index 2476c3aed..caa5b1c97 100644 --- a/native/src/core/include/sqlite.hpp +++ b/native/src/core/include/sqlite.hpp @@ -2,7 +2,7 @@ #include -#include +#include #define SQLITE_OPEN_READWRITE 0x00000002 /* Ok for sqlite3_open_v2() */ #define SQLITE_OPEN_CREATE 0x00000004 /* Ok for sqlite3_open_v2() */ diff --git a/native/src/include/codegen.rs b/native/src/include/codegen.rs index df221a414..3408b93b9 100644 --- a/native/src/include/codegen.rs +++ b/native/src/include/codegen.rs @@ -6,7 +6,7 @@ use std::io::Write; use std::path::Path; use std::{fs, io, process}; -use cxx_gen::Opt; +use cxx_gen::{Include, IncludeKind, Opt}; trait ResultExt { fn ok_or_exit(self) -> T; @@ -38,7 +38,12 @@ fn write_if_diff>(path: P, bytes: &[u8]) -> io::Result<()> { pub fn gen_cxx_binding(name: &str) { println!("cargo:rerun-if-changed=lib.rs"); - let opt = Opt::default(); + let mut opt = Opt::default(); + opt.cxx_impl_annotations = Some("[[gnu::always_inline]]".to_string()); + opt.include.push(Include { + path: "rust/cxx.h".to_string(), + kind: IncludeKind::Bracketed, + }); let code = cxx_gen::generate_header_and_cc_with_path("lib.rs", &opt); write_if_diff(format!("{name}.cpp"), code.implementation.as_slice()).ok_or_exit(); write_if_diff(format!("{name}.hpp"), code.header.as_slice()).ok_or_exit(); diff --git a/native/src/sepolicy/policy.hpp b/native/src/sepolicy/policy.hpp index 64388da5c..502f4d331 100644 --- a/native/src/sepolicy/policy.hpp +++ b/native/src/sepolicy/policy.hpp @@ -4,7 +4,7 @@ #include #include -#include +#include #include