1#
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
56group("tools") {
57  deps = [
58    "//bt/system/gd/dumpsys/bundler:bluetooth_flatbuffer_bundler",
59    "//bt/system/gd/packet/parser:bluetooth_packetgen",
60  ]
61}
62
63if (defined(use.android) && use.android) {
64  group("android_bluetooth_tests") {
65    deps = [
66      "//bt/system/device:net_test_device",
67      "//bt/system/device:net_test_device_iot_config",
68      "//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",
78    "//bt/flags/exported_include",
79    "//bt/sysprop/exported_include",
80    "//bt/system/linux_include",
81    "//bt/system/types",
82    "//bt/system/include",
83    "//bt/system/gd",
84
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",
109
110    string_join("",
111                [
112                  "-ffile-prefix-map=",
113                  rebase_path(".", "${root_build_dir}", "."),
114                  "/= ",
115                ]),
116  ]
117
118  cflags_cc = [ "-std=c++20" ]
119
120  defines = [
121    "TARGET_FLOSS",
122    "EXPORT_SYMBOL=__attribute__((visibility(\"default\")))",
123    "FALLTHROUGH_INTENDED=[[clang::fallthrough]]",
124  ]
125
126  if (!(defined(use.bt_nonstandard_codecs) && use.bt_nonstandard_codecs)) {
127    defines += [ "EXCLUDE_NONSTANDARD_CODECS" ]
128  }
129
130  configs = [ ":external_libchrome" ]
131
132  if (target_os == "chromeos") {
133    configs += [ ":external_chromeos" ]
134  }
135}
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
177config("external_fmtlib") {
178  configs = [ ":pkg_fmtlib" ]
179}
180
181# 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
210pkg_config("pkd_fmtlib") {
211  pkg_deps = [ "fmt" ]
212}
213
214# 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}
224