Abhishek Pandit-Subedi | 947d468 | 2021-11-12 15:52:11 -0800 | [diff] [blame] | 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 | |
| 23 | group("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. |
| 32 | group("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-Subedi | 4d09c9e | 2021-11-19 11:26:18 -0800 | [diff] [blame] | 56 | group("tools") { |
| 57 | deps = [ |
| 58 | "//bt/system/gd/dumpsys/bundler:bluetooth_flatbuffer_bundler", |
| 59 | "//bt/system/gd/packet/parser:bluetooth_packetgen", |
| 60 | ] |
Abhishek Pandit-Subedi | 947d468 | 2021-11-12 15:52:11 -0800 | [diff] [blame] | 61 | } |
| 62 | |
| 63 | if (defined(use.android) && use.android) { |
| 64 | group("android_bluetooth_tests") { |
| 65 | deps = [ |
| 66 | "//bt/system/device:net_test_device", |
MichaĆ Narajowski | f36760d | 2023-01-12 10:26:30 +0000 | [diff] [blame] | 67 | "//bt/system/device:net_test_device_iot_config", |
Abhishek Pandit-Subedi | 947d468 | 2021-11-12 15:52:11 -0800 | [diff] [blame] | 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 | |
| 75 | config("target_defaults") { |
| 76 | include_dirs = [ |
| 77 | "//bt/system", |
| 78 | "//bt/system/linux_include", |
| 79 | "//bt/system/types", |
| 80 | "//bt/system/include", |
Hui Peng | 896fe4e | 2022-10-28 11:32:42 +0000 | [diff] [blame] | 81 | "//bt/system/gd", |
Abhishek Pandit-Subedi | 947d468 | 2021-11-12 15:52:11 -0800 | [diff] [blame] | 82 | |
| 83 | # For flatbuffer generated headers |
| 84 | "${root_gen_dir}/bt/system/gd/", |
| 85 | "${root_gen_dir}/bt/system/gd/dumpsys/bundler", |
| 86 | ] |
| 87 | |
| 88 | cflags = [ |
| 89 | "-fPIC", |
| 90 | "-Wno-non-c-typedef-for-linkage", |
| 91 | "-Wno-unreachable-code-return", |
| 92 | "-Wno-defaulted-function-deleted", |
| 93 | "-Wno-gnu-variable-sized-type-not-at-end", |
| 94 | "-Wno-format-nonliteral", |
| 95 | "-Wno-inconsistent-missing-override", |
| 96 | "-Wno-unreachable-code", |
| 97 | "-Wno-range-loop-construct", |
| 98 | "-Wno-reorder-init-list", |
| 99 | "-Wno-unused-function", |
| 100 | "-Wno-unused-result", |
| 101 | "-Wno-unused-variable", |
| 102 | "-Wno-unused-const-variable", |
| 103 | "-Wno-format", |
| 104 | "-Wno-pessimizing-move", |
| 105 | "-Wno-unknown-warning-option", |
| 106 | "-Wno-final-dtor-non-final-class", |
Abhishek Pandit-Subedi | 4d0205d | 2021-12-10 19:46:58 -0800 | [diff] [blame] | 107 | |
Michael Sun | e695da4 | 2022-07-07 21:23:43 -0700 | [diff] [blame] | 108 | string_join("", |
| 109 | [ |
| 110 | "-ffile-prefix-map=", |
| 111 | rebase_path(".", "${root_build_dir}", "."), |
| 112 | "/= ", |
| 113 | ]), |
Abhishek Pandit-Subedi | 947d468 | 2021-11-12 15:52:11 -0800 | [diff] [blame] | 114 | ] |
| 115 | |
Michael Sun | e695da4 | 2022-07-07 21:23:43 -0700 | [diff] [blame] | 116 | cflags_cc = [ "-std=c++17" ] |
Abhishek Pandit-Subedi | 947d468 | 2021-11-12 15:52:11 -0800 | [diff] [blame] | 117 | |
| 118 | defines = [ |
Abhishek Pandit-Subedi | 947d468 | 2021-11-12 15:52:11 -0800 | [diff] [blame] | 119 | "TARGET_FLOSS", |
| 120 | "EXPORT_SYMBOL=__attribute__((visibility(\"default\")))", |
| 121 | "FALLTHROUGH_INTENDED=[[clang::fallthrough]]", |
En-Shuo Hsu | 98e3822 | 2022-09-11 11:55:59 -0700 | [diff] [blame] | 122 | # BTA_AG_FEAT_ECS (Enhanced Call Status 0x040) | |
| 123 | # BTA_AG_FEAT_CODEC (Codec Negotiation 0x200) |
| 124 | "BTIF_HF_FEATURES=0x00000240", |
Abhishek Pandit-Subedi | 947d468 | 2021-11-12 15:52:11 -0800 | [diff] [blame] | 125 | ] |
| 126 | |
Abhishek Pandit-Subedi | 947d468 | 2021-11-12 15:52:11 -0800 | [diff] [blame] | 127 | if (!(defined(use.bt_nonstandard_codecs) && use.bt_nonstandard_codecs)) { |
| 128 | defines += [ "EXCLUDE_NONSTANDARD_CODECS" ] |
| 129 | } |
| 130 | |
| 131 | configs = [ ":external_libchrome" ] |
Michael Sun | e695da4 | 2022-07-07 21:23:43 -0700 | [diff] [blame] | 132 | |
| 133 | if (target_os == "chromeos") { |
| 134 | configs += [ ":external_chromeos" ] |
| 135 | } |
Abhishek Pandit-Subedi | 947d468 | 2021-11-12 15:52:11 -0800 | [diff] [blame] | 136 | } |
| 137 | |
| 138 | group("libbt-platform-protos-lite") { |
| 139 | deps = [ |
| 140 | "//external/proto_logging/stats/enums/bluetooth:libbt-platform-protos-lite", |
| 141 | ] |
| 142 | } |
| 143 | |
| 144 | # Configurations to use as dependencies for GN build |
| 145 | config("external_gtest") { |
| 146 | configs = [ |
| 147 | ":pkg_gtest", |
| 148 | ":pkg_gmock", |
| 149 | ] |
| 150 | } |
| 151 | |
| 152 | config("external_gtest_main") { |
| 153 | configs = [ ":pkg_gtest_main" ] |
| 154 | } |
| 155 | |
| 156 | config("external_gmock_main") { |
| 157 | configs = [ ":pkg_gmock_main" ] |
| 158 | } |
| 159 | |
| 160 | config("external_libchrome") { |
| 161 | configs = [ ":pkg_libchrome" ] |
| 162 | } |
| 163 | |
| 164 | config("external_modp_b64") { |
| 165 | configs = [ ":pkg_modp_b64" ] |
| 166 | } |
| 167 | |
| 168 | config("external_tinyxml2") { |
| 169 | configs = [ ":pkg_tinyxml2" ] |
| 170 | } |
| 171 | |
| 172 | config("external_flatbuffers") { |
| 173 | lib_dirs = [ "${libdir}" ] |
| 174 | |
| 175 | libs = [ "flatbuffers" ] |
| 176 | } |
| 177 | |
| 178 | # Package configurations to extract dependencies from env |
| 179 | pkg_config("pkg_gtest") { |
| 180 | pkg_deps = [ "gtest" ] |
| 181 | } |
| 182 | |
| 183 | pkg_config("pkg_gtest_main") { |
| 184 | pkg_deps = [ "gtest_main" ] |
| 185 | } |
| 186 | |
| 187 | pkg_config("pkg_gmock") { |
| 188 | pkg_deps = [ "gmock" ] |
| 189 | } |
| 190 | |
| 191 | pkg_config("pkg_gmock_main") { |
| 192 | pkg_deps = [ "gmock_main" ] |
| 193 | } |
| 194 | |
| 195 | pkg_config("pkg_libchrome") { |
| 196 | pkg_deps = [ "libchrome" ] |
| 197 | } |
| 198 | |
| 199 | pkg_config("pkg_modp_b64") { |
| 200 | pkg_deps = [ "libmodp_b64" ] |
| 201 | } |
| 202 | |
| 203 | pkg_config("pkg_tinyxml2") { |
| 204 | pkg_deps = [ "tinyxml2" ] |
| 205 | } |
| 206 | |
| 207 | # To use non-standard codecs (i.e. ldac, aac, aptx), set this use flag when |
| 208 | # building. These codecs may have licensing issues that need to be resolved |
| 209 | # first. |
| 210 | if (defined(use.bt_nonstandard_codecs) && use.bt_nonstandard_codecs) { |
| 211 | config("external_aac") { |
| 212 | configs = [ ":pkg_aac" ] |
| 213 | } |
| 214 | |
| 215 | pkg_config("pkg_aac") { |
| 216 | pkg_deps = [ "fdk-aac" ] |
| 217 | } |
| 218 | |
| 219 | config("external_libldac") { |
| 220 | configs = [ |
| 221 | ":pkg_libldacBT_enc", |
| 222 | ":pkg_libldacBT_abr", |
| 223 | ] |
| 224 | } |
| 225 | |
| 226 | pkg_config("pkg_libldacBT_enc") { |
| 227 | pkg_deps = [ "ldacBT-enc" ] |
| 228 | } |
| 229 | |
| 230 | pkg_config("pkg_libldacBT_abr") { |
| 231 | pkg_deps = [ "ldacBT-abr" ] |
| 232 | } |
| 233 | } |
Michael Sun | e695da4 | 2022-07-07 21:23:43 -0700 | [diff] [blame] | 234 | |
| 235 | # To include ChroemOS-specific libraries and build dependencies. |
| 236 | if (target_os == "chromeos") { |
| 237 | config("external_chromeos") { |
| 238 | configs = [ ":pkgpkg_libstructuredmetrics" ] |
| 239 | } |
| 240 | |
| 241 | pkg_config("pkgpkg_libstructuredmetrics") { |
| 242 | pkg_deps = [ "libstructuredmetrics" ] |
| 243 | } |
| 244 | } |