aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAbhishek Pandit-Subedi <abhishekpandit@google.com>2021-01-08 19:53:23 -0800
committerAbhishek Pandit-Subedi <abhishekpandit@google.com>2021-02-01 22:58:03 +0000
commit7396ad40ec4456cfbd417da54de714f4465e89f8 (patch)
tree91562748cb19c5e9671d9baea47d630bec129798
parent1d7fbd391a95f80c8e5d75aee93af2454b175be9 (diff)
downloadbt-7396ad40ec4456cfbd417da54de714f4465e89f8.tar.gz
Fix up files to compile on Linux
Fix up all the .gn files so that they will compile on Linux. In order to compile with GN, there is a new dependency on common-mk (currently part of chromiumos/platform2) and most third-party libraries now use pkg-config to include and link. As a result, all build paths are prefixed with //bt now. In addition, also disable building non standard codecs temporarily (i.e. ldac, aptx, aac). We will add a way to enable them via build flags later but we're disabling them entirely for now. Bug: 176847216 Bug: 176846220 Tag: #refactor Test: run --host bluetooth_test_gd Test: run --host bluetooth_test_common Change-Id: I85e5f8bd64c9ad074537cdd1393d373d5644aca0
-rw-r--r--BUILD.gn141
-rw-r--r--bta/BUILD.gn65
-rw-r--r--btcore/BUILD.gn25
-rw-r--r--btif/BUILD.gn62
-rw-r--r--btif/avrcp/avrcp_service.h1
-rw-r--r--common/BUILD.gn32
-rw-r--r--device/BUILD.gn33
-rw-r--r--embdrv/sbc/BUILD.gn8
-rw-r--r--gd/proto/BUILD.gn10
-rw-r--r--gd/rust/shim/BUILD.gn (renamed from .gn)19
-rw-r--r--hci/BUILD.gn46
-rw-r--r--include/array_utils.h20
-rw-r--r--include/hardware/ble_scanner.h3
-rw-r--r--main/BUILD.gn91
-rw-r--r--osi/BUILD.gn33
-rw-r--r--packet/BUILD.gn13
-rw-r--r--packet/base/packet.h3
-rw-r--r--profile/avrcp/BUILD.gn14
-rw-r--r--service/BUILD.gn45
-rw-r--r--service/avrcp_target.cc3
-rw-r--r--service/ipc/dbus/bluetooth_adapter.cc2
-rw-r--r--service/test/ipc_linux_unittest.cc5
-rw-r--r--service/test/settings_unittest.cc17
-rw-r--r--stack/BUILD.gn220
-rw-r--r--stack/a2dp/a2dp_aac_decoder.cc4
-rw-r--r--stack/a2dp/a2dp_aac_encoder.cc4
-rw-r--r--stack/btm/security_device_record.h1
-rw-r--r--stack/hcic/hciblecmds.cc2
-rw-r--r--stack/include/bt_types.h4
-rw-r--r--test/suite/BUILD.gn23
-rw-r--r--types/BUILD.gn18
-rw-r--r--types/bluetooth/uuid.cc3
-rw-r--r--udrv/BUILD.gn13
-rw-r--r--utils/BUILD.gn15
-rw-r--r--vendor_libs/test_vendor_lib/types/BUILD.gn17
35 files changed, 652 insertions, 363 deletions
diff --git a/BUILD.gn b/BUILD.gn
index 456fbeb8f..a477b2a06 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -20,11 +20,17 @@
# you add a new build file, there must be some path of dependencies from this
# file to your new one or GN won't know about it.
+group("all") {
+ deps = [
+ ":bluetooth",
+ ]
+}
+
# This pulls in main/BUILD.gn and all of its dependencies.
group("bluetooth") {
deps = [
- "//main:bluetooth",
- "//service:bluetoothtbd",
+ "//bt/main:bluetooth",
+ "//bt/service:bluetoothtbd",
]
}
@@ -32,10 +38,131 @@ group("bluetooth_tests") {
testonly = true
deps = [
- "//test/suite:net_test_bluetooth",
- "//btcore:net_test_btcore",
- "//hci:net_test_hci",
- "//osi:net_test_osi",
- "//device:net_test_device",
+ "//bt/test/suite:net_test_bluetooth",
+ "//bt/btcore:net_test_btcore",
+ "//bt/hci:net_test_hci",
+ "//bt/osi:net_test_osi",
+ "//bt/device:net_test_device",
+ ]
+}
+
+config("target_defaults") {
+ include_dirs = [
+ "//bt/linux_include",
+ "//bt/types",
+ "//bt/include",
+ ]
+
+ cflags = [
+ "-DEXPORT_SYMBOL=__attribute__((visibility(\"default\")))",
+ "-DFALLTHROUGH_INTENDED=[[clang::fallthrough]]",
+ "-fPIC",
+ "-Wno-non-c-typedef-for-linkage",
+ "-Wno-unreachable-code-return",
+ "-Wno-defaulted-function-deleted",
+ "-Wno-gnu-variable-sized-type-not-at-end",
+ "-Wno-format-nonliteral",
+ "-Wno-inconsistent-missing-override",
+ "-Wno-unreachable-code",
+ "-Wno-range-loop-construct",
+ "-Wno-reorder-init-list",
+ "-Wno-unused-function",
+ "-Wno-unused-result",
+ "-Wno-unused-variable",
+ "-Wno-unused-const-variable",
+ ]
+
+ cflags_cc = [
+ "-std=c++17",
+ ]
+
+ defines = [
+ "HAS_NO_BDROID_BUILDCFG",
+ "OS_GENERIC",
+ ]
+
+ configs = [
+ ":external_libchrome",
+ ]
+}
+
+# Configurations to use as dependencies for GN build
+config("external_gtest") {
+ configs = [
+ ":pkg_gtest",
+ ":pkg_gmock",
]
}
+
+config("external_gtest_main") {
+ configs = [ ":pkg_gtest_main" ]
+}
+
+config("external_gmock_main") {
+ configs = [ ":pkg_gmock_main" ]
+}
+
+config("external_libchrome") {
+ configs = [ ":pkg_libchrome" ]
+}
+
+config("external_modp_b64") {
+ configs = [ ":pkg_modp_b64" ]
+}
+
+config("external_tinyxml2") {
+ configs = [ ":pkg_tinyxml2" ]
+}
+
+# Package configurations to extract dependencies from env
+pkg_config("pkg_gtest") {
+ pkg_deps = [ "gtest" ]
+}
+
+pkg_config("pkg_gtest_main") {
+ pkg_deps = [ "gtest_main" ]
+}
+
+pkg_config("pkg_gmock") {
+ pkg_deps = [ "gmock" ]
+}
+
+pkg_config("pkg_gmock_main") {
+ pkg_deps = [ "gmock_main" ]
+}
+
+pkg_config("pkg_libchrome") {
+ pkg_deps = [ "libchrome" ]
+}
+
+pkg_config("pkg_modp_b64") {
+ pkg_deps = [ "libmodp_b64" ]
+}
+
+pkg_config("pkg_tinyxml2") {
+ pkg_deps = [ "tinyxml2" ]
+}
+
+# Uncomment if building nonstandard codecs
+# config("external_aac") {
+# configs = [ ":pkg_aac" ]
+# }
+#
+# pkg_config("pkg_aac") {
+# pkg_deps = [ "fdk-aac" ]
+# }
+#
+# config("external_libldac") {
+# configs = [
+# ":pkg_libldacBT_enc",
+# ":pkg_libldacBT_abr",
+# ]
+# }
+#
+# pkg_config("pkg_libldacBT_enc") {
+# pkg_deps = [ "ldacBT-enc", ]
+# }
+#
+# pkg_config("pkg_libldacBT_abr") {
+# pkg_deps = [ "ldacBT-abr", ]
+# }
diff --git a/bta/BUILD.gn b/bta/BUILD.gn
index 6632c24d7..da4fe80b6 100644
--- a/bta/BUILD.gn
+++ b/bta/BUILD.gn
@@ -92,28 +92,32 @@ static_library("bta") {
"hd",
"include",
"sys",
- "//",
- "//linux_include",
- "//bta",
- "//internal_include",
- "//btcore/include",
- "//hci/include",
- "//internal_include",
- "//stack/include",
- "//stack/btm",
- "//udrv/include",
- "//utils/include",
- "//vnd/include",
- "//btif/include",
- "//btif/avrcp",
- "//include/hardware/avrcp",
- "//profile/avrcp",
- "//packet/avrcp",
- "//packet/base",
+ "//bt/",
+ "//bt/linux_include",
+ "//bt/bta",
+ "//bt/internal_include",
+ "//bt/btcore/include",
+ "//bt/hci/include",
+ "//bt/internal_include",
+ "//bt/stack/include",
+ "//bt/stack/btm",
+ "//bt/udrv/include",
+ "//bt/utils/include",
+ "//bt/vnd/include",
+ "//bt/btif/include",
+ "//bt/btif/avrcp",
+ "//bt/include/hardware/avrcp",
+ "//bt/profile/avrcp",
+ "//bt/packet/avrcp",
+ "//bt/packet/base",
+ ]
+
+ configs += [
+ "//bt:target_defaults"
]
deps = [
- "//third_party/libchrome:base"
+ "//bt/gd/rust/shim:init_flags_bridge_header",
]
}
@@ -128,18 +132,21 @@ executable("net_test_bta") {
include_dirs = [
"include",
- "//",
- "//bta",
- "//btcore/include",
- "//hci/include",
- "//internal_include",
- "//stack/btm",
+ "//bt/",
+ "//bt/bta",
+ "//bt/btcore/include",
+ "//bt/hci/include",
+ "//bt/internal_include",
+ "//bt/stack/btm",
]
deps = [
- "//bta",
- "//types",
- "//third_party/googletest:gmock_main",
- "//third_party/libchrome:base",
+ "//bt/bta",
+ "//bt/types",
+ ]
+
+ configs += [
+ "//bt:external_gmock_main",
+ "//bt:target_defaults",
]
}
diff --git a/btcore/BUILD.gn b/btcore/BUILD.gn
index 01b9cf7e3..3aef8f6a7 100644
--- a/btcore/BUILD.gn
+++ b/btcore/BUILD.gn
@@ -25,11 +25,15 @@ static_library("btcore") {
include_dirs = [
"include",
- "//",
+ "//bt",
+ ]
+
+ configs += [
+ "//bt:target_defaults",
]
deps = [
- "//third_party/libchrome:base",
+ "//bt/gd/rust/shim:init_flags_bridge_header",
]
}
@@ -38,20 +42,23 @@ executable("net_test_btcore") {
sources = [
"test/device_class_test.cc",
"test/property_test.cc",
- "//osi/test/AllocationTestHarness.cc",
+ "//bt/osi/test/AllocationTestHarness.cc",
]
include_dirs = [
"include",
- "//",
+ "//bt",
]
deps = [
- "//btcore",
- "//osi",
- "//types",
- "//third_party/googletest:gtest_main",
- "//third_party/libchrome:base",
+ "//bt/btcore",
+ "//bt/osi",
+ "//bt/types",
+ ]
+
+ configs += [
+ "//bt:external_gtest_main",
+ "//bt:target_defaults",
]
libs = [
diff --git a/btif/BUILD.gn b/btif/BUILD.gn
index 0efd55a61..b6c4ad899 100644
--- a/btif/BUILD.gn
+++ b/btif/BUILD.gn
@@ -16,13 +16,13 @@
static_library("btif") {
sources = [
- "//audio_a2dp_hw/src/audio_a2dp_hw_utils.cc",
- "//audio_hearing_aid_hw/src/audio_hearing_aid_hw_utils.cc",
+ "//bt/audio_a2dp_hw/src/audio_a2dp_hw_utils.cc",
+ "//bt/audio_hearing_aid_hw/src/audio_hearing_aid_hw_utils.cc",
"src/btif_a2dp.cc",
"src/btif_a2dp_audio_interface_linux.cc",
"src/btif_a2dp_control.cc",
"src/btif_a2dp_sink.cc",
- "src/btif_a2dp_source.cc",
+ # "src/btif_a2dp_source.cc",
"src/btif_av.cc",
"avrcp/avrcp_service.cc",
@@ -31,7 +31,7 @@ static_library("btif") {
"src/btif_avrcp_audio_track_linux.cc",
"src/btif_ble_advertiser.cc",
"src/btif_ble_scanner.cc",
- "src/btif_config.cc",
+ # "src/btif_config.cc",
"src/btif_config_transcode.cc",
"src/btif_core.cc",
"src/btif_debug.cc",
@@ -77,32 +77,38 @@ static_library("btif") {
include_dirs = [
"include",
- "//",
- "//linux_include",
- "//audio_a2dp_hw/include",
- "//audio_hearing_aid_hw/include",
- "//bta/include",
- "//bta/sys",
- "//btcore/include",
- "//device/include",
- "//embdrv/sbc/encoder/include",
- "//embdrv/sbc/decoder/include",
- "//hci/include",
- "//stack/a2dp",
- "//stack/btm",
- "//stack/l2cap",
- "//stack/include",
- "//third_party/tinyxml2",
- "//internal_include",
- "//udrv/include",
- "//utils/include",
- "//vnd/include",
- "//profile/avrcp",
+ "//bt/",
+ "//bt/bta/dm",
+ "//bt/linux_include",
+ "//bt/audio_a2dp_hw/include",
+ "//bt/audio_hearing_aid_hw/include",
+ "//bt/bta/include",
+ "//bt/bta/sys",
+ "//bt/btcore/include",
+ "//bt/device/include",
+ "//bt/embdrv/sbc/encoder/include",
+ "//bt/embdrv/sbc/decoder/include",
+ "//bt/hci/include",
+ "//bt/stack/a2dp",
+ "//bt/stack/btm",
+ "//bt/stack/l2cap",
+ "//bt/stack/include",
+ "//bt/internal_include",
+ "//bt/udrv/include",
+ "//bt/utils/include",
+ "//bt/vnd/include",
+ "//bt/profile/avrcp",
]
deps = [
- "//common",
- "//third_party/libchrome:base",
- "//profile/avrcp:profile_avrcp"
+ "//bt/common",
+ "//bt/gd/rust/shim:init_flags_bridge_header",
+ "//bt/profile/avrcp:profile_avrcp",
+ "//bt/third_party/proto_logging/stats:libbt-platform-protos",
+ ]
+
+ configs += [
+ "//bt:target_defaults",
+ "//bt:external_tinyxml2",
]
}
diff --git a/btif/avrcp/avrcp_service.h b/btif/avrcp/avrcp_service.h
index b60700f33..067631ecd 100644
--- a/btif/avrcp/avrcp_service.h
+++ b/btif/avrcp/avrcp_service.h
@@ -18,6 +18,7 @@
#include <map>
#include <memory>
+#include <mutex>
#include "hardware/avrcp/avrcp.h"
#include "osi/include/properties.h"
diff --git a/common/BUILD.gn b/common/BUILD.gn
index 76d70f8fb..f491cde32 100644
--- a/common/BUILD.gn
+++ b/common/BUILD.gn
@@ -19,18 +19,22 @@ static_library("common") {
"message_loop_thread.cc",
"metrics_linux.cc",
"time_util.cc",
- "timer.cc",
]
include_dirs = [
- "//",
- "//stack/include",
- "//linux_include",
- "//internal_include",
+ "//bt/",
+ "//bt/stack/include",
+ "//bt/linux_include",
+ "//bt/internal_include",
]
deps = [
- "//third_party/libchrome:base",
+ "//bt/gd/rust/shim:init_flags_bridge_header",
+ "//bt/third_party/proto_logging/stats:libbt-platform-protos",
+ ]
+
+ configs += [
+ "//bt:target_defaults",
]
}
@@ -40,19 +44,21 @@ executable("bt_test_common") {
"leaky_bonded_queue_unittest.cc",
"state_machine_unittest.cc",
"time_util_unittest.cc",
- "timer_unittest.cc"
]
include_dirs = [
- "//",
- "//common",
+ "//bt/",
+ "//bt/common",
]
deps = [
- "//common",
- "//third_party/googletest:gtest_main",
- "//third_party/googletest:gmock_main",
- "//third_party/libchrome:base",
+ "//bt/common",
+ ]
+
+ configs += [
+ "//bt:external_gtest_main",
+ "//bt:external_gmock_main",
+ "//bt:target_defaults",
]
libs = [
diff --git a/device/BUILD.gn b/device/BUILD.gn
index 5de439d30..cf016dc4e 100644
--- a/device/BUILD.gn
+++ b/device/BUILD.gn
@@ -22,32 +22,39 @@ static_library("device") {
]
include_dirs = [
- "//",
- "//btcore/include",
- "//hci/include",
- "//internal_include",
- "//stack/include",
+ "//bt/",
+ "//bt/btcore/include",
+ "//bt/hci/include",
+ "//bt/internal_include",
+ "//bt/stack/include",
+ ]
+
+ configs += [
+ "//bt:target_defaults",
]
deps = [
- "//third_party/libchrome:base",
+ "//bt/gd/rust/shim:init_flags_bridge_header",
]
}
executable("net_test_device") {
testonly = true
sources = [
- "//osi/test/AllocationTestHarness.cc",
+ "//bt/osi/test/AllocationTestHarness.cc",
]
- include_dirs = [ "//" ]
+ include_dirs = [ "//bt" ]
deps = [
- "//device",
- "//btcore",
- "//osi",
- "//third_party/googletest:gtest_main",
- "//third_party/libchrome:base",
+ "//bt/device",
+ "//bt/btcore",
+ "//bt/osi",
+ ]
+
+ configs += [
+ "//bt:external_gtest_main",
+ "//bt:target_defaults",
]
libs = [
diff --git a/embdrv/sbc/BUILD.gn b/embdrv/sbc/BUILD.gn
index 696080a07..ce8524582 100644
--- a/embdrv/sbc/BUILD.gn
+++ b/embdrv/sbc/BUILD.gn
@@ -33,6 +33,8 @@ source_set("sbc_decoder") {
]
include_dirs = [ "decoder/include" ]
+
+ configs += [ "//bt:target_defaults" ]
}
source_set("sbc_encoder") {
@@ -49,9 +51,11 @@ source_set("sbc_encoder") {
include_dirs = [
"encoder/include",
- "//internal_include",
- "//stack/include",
+ "//bt/internal_include",
+ "//bt/stack/include",
]
+
+ configs += [ "//bt:target_defaults" ]
}
static_library("sbc") {
diff --git a/gd/proto/BUILD.gn b/gd/proto/BUILD.gn
new file mode 100644
index 000000000..ba5cd4eaa
--- /dev/null
+++ b/gd/proto/BUILD.gn
@@ -0,0 +1,10 @@
+import("//common-mk/proto_library.gni")
+
+proto_library("libbt-protos-lite") {
+ sources = [
+ "bluetooth/metrics/bluetooth.proto",
+ ]
+
+ proto_in_dir = "./bluetooth/metrics"
+ proto_out_dir = "include/bluetooth/metrics"
+}
diff --git a/.gn b/gd/rust/shim/BUILD.gn
index 1c2396dfc..8843c934a 100644
--- a/.gn
+++ b/gd/rust/shim/BUILD.gn
@@ -1,5 +1,5 @@
#
-# Copyright 2015 Google, Inc.
+# Copyright 2020 Google
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -14,9 +14,16 @@
# limitations under the License.
#
-# This file is used by the GN meta build system to find the root of the source
-# tree and to set startup options. For documentation on the values set in this
-# file, run "gn help dotfile" at the command line.
+import("//common-mk/cxxbridge.gni")
-buildconfig = "//build/config/BUILDCONFIG.gn"
-secondary_source = "//build/secondary/"
+cxxbridge_header("shim_bridge_header") {
+ sources = [ "src/stack.rs" ]
+}
+
+cxxbridge_header("init_flags_bridge_header") {
+ sources = [ "src/init_flags.rs" ]
+}
+
+cxxbridge_header("hci_bridge_header") {
+ sources = [ "src/hci.rs" ]
+}
diff --git a/hci/BUILD.gn b/hci/BUILD.gn
index e29e2569e..28f8fe2a2 100644
--- a/hci/BUILD.gn
+++ b/hci/BUILD.gn
@@ -30,42 +30,48 @@ static_library("hci") {
include_dirs = [
"include",
- "//",
- "//internal_include",
- "//bta/include",
- "//btcore/include",
- "//stack/include",
+ "//bt/",
+ "//bt/internal_include",
+ "//bt/bta/include",
+ "//bt/btcore/include",
+ "//bt/stack/include",
]
deps = [
- "//common",
- "//third_party/libchrome:base",
+ "//bt/common",
+ ]
+
+ configs += [
+ "//bt:target_defaults",
]
}
executable("net_test_hci") {
testonly = true
sources = [
- "//osi/test/AllocationTestHarness.cc",
- "//osi/test/AlarmTestHarness.cc",
+ "//bt/osi/test/AllocationTestHarness.cc",
+ "//bt/osi/test/AlarmTestHarness.cc",
"test/packet_fragmenter_test.cc",
]
include_dirs = [
- "//",
- "//internal_include",
- "//btcore/include",
- "//hci/include",
- "//osi/test",
- "//stack/include",
+ "//bt/",
+ "//bt/internal_include",
+ "//bt/btcore/include",
+ "//bt/hci/include",
+ "//bt/osi/test",
+ "//bt/stack/include",
]
deps = [
- "//hci",
- "//osi",
- "//btcore",
- "//third_party/googletest:gtest_main",
- "//third_party/libchrome:base",
+ "//bt/hci",
+ "//bt/osi",
+ "//bt/btcore",
+ ]
+
+ configs += [
+ "//bt:target_defaults",
+ "//bt:external_gtest_main",
]
libs = [
diff --git a/include/array_utils.h b/include/array_utils.h
new file mode 100644
index 000000000..d669d0aba
--- /dev/null
+++ b/include/array_utils.h
@@ -0,0 +1,20 @@
+//
+// Copyright 2021 Google, Inc.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at:
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+#pragma once
+
+#ifndef ARRAY_SIZE
+#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof(arr[0]))
+#endif
diff --git a/include/hardware/ble_scanner.h b/include/hardware/ble_scanner.h
index 1588085e8..302a12343 100644
--- a/include/hardware/ble_scanner.h
+++ b/include/hardware/ble_scanner.h
@@ -19,6 +19,7 @@
#include <bluetooth/uuid.h>
#include <stdint.h>
+#include <memory>
#include <vector>
#include "bt_common_types.h"
#include "bt_gatt_client.h"
@@ -156,4 +157,4 @@ class BleScannerInterface {
virtual void RegisterCallbacks(ScanningCallbacks* callbacks) = 0;
};
-#endif /* ANDROID_INCLUDE_BLE_SCANNER_H */ \ No newline at end of file
+#endif /* ANDROID_INCLUDE_BLE_SCANNER_H */
diff --git a/main/BUILD.gn b/main/BUILD.gn
index c340cd7b7..77950ea4d 100644
--- a/main/BUILD.gn
+++ b/main/BUILD.gn
@@ -24,7 +24,7 @@ shared_library("bluetooth") {
# HAL layer
sources = [
- "//btif/src/bluetooth.cc",
+ "//bt/btif/src/bluetooth.cc",
]
# platform specific
@@ -39,58 +39,61 @@ shared_library("bluetooth") {
public_configs = [ ":libbluetooth_config" ]
include_dirs = [
- "//",
- "//bta/include",
- "//bta/sys",
- "//bta/dm",
- "//btcore/include",
- "//internal_include",
- "//stack/include",
- "//stack/l2cap",
- "//stack/a2dp",
- "//stack/btm",
- "//stack/avdt",
- "//hci",
- "//hci/include",
- "//udrv/include",
- "//btif/include",
- "//btif/co",
- "//hci/includ",
- "//vnd/include",
- "//brcm/include",
- "//embdrv/sbc/encoder/include",
- "//embdrv/sbc/decoder/include",
- "//utils/include",
- "//test/suite",
+ "//bt/",
+ "//bt/bta/include",
+ "//bt/bta/sys",
+ "//bt/bta/dm",
+ "//bt/btcore/include",
+ "//bt/internal_include",
+ "//bt/stack/include",
+ "//bt/stack/l2cap",
+ "//bt/stack/a2dp",
+ "//bt/stack/btm",
+ "//bt/stack/avdt",
+ "//bt/hci",
+ "//bt/hci/include",
+ "//bt/udrv/include",
+ "//bt/btif/include",
+ "//bt/btif/co",
+ "//bt/hci/includ",
+ "//bt/vnd/include",
+ "//bt/brcm/include",
+ "//bt/embdrv/sbc/encoder/include",
+ "//bt/embdrv/sbc/decoder/include",
+ "//bt/utils/include",
+ "//bt/test/suite",
]
deps = [
- "//bta",
- "//btcore",
- "//btif",
- "//device",
- "//embdrv/g722",
- "//embdrv/sbc",
- "//hci",
- "//osi",
- "//packet",
- "//stack",
- "//third_party/libchrome:base",
- "//third_party/tinyxml2",
- "//udrv",
- "//utils",
+ "//bt/bta",
+ "//bt/btcore",
+ "//bt/btif",
+ "//bt/device",
+ "//bt/embdrv/g722",
+ "//bt/embdrv/sbc",
+ "//bt/hci",
+ "//bt/osi",
+ "//bt/packet",
+ "//bt/stack",
+ "//bt/udrv",
+ "//bt/utils",
+ ]
+
+ configs += [
+ "//bt:target_defaults",
+ "//bt:external_tinyxml2",
]
cflags_c = [
"-Lobj/osi",
"-losi",
]
+
libs = [
- "-ldl",
- "-lpthread",
- "-lresolv",
- "-lrt",
- "-lz",
- "-latomic",
+ "dl",
+ "pthread",
+ "resolv",
+ "rt",
+ "z",
]
}
diff --git a/osi/BUILD.gn b/osi/BUILD.gn
index c4fb0cb10..dc5399c55 100644
--- a/osi/BUILD.gn
+++ b/osi/BUILD.gn
@@ -44,16 +44,20 @@ static_library("osi") {
]
include_dirs = [
- "//",
- "//linux_include",
- "//internal_include",
- "//utils/include",
- "//stack/include",
+ "//bt/",
+ "//bt/linux_include",
+ "//bt/internal_include",
+ "//bt/utils/include",
+ "//bt/stack/include",
]
deps = [
- "//common",
- "//third_party/libchrome:base",
+ "//bt/common",
+ "//bt/gd/rust/shim:init_flags_bridge_header",
+ ]
+
+ configs += [
+ "//bt:target_defaults",
]
}
@@ -78,15 +82,18 @@ executable("net_test_osi") {
]
include_dirs = [
- "//",
- "//osi/test",
+ "//bt/",
+ "//bt/osi/test",
]
deps = [
- "//osi",
- "//third_party/googletest:gtest_main",
- "//third_party/googletest:gmock_main",
- "//third_party/libchrome:base",
+ "//bt/osi",
+ ]
+
+ configs += [
+ "//bt:external_gtest_main",
+ "//bt:external_gmock_main",
+ "//bt:target_defaults",
]
libs = [
diff --git a/packet/BUILD.gn b/packet/BUILD.gn
index 37d6ca494..8b786ccc5 100644
--- a/packet/BUILD.gn
+++ b/packet/BUILD.gn
@@ -40,13 +40,14 @@ static_library("packet") {
]
include_dirs = [
- "//",
- "//internal_include",
- "//stack/include",
- "//profile/avrcp",
+ "//bt/",
+ "//bt/include",
+ "//bt/internal_include",
+ "//bt/stack/include",
+ "//bt/profile/avrcp",
]
- deps = [
- "//third_party/libchrome:base"
+ configs += [
+ "//bt:target_defaults"
]
}
diff --git a/packet/base/packet.h b/packet/base/packet.h
index 8c8f22962..2de22abac 100644
--- a/packet/base/packet.h
+++ b/packet/base/packet.h
@@ -17,6 +17,7 @@
#pragma once
#include <cstdint>
+#include <memory>
#include <type_traits>
#include <utility>
#include <vector>
@@ -96,4 +97,4 @@ class Packet : public std::enable_shared_from_this<Packet> {
virtual std::pair<size_t, size_t> GetPayloadIndecies() const = 0;
};
-} // namespace bluetooth \ No newline at end of file
+} // namespace bluetooth
diff --git a/profile/avrcp/BUILD.gn b/profile/avrcp/BUILD.gn
index c37e0a7aa..1778b9833 100644
--- a/profile/avrcp/BUILD.gn
+++ b/profile/avrcp/BUILD.gn
@@ -21,14 +21,14 @@ static_library("profile_avrcp") {
]
include_dirs = [
- "//",
- "//btcore/include",
- "//internal_include",
- "//stack/include",
- "//profile/avrcp",
+ "//bt/",
+ "//bt/btcore/include",
+ "//bt/internal_include",
+ "//bt/stack/include",
+ "//bt/profile/avrcp",
]
- deps = [
- "//third_party/libchrome:base"
+ configs += [
+ "//bt:target_defaults"
]
}
diff --git a/service/BUILD.gn b/service/BUILD.gn
index 59acb167c..f84610623 100644
--- a/service/BUILD.gn
+++ b/service/BUILD.gn
@@ -60,17 +60,20 @@ source_set("service") {
]
include_dirs = [
- "//",
- "//linux_include",
- "//include",
- "//service/common",
- "//third_party/modp_b64/modp64",
+ "//bt/",
+ "//bt/linux_include",
+ "//bt/include",
+ "//bt/service/common",
]
deps = [
- "//types",
- "//osi",
- "//third_party/libchrome:base",
+ "//bt/types",
+ "//bt/osi",
+ "//bt/gd/rust/shim:init_flags_bridge_header",
+ ]
+
+ configs += [
+ "//bt:target_defaults",
]
}
@@ -81,17 +84,19 @@ executable("bluetoothtbd") {
deps = [
":service",
- "//btcore",
- "//third_party/libchrome:base",
- "//third_party/modp_b64",
+ "//bt/btcore",
+ ]
+
+ configs += [
+ "//bt:target_defaults",
]
- include_dirs = [ "//" ]
+ include_dirs = [ "//bt/" ]
libs = [
- "-ldl",
- "-lpthread",
- "-lrt",
+ "dl",
+ "pthread",
+ "rt",
]
}
@@ -102,12 +107,14 @@ executable("service_unittests") {
"test/settings_unittest.cc",
]
- include_dirs = [ "//" ]
+ include_dirs = [ "//bt/" ]
deps = [
":service",
- "//third_party/googletest:gmock_main",
- "//third_party/libchrome:base",
- "//third_party/modp_b64",
+ ]
+
+ configs += [
+ "//bt:external_gmock_main",
+ "//bt:target_defaults",
]
}
diff --git a/service/avrcp_target.cc b/service/avrcp_target.cc
index fb63fba38..264945a51 100644
--- a/service/avrcp_target.cc
+++ b/service/avrcp_target.cc
@@ -26,6 +26,7 @@
#include "base/memory/ptr_util.h"
#include "service/logging_helpers.h"
+#include "array_utils.h"
#include "stack/include/avrc_defs.h"
#define PARSE_ADDR(str) \
@@ -157,7 +158,7 @@ bool AvrcpTarget::GetPlayerAppValueResponse(
const std::string& str_addr, const std::vector<AvrcpIntValue>& values) {
RawAddress addr = PARSE_ADDR(str_addr);
btrc_player_settings_t btrc_values;
- if (values.size() >= arraysize(btrc_values.attr_ids)) {
+ if (values.size() >= ARRAY_SIZE(btrc_values.attr_ids)) {
LOG(ERROR) << "Too many attribute values";
return false;
}
diff --git a/service/ipc/dbus/bluetooth_adapter.cc b/service/ipc/dbus/bluetooth_adapter.cc
index fd6688a94..70ee19f18 100644
--- a/service/ipc/dbus/bluetooth_adapter.cc
+++ b/service/ipc/dbus/bluetooth_adapter.cc
@@ -72,7 +72,7 @@ BluetoothAdapter::BluetoothAdapter(scoped_refptr<Bus> bus,
void BluetoothAdapter::Enable(MethodCall* method_call,
ExportedObject::ResponseSender response_sender) {
VLOG(1) << __func__;
- adapter_->Enable(false);
+ adapter_->Enable();
response_sender.Run(Response::FromMethodCall(method_call));
}
diff --git a/service/test/ipc_linux_unittest.cc b/service/test/ipc_linux_unittest.cc
index 4a347ae36..762eb8864 100644
--- a/service/test/ipc_linux_unittest.cc
+++ b/service/test/ipc_linux_unittest.cc
@@ -27,6 +27,7 @@
#include <base/strings/stringprintf.h>
#include <gtest/gtest.h>
+#include "array_utils.h"
#include "service/adapter.h"
#include "service/hal/fake_bluetooth_gatt_interface.h"
#include "service/hal/fake_bluetooth_interface.h"
@@ -82,7 +83,7 @@ class IPCLinuxTest : public ::testing::Test {
const base::CommandLine::CharType* argv[] = {
"program", ipc_socket_arg.c_str(),
};
- base::CommandLine::Init(arraysize(argv), argv);
+ base::CommandLine::Init(ARRAY_SIZE(argv), argv);
}
void ConnectToTestSocket() {
@@ -119,7 +120,7 @@ class IPCLinuxTestDisabled : public IPCLinuxTest {
void SetUpCommandLine() override {
// Set up with no --ipc-socket-path
const base::CommandLine::CharType* argv[] = {"program"};
- base::CommandLine::Init(arraysize(argv), argv);
+ base::CommandLine::Init(ARRAY_SIZE(argv), argv);
}
private:
diff --git a/service/test/settings_unittest.cc b/service/test/settings_unittest.cc
index 551c1e053..60d372e37 100644
--- a/service/test/settings_unittest.cc
+++ b/service/test/settings_unittest.cc
@@ -19,6 +19,7 @@
#include <base/macros.h>
#include <gtest/gtest.h>
+#include "array_utils.h"
#include "service/settings.h"
#include "service/switches.h"
@@ -45,33 +46,33 @@ class SettingsTest : public ::testing::Test {
TEST_F(SettingsTest, EmptyCommandLine) {
const base::CommandLine::CharType* argv[] = {"program"};
- EXPECT_TRUE(base::CommandLine::Init(arraysize(argv), argv));
+ EXPECT_TRUE(base::CommandLine::Init(ARRAY_SIZE(argv), argv));
EXPECT_TRUE(settings_.Init());
}
TEST_F(SettingsTest, UnexpectedSwitches1) {
const base::CommandLine::CharType* argv[] = {
"program", "--create-ipc-socket=foobar", "--foobarbaz"};
- EXPECT_TRUE(base::CommandLine::Init(arraysize(argv), argv));
+ EXPECT_TRUE(base::CommandLine::Init(ARRAY_SIZE(argv), argv));
EXPECT_FALSE(settings_.Init());
}
TEST_F(SettingsTest, UnexpectedSwitches2) {
const base::CommandLine::CharType* argv[] = {"program", "--foobarbaz"};
- EXPECT_TRUE(base::CommandLine::Init(arraysize(argv), argv));
+ EXPECT_TRUE(base::CommandLine::Init(ARRAY_SIZE(argv), argv));
EXPECT_FALSE(settings_.Init());
}
TEST_F(SettingsTest, UnexpectedArguments1) {
const base::CommandLine::CharType* argv[] = {"program", "foobarbaz"};
- EXPECT_TRUE(base::CommandLine::Init(arraysize(argv), argv));
+ EXPECT_TRUE(base::CommandLine::Init(ARRAY_SIZE(argv), argv));
EXPECT_FALSE(settings_.Init());
}
TEST_F(SettingsTest, UnexpectedArguments2) {
const base::CommandLine::CharType* argv[] = {
"program", "--create-ipc-socket=foobar", "foobarbaz"};
- EXPECT_TRUE(base::CommandLine::Init(arraysize(argv), argv));
+ EXPECT_TRUE(base::CommandLine::Init(ARRAY_SIZE(argv), argv));
EXPECT_FALSE(settings_.Init());
}
@@ -79,21 +80,21 @@ TEST_F(SettingsTest, TooManyIpcOptions) {
const base::CommandLine::CharType* argv[] = {
"program", "--create-ipc-socket=foobar",
"--android-ipc-socket-suffix=foobar"};
- EXPECT_TRUE(base::CommandLine::Init(arraysize(argv), argv));
+ EXPECT_TRUE(base::CommandLine::Init(ARRAY_SIZE(argv), argv));
EXPECT_FALSE(settings_.Init());
}
TEST_F(SettingsTest, GoodArgumentsCreateIpc) {
const base::CommandLine::CharType* argv[] = {"program",
"--create-ipc-socket=foobar"};
- EXPECT_TRUE(base::CommandLine::Init(arraysize(argv), argv));
+ EXPECT_TRUE(base::CommandLine::Init(ARRAY_SIZE(argv), argv));
EXPECT_TRUE(settings_.Init());
}
TEST_F(SettingsTest, GoodArgumentsAndroidIpc) {
const base::CommandLine::CharType* argv[] = {
"program", "--android-ipc-socket-suffix=foobar"};
- EXPECT_TRUE(base::CommandLine::Init(arraysize(argv), argv));
+ EXPECT_TRUE(base::CommandLine::Init(ARRAY_SIZE(argv), argv));
EXPECT_TRUE(settings_.Init());
}
diff --git a/stack/BUILD.gn b/stack/BUILD.gn
index 9bb356ce6..8237d69a2 100644
--- a/stack/BUILD.gn
+++ b/stack/BUILD.gn
@@ -22,26 +22,19 @@ static_library("crypto_toolbox") {
]
include_dirs = [
- "//",
+ "//bt/",
]
- deps = [
- "//third_party/libchrome:base",
+ configs += [
+ "//bt:target_defaults",
]
}
-static_library("stack") {
+source_set("nonstandard_codecs") {
sources = [
"a2dp/a2dp_aac.cc",
"a2dp/a2dp_aac_decoder.cc",
"a2dp/a2dp_aac_encoder.cc",
- "a2dp/a2dp_api.cc",
- "a2dp/a2dp_codec_config.cc",
- "a2dp/a2dp_sbc.cc",
- "a2dp/a2dp_sbc_decoder.cc",
- "a2dp/a2dp_sbc_encoder.cc",
- "a2dp/a2dp_sbc_up_sample.cc",
- "a2dp/a2dp_vendor.cc",
"a2dp/a2dp_vendor_aptx.cc",
"a2dp/a2dp_vendor_aptx_encoder.cc",
"a2dp/a2dp_vendor_aptx_hd.cc",
@@ -50,6 +43,25 @@ static_library("stack") {
"a2dp/a2dp_vendor_ldac_abr.cc",
"a2dp/a2dp_vendor_ldac_decoder.cc",
"a2dp/a2dp_vendor_ldac_encoder.cc",
+ ]
+
+ configs += [
+ # "//bt:external_libldac",
+ # "//bt:external_aac",
+ ]
+}
+
+static_library("stack") {
+ sources = [
+ "a2dp/a2dp_api.cc",
+ "a2dp/a2dp_codec_config.cc",
+ "a2dp/a2dp_sbc.cc",
+ "a2dp/a2dp_sbc_decoder.cc",
+ "a2dp/a2dp_sbc_encoder.cc",
+ "a2dp/a2dp_sbc_up_sample.cc",
+ "a2dp/a2dp_vendor.cc",
+ "acl/btm_acl.cc",
+ "acl/btm_pm.cc",
"avct/avct_api.cc",
"avct/avct_bcb_act.cc",
"avct/avct_ccb.cc",
@@ -64,7 +76,8 @@ static_library("stack") {
"avdt/avdt_l2c.cc",
"avdt/avdt_msg.cc",
"avdt/avdt_scb.cc",
- "avdt/avdt_scb_act.cc",
+ # Disable temporarily due to libcutils dependency
+ #"avdt/avdt_scb_act.cc",
"avrc/avrc_api.cc",
"avrc/avrc_bld_ct.cc",
"avrc/avrc_bld_tg.cc",
@@ -78,7 +91,6 @@ static_library("stack") {
"bnep/bnep_utils.cc",
"btm/ble_advertiser_hci_interface.cc",
"btm/ble_scanner_hci_interface.cc",
- "btm/btm_acl.cc",
"btm/btm_ble.cc",
"btm/btm_ble_addr.cc",
"btm/btm_ble_adv_filter.cc",
@@ -93,7 +105,6 @@ static_library("stack") {
"btm/btm_inq.cc",
"btm/btm_iso.cc",
"btm/btm_main.cc",
- "btm/btm_pm.cc",
"btm/btm_sco.cc",
"btm/btm_sec.cc",
"btu/btu_hcif.cc",
@@ -149,7 +160,8 @@ static_library("stack") {
"smp/smp_api.cc",
"smp/smp_br_main.cc",
"smp/smp_keys.cc",
- "smp/smp_l2c.cc",
+ # Disable temporarily due to libcutils dependency
+ #"smp/smp_l2c.cc",
"smp/smp_main.cc",
"smp/smp_utils.cc",
"srvc/srvc_dis.cc",
@@ -157,6 +169,7 @@ static_library("stack") {
]
include_dirs = [
+ ".",
"include",
"avct",
"btm",
@@ -172,31 +185,34 @@ static_library("stack") {
"sdp",
"smp",
"srvc",
- "//linux_include",
- "//internal_include",
- "//btcore/include",
- "//vnd/include",
- "//vnd/ble",
- "//btif/include",
- "//hci/include",
- "//internal_include",
- "//udrv/include",
- "//rpc/include",
- "//hcis",
- "//ctrlr/include",
- "//bta/include",
- "//bta/sys",
- "//utils/include",
- "//",
+ "//bt/types",
+ "//bt/linux_include",
+ "//bt/internal_include",
+ "//bt/btcore/include",
+ "//bt/vnd/include",
+ "//bt/vnd/ble",
+ "//bt/btif/include",
+ "//bt/hci/include",
+ "//bt/internal_include",
+ "//bt/udrv/include",
+ "//bt/rpc/include",
+ "//bt/hcis",
+ "//bt/ctrlr/include",
+ "//bt/bta/include",
+ "//bt/bta/sys",
+ "//bt/utils/include",
+ "//bt/",
]
deps = [
":crypto_toolbox",
- "//types",
- "//third_party/libchrome:base",
- "//third_party/libldac:libldacBT_enc",
- "//third_party/libldac:libldacBT_abr",
- "//third_party/aac:libFraunhoferAAC",
+ "//bt/types",
+ "//bt/gd/rust/shim:init_flags_bridge_header",
+ "//bt/third_party/proto_logging/stats:libbt-platform-protos",
+ ]
+
+ configs += [
+ "//bt:target_defaults",
]
}
@@ -209,21 +225,20 @@ executable("stack_unittests") {
include_dirs = [
"include",
- "//",
- "//bta/eatt",
- "//bta/include",
- "//bta/sys",
- "//btcore/include",
- "//embdrv/sbc/encoder/include",
- "//hci/include",
- "//internal_include",
- "//stack/a2dp",
- "//stack/btm",
- "//stack/include",
- "//third_party/tinyxml2",
- "//udrv/include",
- "//utils/include",
- "//vnd/include"
+ "//bt/",
+ "//bt/bta/eatt",
+ "//bt/bta/include",
+ "//bt/bta/sys",
+ "//bt/btcore/include",
+ "//bt/embdrv/sbc/encoder/include",
+ "//bt/hci/include",
+ "//bt/internal_include",
+ "//bt/stack/a2dp",
+ "//bt/stack/btm",
+ "//bt/stack/include",
+ "//bt/udrv/include",
+ "//bt/utils/include",
+ "//bt/vnd/include"
]
libs = [
@@ -237,16 +252,20 @@ executable("stack_unittests") {
deps = [
":stack",
- "//osi",
- "//btcore",
- "//device",
- "//embdrv/sbc",
- "//embdrv/g722",
- "//hci",
- "//types",
- "//main:bluetooth",
- "//third_party/googletest:gmock_main",
- "//third_party/libchrome:base",
+ "//bt/osi",
+ "//bt/btcore",
+ "//bt/device",
+ "//bt/embdrv/sbc",
+ "//bt/embdrv/g722",
+ "//bt/hci",
+ "//bt/types",
+ "//bt/main:bluetooth",
+ ]
+
+ configs += [
+ "//bt:external_tinyxml2",
+ "//bt:external_gmock_main",
+ "//bt:external_libchrome",
]
}
@@ -257,13 +276,16 @@ executable("net_test_stack_crypto_toolbox") {
]
include_dirs = [
- "//",
+ "//bt/",
]
deps = [
":crypto_toolbox",
- "//third_party/googletest:gmock_main",
- "//third_party/libchrome:base",
+ ]
+
+ configs += [
+ "//bt:external_gmock_main",
+ "//bt:external_libchrome",
]
}
@@ -281,26 +303,25 @@ executable("net_test_stack_smp") {
]
include_dirs = [
- "//",
- "//linux_include",
- "//internal_include",
- "//btcore/include",
- "//hci/include",
- "//utils/include",
- "//bta/include",
- "//bta/sys",
- "//btcore/include",
- "//embdrv/sbc/encoder/include",
- "//hci/include",
- "//internal_include",
- "//stack/a2dp",
- "//stack/l2cap",
- "//stack/btm",
- "//stack/include",
- "//third_party/tinyxml2",
- "//udrv/include",
- "//utils/include",
- "//vnd/include"
+ "//bt/",
+ "//bt/linux_include",
+ "//bt/internal_include",
+ "//bt/btcore/include",
+ "//bt/hci/include",
+ "//bt/utils/include",
+ "//bt/bta/include",
+ "//bt/bta/sys",
+ "//bt/btcore/include",
+ "//bt/embdrv/sbc/encoder/include",
+ "//bt/hci/include",
+ "//bt/internal_include",
+ "//bt/stack/a2dp",
+ "//bt/stack/l2cap",
+ "//bt/stack/btm",
+ "//bt/stack/include",
+ "//bt/udrv/include",
+ "//bt/utils/include",
+ "//bt/vnd/include"
]
libs = [
@@ -314,10 +335,14 @@ executable("net_test_stack_smp") {
deps = [
":crypto_toolbox",
- "//osi",
- "//types",
- "//third_party/googletest:gmock_main",
- "//third_party/libchrome:base",
+ "//bt/osi",
+ "//bt/types",
+ ]
+
+ configs += [
+ "//bt:external_tinyxml2",
+ "//bt:external_gmock_main",
+ "//bt:target_defaults",
]
}
@@ -330,11 +355,11 @@ executable("net_test_stack_multi_adv") {
include_dirs = [
"include",
- "//",
- "//btcore/include",
- "//hci/include",
- "//internal_include",
- "//stack/btm",
+ "//bt/",
+ "//bt/btcore/include",
+ "//bt/hci/include",
+ "//bt/internal_include",
+ "//bt/stack/btm",
]
libs = [
@@ -347,9 +372,12 @@ executable("net_test_stack_multi_adv") {
]
deps = [
- "//types",
- "//third_party/googletest:gmock_main",
- "//third_party/libchrome:base",
+ "//bt/types",
+ ]
+
+ configs += [
+ "//bt:external_gmock_main",
+ "//bt:target_defaults",
]
}
diff --git a/stack/a2dp/a2dp_aac_decoder.cc b/stack/a2dp/a2dp_aac_decoder.cc
index 55c020d04..0dcd5adf8 100644
--- a/stack/a2dp/a2dp_aac_decoder.cc
+++ b/stack/a2dp/a2dp_aac_decoder.cc
@@ -18,7 +18,11 @@
#include "a2dp_aac_decoder.h"
+#ifdef OS_ANDROID
#include <aacdecoder_lib.h>
+#else
+#include <fdk-aac/aacdecoder_lib.h>
+#endif
#include <base/logging.h>
#include "a2dp_aac.h"
diff --git a/stack/a2dp/a2dp_aac_encoder.cc b/stack/a2dp/a2dp_aac_encoder.cc
index b0f3dcb38..171db3996 100644
--- a/stack/a2dp/a2dp_aac_encoder.cc
+++ b/stack/a2dp/a2dp_aac_encoder.cc
@@ -23,7 +23,11 @@
#include <stdio.h>
#include <string.h>
+#ifdef OS_ANDROID
#include <aacenc_lib.h>
+#else
+#include <fdk-aac/aacenc_lib.h>
+#endif
#include <base/logging.h>
#include "a2dp_aac.h"
diff --git a/stack/btm/security_device_record.h b/stack/btm/security_device_record.h
index e68ae93cc..fefa6ccf1 100644
--- a/stack/btm/security_device_record.h
+++ b/stack/btm/security_device_record.h
@@ -19,6 +19,7 @@
#pragma once
#include <base/strings/stringprintf.h>
+#include <string.h>
#include <cstdint>
#include <string>
diff --git a/stack/hcic/hciblecmds.cc b/stack/hcic/hciblecmds.cc
index 92a15c300..bc18dd62d 100644
--- a/stack/hcic/hciblecmds.cc
+++ b/stack/hcic/hciblecmds.cc
@@ -29,6 +29,8 @@
#include "hcidefs.h"
#include "hcimsgs.h"
+#include <bitset>
+
#include <base/bind.h>
#include <stddef.h>
#include <string.h>
diff --git a/stack/include/bt_types.h b/stack/include/bt_types.h
index 1fbdbd991..c1ac7e8c6 100644
--- a/stack/include/bt_types.h
+++ b/stack/include/bt_types.h
@@ -234,7 +234,7 @@ typedef struct {
#define BT_HDR_SIZE (sizeof(BT_HDR))
-enum : uint16_t {
+enum {
BT_PSM_SDP = 0x0001,
BT_PSM_RFCOMM = 0x0003,
BT_PSM_TCS = 0x0005,
@@ -667,7 +667,7 @@ typedef uint8_t COF[COF_LEN]; /* ciphering offset number */
/* Device Types
*/
-enum : uint8_t {
+enum {
BT_DEVICE_TYPE_BREDR = (1 << 0),
BT_DEVICE_TYPE_BLE = (1 << 1),
BT_DEVICE_TYPE_DUMO = BT_DEVICE_TYPE_BREDR | BT_DEVICE_TYPE_BLE,
diff --git a/test/suite/BUILD.gn b/test/suite/BUILD.gn
index 7e68a1a95..2cb68f1c2 100644
--- a/test/suite/BUILD.gn
+++ b/test/suite/BUILD.gn
@@ -22,19 +22,22 @@ executable("net_test_bluetooth") {
]
include_dirs = [
- "//",
- "//test/suite",
+ "//bt",
+ "//bt/test/suite",
]
deps = [
- "//btcore",
- "//main:bluetooth",
- "//service:service",
- "//service:service_unittests",
- "//types:types_unittests",
- "//third_party/libchrome:base",
- "//osi",
- "//third_party/googletest:gtest_main",
+ "//bt/btcore",
+ "//bt/main:bluetooth",
+ "//bt/service:service",
+ "//bt/service:service_unittests",
+ "//bt/types:types_unittests",
+ "//bt/osi",
+ ]
+
+ configs += [
+ "//bt:external_libchrome",
+ "//bt:external_gtest_main",
]
libs = [
diff --git a/types/BUILD.gn b/types/BUILD.gn
index fa9a4af4c..08ab05cf0 100644
--- a/types/BUILD.gn
+++ b/types/BUILD.gn
@@ -21,16 +21,15 @@ static_library("types") {
sources = [
"bluetooth/uuid.cc",
- "le_address.cc",
"raw_address.cc",
]
include_dirs = [
- "//",
+ "//bt/",
]
- deps = [
- "//third_party/libchrome:base",
+ configs += [
+ "//bt:external_libchrome",
]
}
@@ -42,7 +41,7 @@ executable("types_unittests") {
]
include_dirs = [
- "//",
+ "//bt/",
]
libs = [
@@ -55,8 +54,11 @@ executable("types_unittests") {
]
deps = [
- "//types",
- "//third_party/googletest:gmock_main",
- "//third_party/libchrome:base",
+ "//bt/types",
+ ]
+
+ configs += [
+ "//bt:external_gmock_main",
+ "//bt:external_libchrome",
]
}
diff --git a/types/bluetooth/uuid.cc b/types/bluetooth/uuid.cc
index 28c67186b..d05f4370f 100644
--- a/types/bluetooth/uuid.cc
+++ b/types/bluetooth/uuid.cc
@@ -20,6 +20,7 @@
#include <base/rand_util.h>
#include <base/strings/stringprintf.h>
+#include <string.h>
#include <algorithm>
namespace bluetooth {
@@ -173,4 +174,4 @@ std::string Uuid::ToString() const {
uu[0], uu[1], uu[2], uu[3], uu[4], uu[5], uu[6], uu[7], uu[8], uu[9],
uu[10], uu[11], uu[12], uu[13], uu[14], uu[15]);
}
-} // namespace bluetooth \ No newline at end of file
+} // namespace bluetooth
diff --git a/udrv/BUILD.gn b/udrv/BUILD.gn
index 3712bd418..b42932e66 100644
--- a/udrv/BUILD.gn
+++ b/udrv/BUILD.gn
@@ -22,10 +22,13 @@ source_set("udrv") {
include_dirs = [
"include",
"uipc",
- "//",
- "//internal_include",
- "//stack/include",
- "//utils/include",
- "//third_party/libchrome",
+ "//bt/",
+ "//bt/internal_include",
+ "//bt/stack/include",
+ "//bt/utils/include",
+ ]
+
+ configs += [
+ "//bt:target_defaults"
]
}
diff --git a/utils/BUILD.gn b/utils/BUILD.gn
index 46b7236d0..f92942d50 100644
--- a/utils/BUILD.gn
+++ b/utils/BUILD.gn
@@ -21,9 +21,16 @@ static_library("utils") {
include_dirs = [
"include",
- "//",
- "//stack/include",
- "//third_party/libchrome",
- "//third_party/googletest/googletest/include/",
+ "//bt/",
+ "//bt/stack/include",
+ ]
+
+ configs += [
+ "//bt:target_defaults",
+ "//bt:external_gtest"
+ ]
+
+ deps = [
+ "//bt/gd/rust/shim:init_flags_bridge_header",
]
}
diff --git a/vendor_libs/test_vendor_lib/types/BUILD.gn b/vendor_libs/test_vendor_lib/types/BUILD.gn
index 68f76e3c5..dac333c32 100644
--- a/vendor_libs/test_vendor_lib/types/BUILD.gn
+++ b/vendor_libs/test_vendor_lib/types/BUILD.gn
@@ -26,11 +26,11 @@ static_library("types") {
]
include_dirs = [
- "//",
+ "//bt",
]
- deps = [
- "//third_party/libchrome:base",
+ configs += [
+ "//bt:external_libchrome",
]
}
@@ -42,7 +42,7 @@ executable("types_unittests") {
]
include_dirs = [
- "//",
+ "//bt",
]
libs = [
@@ -55,8 +55,11 @@ executable("types_unittests") {
]
deps = [
- "//types",
- "//third_party/googletest:gmock_main",
- "//third_party/libchrome:base",
+ "//bt/types",
+ ]
+
+ configs += [
+ "//bt:external_gmock_main",
+ "//bt:external_libchrome",
]
}