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", |
| 67 | "//bt/system/hci:net_test_hci", |
| 68 | "//bt/system/osi:net_test_osi", |
| 69 | "//bt/system/test/suite:net_test_bluetooth", |
| 70 | ] |
| 71 | } |
| 72 | } |
| 73 | |
| 74 | config("target_defaults") { |
| 75 | include_dirs = [ |
| 76 | "//bt/system", |
| 77 | "//bt/system/linux_include", |
| 78 | "//bt/system/types", |
| 79 | "//bt/system/include", |
| 80 | |
| 81 | # For flatbuffer generated headers |
| 82 | "${root_gen_dir}/bt/system/gd/", |
| 83 | "${root_gen_dir}/bt/system/gd/dumpsys/bundler", |
| 84 | ] |
| 85 | |
| 86 | cflags = [ |
| 87 | "-fPIC", |
| 88 | "-Wno-non-c-typedef-for-linkage", |
| 89 | "-Wno-unreachable-code-return", |
| 90 | "-Wno-defaulted-function-deleted", |
| 91 | "-Wno-gnu-variable-sized-type-not-at-end", |
| 92 | "-Wno-format-nonliteral", |
| 93 | "-Wno-inconsistent-missing-override", |
| 94 | "-Wno-unreachable-code", |
| 95 | "-Wno-range-loop-construct", |
| 96 | "-Wno-reorder-init-list", |
| 97 | "-Wno-unused-function", |
| 98 | "-Wno-unused-result", |
| 99 | "-Wno-unused-variable", |
| 100 | "-Wno-unused-const-variable", |
| 101 | "-Wno-format", |
| 102 | "-Wno-pessimizing-move", |
| 103 | "-Wno-unknown-warning-option", |
| 104 | "-Wno-final-dtor-non-final-class", |
Abhishek Pandit-Subedi | 4d0205d | 2021-12-10 19:46:58 -0800 | [diff] [blame] | 105 | |
| 106 | string_join("", ["-ffile-prefix-map=", rebase_path(".", "${root_build_dir}", "."), "/= "]) |
Abhishek Pandit-Subedi | 947d468 | 2021-11-12 15:52:11 -0800 | [diff] [blame] | 107 | ] |
| 108 | |
| 109 | cflags_cc = [ |
| 110 | "-std=c++17", |
| 111 | ] |
| 112 | |
| 113 | defines = [ |
| 114 | "HAS_NO_BDROID_BUILDCFG", |
| 115 | "OS_GENERIC", |
| 116 | "OS_LINUX_GENERIC", |
| 117 | "TARGET_FLOSS", |
| 118 | "EXPORT_SYMBOL=__attribute__((visibility(\"default\")))", |
| 119 | "FALLTHROUGH_INTENDED=[[clang::fallthrough]]", |
En-Shuo Hsu | 3dcce00 | 2021-12-10 16:26:00 +0800 | [diff] [blame] | 120 | # TODO(b/214148074): Start with NB, should enable WB. |
| 121 | "DISABLE_WBS=TRUE", |
En-Shuo Hsu | e8ed8ed | 2022-02-25 23:47:12 +0000 | [diff] [blame] | 122 | # TODO(b/214149380): Start with Enhanced Call Status feature supported. |
| 123 | # Should enable required features in the future. |
En-Shuo Hsu | 3dcce00 | 2021-12-10 16:26:00 +0800 | [diff] [blame] | 124 | # This will be consumed by BTA_AgRegister and passed to HF through AT+BRSF. |
En-Shuo Hsu | e8ed8ed | 2022-02-25 23:47:12 +0000 | [diff] [blame] | 125 | "BTIF_HF_FEATURES=0x00000040" |
Abhishek Pandit-Subedi | 947d468 | 2021-11-12 15:52:11 -0800 | [diff] [blame] | 126 | ] |
| 127 | |
Abhishek Pandit-Subedi | 947d468 | 2021-11-12 15:52:11 -0800 | [diff] [blame] | 128 | if (!(defined(use.bt_nonstandard_codecs) && use.bt_nonstandard_codecs)) { |
| 129 | defines += [ "EXCLUDE_NONSTANDARD_CODECS" ] |
| 130 | } |
| 131 | |
| 132 | configs = [ ":external_libchrome" ] |
| 133 | } |
| 134 | |
| 135 | group("libbt-platform-protos-lite") { |
| 136 | deps = [ |
| 137 | "//external/proto_logging/stats/enums/bluetooth:libbt-platform-protos-lite", |
| 138 | ] |
| 139 | } |
| 140 | |
| 141 | # Configurations to use as dependencies for GN build |
| 142 | config("external_gtest") { |
| 143 | configs = [ |
| 144 | ":pkg_gtest", |
| 145 | ":pkg_gmock", |
| 146 | ] |
| 147 | } |
| 148 | |
| 149 | config("external_gtest_main") { |
| 150 | configs = [ ":pkg_gtest_main" ] |
| 151 | } |
| 152 | |
| 153 | config("external_gmock_main") { |
| 154 | configs = [ ":pkg_gmock_main" ] |
| 155 | } |
| 156 | |
| 157 | config("external_libchrome") { |
| 158 | configs = [ ":pkg_libchrome" ] |
| 159 | } |
| 160 | |
| 161 | config("external_modp_b64") { |
| 162 | configs = [ ":pkg_modp_b64" ] |
| 163 | } |
| 164 | |
| 165 | config("external_tinyxml2") { |
| 166 | configs = [ ":pkg_tinyxml2" ] |
| 167 | } |
| 168 | |
| 169 | config("external_flatbuffers") { |
| 170 | lib_dirs = [ "${libdir}" ] |
| 171 | |
| 172 | libs = [ "flatbuffers" ] |
| 173 | } |
| 174 | |
| 175 | # Package configurations to extract dependencies from env |
| 176 | pkg_config("pkg_gtest") { |
| 177 | pkg_deps = [ "gtest" ] |
| 178 | } |
| 179 | |
| 180 | pkg_config("pkg_gtest_main") { |
| 181 | pkg_deps = [ "gtest_main" ] |
| 182 | } |
| 183 | |
| 184 | pkg_config("pkg_gmock") { |
| 185 | pkg_deps = [ "gmock" ] |
| 186 | } |
| 187 | |
| 188 | pkg_config("pkg_gmock_main") { |
| 189 | pkg_deps = [ "gmock_main" ] |
| 190 | } |
| 191 | |
| 192 | pkg_config("pkg_libchrome") { |
| 193 | pkg_deps = [ "libchrome" ] |
| 194 | } |
| 195 | |
| 196 | pkg_config("pkg_modp_b64") { |
| 197 | pkg_deps = [ "libmodp_b64" ] |
| 198 | } |
| 199 | |
| 200 | pkg_config("pkg_tinyxml2") { |
| 201 | pkg_deps = [ "tinyxml2" ] |
| 202 | } |
| 203 | |
| 204 | # To use non-standard codecs (i.e. ldac, aac, aptx), set this use flag when |
| 205 | # building. These codecs may have licensing issues that need to be resolved |
| 206 | # first. |
| 207 | if (defined(use.bt_nonstandard_codecs) && use.bt_nonstandard_codecs) { |
| 208 | config("external_aac") { |
| 209 | configs = [ ":pkg_aac" ] |
| 210 | } |
| 211 | |
| 212 | pkg_config("pkg_aac") { |
| 213 | pkg_deps = [ "fdk-aac" ] |
| 214 | } |
| 215 | |
| 216 | config("external_libldac") { |
| 217 | configs = [ |
| 218 | ":pkg_libldacBT_enc", |
| 219 | ":pkg_libldacBT_abr", |
| 220 | ] |
| 221 | } |
| 222 | |
| 223 | pkg_config("pkg_libldacBT_enc") { |
| 224 | pkg_deps = [ "ldacBT-enc" ] |
| 225 | } |
| 226 | |
| 227 | pkg_config("pkg_libldacBT_abr") { |
| 228 | pkg_deps = [ "ldacBT-abr" ] |
| 229 | } |
| 230 | } |