blob: 62ced34597ed9684315876667bb53c5ebbe70540 [file] [log] [blame]
Abhishek Pandit-Subedi947d4682021-11-12 15:52:11 -08001#
2# Copyright 2015 Google, Inc.
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at:
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15#
16
17# This is the root build file for GN. GN will start processing by loading this
18# file, and recursively load all dependencies until all dependencies are either
19# resolved or known not to exist (which will cause the build to fail). So if
20# you add a new build file, there must be some path of dependencies from this
21# file to your new one or GN won't know about it.
22
23group("all") {
24 deps = [ ":bluetooth" ]
25
26 #if (use.test) {
27 #deps += [ ":bluetooth_tests" ]
28 #}
29}
30
31# This pulls in main/BUILD.gn and all of its dependencies.
32group("bluetooth") {
33 deps = [
34 "//bt/system/main:bluetooth",
35 "//bt/system/main:bluetooth-static",
36 #"//bt/system/service:bluetoothtbd",
37 ]
38}
39
40# TODO(b/190750167) - Re-enable once we're fully Bazel build
41#if (use.test) {
42 #group("bluetooth_tests") {
43 #deps = [
44 #"//bt/system/btcore:net_test_btcore",
45 #"//bt/system/common:bluetooth_test_common",
46 #"//bt/system/profile/avrcp:net_test_avrcp",
47 #"//bt/system/service:bluetoothtbd_test",
48 #"//bt/system/stack:net_test_btm_iso",
49 #"//bt/system/types:net_test_types",
50
51 ##"//bt/system/packet:net_test_btpackets",
52 #]
53 #}
54#}
55
Abhishek Pandit-Subedi4d09c9e2021-11-19 11:26:18 -080056group("tools") {
57 deps = [
58 "//bt/system/gd/dumpsys/bundler:bluetooth_flatbuffer_bundler",
59 "//bt/system/gd/packet/parser:bluetooth_packetgen",
60 ]
Abhishek Pandit-Subedi947d4682021-11-12 15:52:11 -080061}
62
63if (defined(use.android) && use.android) {
64 group("android_bluetooth_tests") {
65 deps = [
66 "//bt/system/device:net_test_device",
MichaƂ Narajowskif36760d2023-01-12 10:26:30 +000067 "//bt/system/device:net_test_device_iot_config",
Abhishek Pandit-Subedi947d4682021-11-12 15:52:11 -080068 "//bt/system/hci:net_test_hci",
69 "//bt/system/osi:net_test_osi",
70 "//bt/system/test/suite:net_test_bluetooth",
71 ]
72 }
73}
74
75config("target_defaults") {
76 include_dirs = [
77 "//bt/system",
William Escande6c8ff0c2023-11-07 17:27:24 -080078 "//bt/flags/exported_include",
William Escande8fc34c42023-11-13 16:17:11 -080079 "//bt/sysprop/exported_include",
Abhishek Pandit-Subedi947d4682021-11-12 15:52:11 -080080 "//bt/system/linux_include",
81 "//bt/system/types",
82 "//bt/system/include",
Hui Peng896fe4e2022-10-28 11:32:42 +000083 "//bt/system/gd",
Abhishek Pandit-Subedi947d4682021-11-12 15:52:11 -080084
85 # For flatbuffer generated headers
86 "${root_gen_dir}/bt/system/gd/",
87 "${root_gen_dir}/bt/system/gd/dumpsys/bundler",
88 ]
89
90 cflags = [
91 "-fPIC",
92 "-Wno-non-c-typedef-for-linkage",
93 "-Wno-unreachable-code-return",
94 "-Wno-defaulted-function-deleted",
95 "-Wno-gnu-variable-sized-type-not-at-end",
96 "-Wno-format-nonliteral",
97 "-Wno-inconsistent-missing-override",
98 "-Wno-unreachable-code",
99 "-Wno-range-loop-construct",
100 "-Wno-reorder-init-list",
101 "-Wno-unused-function",
102 "-Wno-unused-result",
103 "-Wno-unused-variable",
104 "-Wno-unused-const-variable",
105 "-Wno-format",
106 "-Wno-pessimizing-move",
107 "-Wno-unknown-warning-option",
108 "-Wno-final-dtor-non-final-class",
Abhishek Pandit-Subedi4d0205d2021-12-10 19:46:58 -0800109
Michael Sune695da42022-07-07 21:23:43 -0700110 string_join("",
111 [
112 "-ffile-prefix-map=",
113 rebase_path(".", "${root_build_dir}", "."),
114 "/= ",
115 ]),
Abhishek Pandit-Subedi947d4682021-11-12 15:52:11 -0800116 ]
117
Yi Xiec4caa442023-09-14 16:36:52 +0900118 cflags_cc = [ "-std=c++20" ]
Abhishek Pandit-Subedi947d4682021-11-12 15:52:11 -0800119
120 defines = [
Abhishek Pandit-Subedi947d4682021-11-12 15:52:11 -0800121 "TARGET_FLOSS",
122 "EXPORT_SYMBOL=__attribute__((visibility(\"default\")))",
123 "FALLTHROUGH_INTENDED=[[clang::fallthrough]]",
Abhishek Pandit-Subedi947d4682021-11-12 15:52:11 -0800124 ]
125
Abhishek Pandit-Subedi947d4682021-11-12 15:52:11 -0800126 if (!(defined(use.bt_nonstandard_codecs) && use.bt_nonstandard_codecs)) {
127 defines += [ "EXCLUDE_NONSTANDARD_CODECS" ]
128 }
129
130 configs = [ ":external_libchrome" ]
Michael Sune695da42022-07-07 21:23:43 -0700131
132 if (target_os == "chromeos") {
133 configs += [ ":external_chromeos" ]
134 }
Abhishek Pandit-Subedi947d4682021-11-12 15:52:11 -0800135}
136
137group("libbt-platform-protos-lite") {
138 deps = [
139 "//external/proto_logging/stats/enums/bluetooth:libbt-platform-protos-lite",
140 ]
141}
142
143# Configurations to use as dependencies for GN build
144config("external_gtest") {
145 configs = [
146 ":pkg_gtest",
147 ":pkg_gmock",
148 ]
149}
150
151config("external_gtest_main") {
152 configs = [ ":pkg_gtest_main" ]
153}
154
155config("external_gmock_main") {
156 configs = [ ":pkg_gmock_main" ]
157}
158
159config("external_libchrome") {
160 configs = [ ":pkg_libchrome" ]
161}
162
163config("external_modp_b64") {
164 configs = [ ":pkg_modp_b64" ]
165}
166
167config("external_tinyxml2") {
168 configs = [ ":pkg_tinyxml2" ]
169}
170
171config("external_flatbuffers") {
172 lib_dirs = [ "${libdir}" ]
173
174 libs = [ "flatbuffers" ]
175}
176
Henri Chatainge08cbed2023-10-20 09:06:51 -0700177config("external_fmtlib") {
178 configs = [ ":pkg_fmtlib" ]
179}
180
Abhishek Pandit-Subedi947d4682021-11-12 15:52:11 -0800181# Package configurations to extract dependencies from env
182pkg_config("pkg_gtest") {
183 pkg_deps = [ "gtest" ]
184}
185
186pkg_config("pkg_gtest_main") {
187 pkg_deps = [ "gtest_main" ]
188}
189
190pkg_config("pkg_gmock") {
191 pkg_deps = [ "gmock" ]
192}
193
194pkg_config("pkg_gmock_main") {
195 pkg_deps = [ "gmock_main" ]
196}
197
198pkg_config("pkg_libchrome") {
199 pkg_deps = [ "libchrome" ]
200}
201
202pkg_config("pkg_modp_b64") {
203 pkg_deps = [ "libmodp_b64" ]
204}
205
206pkg_config("pkg_tinyxml2") {
207 pkg_deps = [ "tinyxml2" ]
208}
209
Henri Chatainge08cbed2023-10-20 09:06:51 -0700210pkg_config("pkd_fmtlib") {
211 pkg_deps = [ "fmt" ]
212}
213
Michael Sune695da42022-07-07 21:23:43 -0700214# To include ChroemOS-specific libraries and build dependencies.
215if (target_os == "chromeos") {
216 config("external_chromeos") {
217 configs = [ ":pkgpkg_libstructuredmetrics" ]
218 }
219
220 pkg_config("pkgpkg_libstructuredmetrics") {
221 pkg_deps = [ "libstructuredmetrics" ]
222 }
223}