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", |
William Escande | 6c8ff0c | 2023-11-07 17:27:24 -0800 | [diff] [blame] | 78 | "//bt/flags/exported_include", |
William Escande | 8fc34c4 | 2023-11-13 16:17:11 -0800 | [diff] [blame] | 79 | "//bt/sysprop/exported_include", |
Abhishek Pandit-Subedi | 947d468 | 2021-11-12 15:52:11 -0800 | [diff] [blame] | 80 | "//bt/system/linux_include", |
| 81 | "//bt/system/types", |
| 82 | "//bt/system/include", |
Hui Peng | 896fe4e | 2022-10-28 11:32:42 +0000 | [diff] [blame] | 83 | "//bt/system/gd", |
Abhishek Pandit-Subedi | 947d468 | 2021-11-12 15:52:11 -0800 | [diff] [blame] | 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", |
Abhishek Pandit-Subedi | 4d0205d | 2021-12-10 19:46:58 -0800 | [diff] [blame] | 109 | |
Michael Sun | e695da4 | 2022-07-07 21:23:43 -0700 | [diff] [blame] | 110 | string_join("", |
| 111 | [ |
| 112 | "-ffile-prefix-map=", |
| 113 | rebase_path(".", "${root_build_dir}", "."), |
| 114 | "/= ", |
| 115 | ]), |
Abhishek Pandit-Subedi | 947d468 | 2021-11-12 15:52:11 -0800 | [diff] [blame] | 116 | ] |
| 117 | |
Yi Xie | c4caa44 | 2023-09-14 16:36:52 +0900 | [diff] [blame] | 118 | cflags_cc = [ "-std=c++20" ] |
Abhishek Pandit-Subedi | 947d468 | 2021-11-12 15:52:11 -0800 | [diff] [blame] | 119 | |
| 120 | defines = [ |
Abhishek Pandit-Subedi | 947d468 | 2021-11-12 15:52:11 -0800 | [diff] [blame] | 121 | "TARGET_FLOSS", |
| 122 | "EXPORT_SYMBOL=__attribute__((visibility(\"default\")))", |
| 123 | "FALLTHROUGH_INTENDED=[[clang::fallthrough]]", |
Abhishek Pandit-Subedi | 947d468 | 2021-11-12 15:52:11 -0800 | [diff] [blame] | 124 | ] |
| 125 | |
Abhishek Pandit-Subedi | 947d468 | 2021-11-12 15:52:11 -0800 | [diff] [blame] | 126 | if (!(defined(use.bt_nonstandard_codecs) && use.bt_nonstandard_codecs)) { |
| 127 | defines += [ "EXCLUDE_NONSTANDARD_CODECS" ] |
| 128 | } |
| 129 | |
| 130 | configs = [ ":external_libchrome" ] |
Michael Sun | e695da4 | 2022-07-07 21:23:43 -0700 | [diff] [blame] | 131 | |
| 132 | if (target_os == "chromeos") { |
| 133 | configs += [ ":external_chromeos" ] |
| 134 | } |
Abhishek Pandit-Subedi | 947d468 | 2021-11-12 15:52:11 -0800 | [diff] [blame] | 135 | } |
| 136 | |
| 137 | group("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 |
| 144 | config("external_gtest") { |
| 145 | configs = [ |
| 146 | ":pkg_gtest", |
| 147 | ":pkg_gmock", |
| 148 | ] |
| 149 | } |
| 150 | |
| 151 | config("external_gtest_main") { |
| 152 | configs = [ ":pkg_gtest_main" ] |
| 153 | } |
| 154 | |
| 155 | config("external_gmock_main") { |
| 156 | configs = [ ":pkg_gmock_main" ] |
| 157 | } |
| 158 | |
| 159 | config("external_libchrome") { |
| 160 | configs = [ ":pkg_libchrome" ] |
| 161 | } |
| 162 | |
| 163 | config("external_modp_b64") { |
| 164 | configs = [ ":pkg_modp_b64" ] |
| 165 | } |
| 166 | |
| 167 | config("external_tinyxml2") { |
| 168 | configs = [ ":pkg_tinyxml2" ] |
| 169 | } |
| 170 | |
| 171 | config("external_flatbuffers") { |
| 172 | lib_dirs = [ "${libdir}" ] |
| 173 | |
| 174 | libs = [ "flatbuffers" ] |
| 175 | } |
| 176 | |
Henri Chataing | e08cbed | 2023-10-20 09:06:51 -0700 | [diff] [blame] | 177 | config("external_fmtlib") { |
| 178 | configs = [ ":pkg_fmtlib" ] |
| 179 | } |
| 180 | |
Abhishek Pandit-Subedi | 947d468 | 2021-11-12 15:52:11 -0800 | [diff] [blame] | 181 | # Package configurations to extract dependencies from env |
| 182 | pkg_config("pkg_gtest") { |
| 183 | pkg_deps = [ "gtest" ] |
| 184 | } |
| 185 | |
| 186 | pkg_config("pkg_gtest_main") { |
| 187 | pkg_deps = [ "gtest_main" ] |
| 188 | } |
| 189 | |
| 190 | pkg_config("pkg_gmock") { |
| 191 | pkg_deps = [ "gmock" ] |
| 192 | } |
| 193 | |
| 194 | pkg_config("pkg_gmock_main") { |
| 195 | pkg_deps = [ "gmock_main" ] |
| 196 | } |
| 197 | |
| 198 | pkg_config("pkg_libchrome") { |
| 199 | pkg_deps = [ "libchrome" ] |
| 200 | } |
| 201 | |
| 202 | pkg_config("pkg_modp_b64") { |
| 203 | pkg_deps = [ "libmodp_b64" ] |
| 204 | } |
| 205 | |
| 206 | pkg_config("pkg_tinyxml2") { |
| 207 | pkg_deps = [ "tinyxml2" ] |
| 208 | } |
| 209 | |
Henri Chataing | e08cbed | 2023-10-20 09:06:51 -0700 | [diff] [blame] | 210 | pkg_config("pkd_fmtlib") { |
| 211 | pkg_deps = [ "fmt" ] |
| 212 | } |
| 213 | |
Michael Sun | e695da4 | 2022-07-07 21:23:43 -0700 | [diff] [blame] | 214 | # To include ChroemOS-specific libraries and build dependencies. |
| 215 | if (target_os == "chromeos") { |
| 216 | config("external_chromeos") { |
| 217 | configs = [ ":pkgpkg_libstructuredmetrics" ] |
| 218 | } |
| 219 | |
| 220 | pkg_config("pkgpkg_libstructuredmetrics") { |
| 221 | pkg_deps = [ "libstructuredmetrics" ] |
| 222 | } |
| 223 | } |