From 1927afa4b3aa1221f76e48f7f534a7bad8565c01 Mon Sep 17 00:00:00 2001 From: Abhishek Pandit-Subedi Date: Wed, 28 Apr 2021 21:16:18 -0700 Subject: Refactor topshim with bindgen and unsafe code Writing topshim interfaces is very tedious and lots of code is duplicated in C++. Rather that depend on unsafe C++ code, we write a small amount of unsafe Rust code and use macros to interact with the native layer directly from Rust. A few major changes introduced in this patch: - Bindgen to get Rust interface into C - Macros to call raw pointer functions directly - Macros to handle converting a callback into an enum variant - Refactor code to use new data structures - Replace use of closures for callbacks with an enum and dispatch fn This change also updates the bindgen requirement to 0.57 to match what Android is already using. BYPASS_INCLUSIVE_LANGUAGE_REASON=Bindgen dependency provides this api Bug: 183208689 Tag: #floss Test: atest --host bluetooth_test_gd Change-Id: Iebe904ebc2643b48d1a371051fbf3c06f2bf04d4 --- build.py | 1 + 1 file changed, 1 insertion(+) (limited to 'build.py') diff --git a/build.py b/build.py index c6cbabd369..808c80891d 100755 --- a/build.py +++ b/build.py @@ -180,6 +180,7 @@ class HostBuild(): self.env['CARGO_TARGET_DIR'] = self.output_dir self.env['CARGO_HOME'] = os.path.join(self.output_dir, 'cargo_home') self.env['RUSTFLAGS'] = self._generate_rustflags() + self.env['CXX_ROOT_PATH'] = os.path.join(self.platform_dir, 'bt') # Configure some GN variables if self.use_board: -- cgit v1.2.3-59-g8ed1b