Arman Uguray | 9ca3fb8 | 2015-05-26 14:50:36 -0700 | [diff] [blame] | 1 | # |
Jakub Pawlowski | 5b790fe | 2017-09-18 09:00:20 -0700 | [diff] [blame] | 2 | # Copyright 2015 Google, Inc. |
Arman Uguray | 9ca3fb8 | 2015-05-26 14:50:36 -0700 | [diff] [blame] | 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 | |
Abhishek Pandit-Subedi | 7396ad4 | 2021-01-08 19:53:23 -0800 | [diff] [blame] | 23 | group("all") { |
Abhishek Pandit-Subedi | 9eaf2ca | 2021-03-02 22:33:10 +0000 | [diff] [blame] | 24 | deps = [ ":bluetooth" ] |
Sonny Sasaka | 33cc2ad | 2021-02-03 19:14:56 +0000 | [diff] [blame] | 25 | |
| 26 | if (use.test) { |
Abhishek Pandit-Subedi | 9eaf2ca | 2021-03-02 22:33:10 +0000 | [diff] [blame] | 27 | deps += [ ":bluetooth_tests" ] |
Sonny Sasaka | 33cc2ad | 2021-02-03 19:14:56 +0000 | [diff] [blame] | 28 | } |
Abhishek Pandit-Subedi | 7396ad4 | 2021-01-08 19:53:23 -0800 | [diff] [blame] | 29 | } |
| 30 | |
Scott James Remnant | 4c29231 | 2015-05-12 13:58:49 -0700 | [diff] [blame] | 31 | # This pulls in main/BUILD.gn and all of its dependencies. |
| 32 | group("bluetooth") { |
| 33 | deps = [ |
Abhishek Pandit-Subedi | 7396ad4 | 2021-01-08 19:53:23 -0800 | [diff] [blame] | 34 | "//bt/main:bluetooth", |
Abhishek Pandit-Subedi | db473fa | 2021-03-15 13:54:19 -0700 | [diff] [blame] | 35 | "//bt/main:bluetooth-static", |
| 36 | #"//bt/service:bluetoothtbd", |
Scott James Remnant | 4c29231 | 2015-05-12 13:58:49 -0700 | [diff] [blame] | 37 | ] |
| 38 | } |
Marie Janssen | 3e54b60 | 2015-06-11 15:18:01 -0700 | [diff] [blame] | 39 | |
Sonny Sasaka | 33cc2ad | 2021-02-03 19:14:56 +0000 | [diff] [blame] | 40 | if (use.test) { |
| 41 | group("bluetooth_tests") { |
| 42 | deps = [ |
Sonny Sasaka | 33cc2ad | 2021-02-03 19:14:56 +0000 | [diff] [blame] | 43 | "//bt/btcore:net_test_btcore", |
Abhishek Pandit-Subedi | 9eaf2ca | 2021-03-02 22:33:10 +0000 | [diff] [blame] | 44 | "//bt/common:bluetooth_test_common", |
| 45 | "//bt/profile/avrcp:net_test_avrcp", |
| 46 | "//bt/service:bluetoothtbd_test", |
Sonny Sasaka | 33cc2ad | 2021-02-03 19:14:56 +0000 | [diff] [blame] | 47 | "//bt/stack:net_test_btm_iso", |
Abhishek Pandit-Subedi | 9eaf2ca | 2021-03-02 22:33:10 +0000 | [diff] [blame] | 48 | "//bt/types:net_test_types", |
| 49 | |
Sonny Sasaka | 33cc2ad | 2021-02-03 19:14:56 +0000 | [diff] [blame] | 50 | #"//bt/packet:net_test_btpackets", |
| 51 | ] |
| 52 | } |
| 53 | } |
Marie Janssen | 3e54b60 | 2015-06-11 15:18:01 -0700 | [diff] [blame] | 54 | |
Abhishek Pandit-Subedi | 9eaf2ca | 2021-03-02 22:33:10 +0000 | [diff] [blame] | 55 | if (host_cpu == target_cpu && host_os == target_os) { |
| 56 | group("tools") { |
| 57 | deps = [ |
| 58 | "//bt/gd/dumpsys/bundler:bluetooth_flatbuffer_bundler", |
| 59 | "//bt/gd/packet/parser:bluetooth_packetgen", |
| 60 | ] |
| 61 | } |
| 62 | } |
| 63 | |
Sonny Sasaka | 33cc2ad | 2021-02-03 19:14:56 +0000 | [diff] [blame] | 64 | if (defined(use.android) && use.android) { |
| 65 | group("android_bluetooth_tests") { |
| 66 | deps = [ |
Abhishek Pandit-Subedi | 9eaf2ca | 2021-03-02 22:33:10 +0000 | [diff] [blame] | 67 | "//bt/device:net_test_device", |
Sonny Sasaka | 33cc2ad | 2021-02-03 19:14:56 +0000 | [diff] [blame] | 68 | "//bt/hci:net_test_hci", |
| 69 | "//bt/osi:net_test_osi", |
Abhishek Pandit-Subedi | 9eaf2ca | 2021-03-02 22:33:10 +0000 | [diff] [blame] | 70 | "//bt/test/suite:net_test_bluetooth", |
Sonny Sasaka | 33cc2ad | 2021-02-03 19:14:56 +0000 | [diff] [blame] | 71 | ] |
| 72 | } |
Marie Janssen | 3e54b60 | 2015-06-11 15:18:01 -0700 | [diff] [blame] | 73 | } |
Abhishek Pandit-Subedi | 7396ad4 | 2021-01-08 19:53:23 -0800 | [diff] [blame] | 74 | |
| 75 | config("target_defaults") { |
| 76 | include_dirs = [ |
Sonny Sasaka | 33cc2ad | 2021-02-03 19:14:56 +0000 | [diff] [blame] | 77 | "//bt", |
Abhishek Pandit-Subedi | 7396ad4 | 2021-01-08 19:53:23 -0800 | [diff] [blame] | 78 | "//bt/linux_include", |
| 79 | "//bt/types", |
| 80 | "//bt/include", |
Abhishek Pandit-Subedi | 9eaf2ca | 2021-03-02 22:33:10 +0000 | [diff] [blame] | 81 | |
| 82 | # For flatbuffer generated headers |
| 83 | "${root_gen_dir}/bt/gd/", |
| 84 | "${root_gen_dir}/bt/gd/dumpsys/bundler", |
Abhishek Pandit-Subedi | 7396ad4 | 2021-01-08 19:53:23 -0800 | [diff] [blame] | 85 | ] |
| 86 | |
| 87 | cflags = [ |
Abhishek Pandit-Subedi | 7396ad4 | 2021-01-08 19:53:23 -0800 | [diff] [blame] | 88 | "-fPIC", |
| 89 | "-Wno-non-c-typedef-for-linkage", |
| 90 | "-Wno-unreachable-code-return", |
| 91 | "-Wno-defaulted-function-deleted", |
| 92 | "-Wno-gnu-variable-sized-type-not-at-end", |
| 93 | "-Wno-format-nonliteral", |
| 94 | "-Wno-inconsistent-missing-override", |
| 95 | "-Wno-unreachable-code", |
| 96 | "-Wno-range-loop-construct", |
| 97 | "-Wno-reorder-init-list", |
| 98 | "-Wno-unused-function", |
| 99 | "-Wno-unused-result", |
| 100 | "-Wno-unused-variable", |
| 101 | "-Wno-unused-const-variable", |
Sonny Sasaka | 5bc5b6c | 2021-02-08 22:09:59 -0800 | [diff] [blame] | 102 | "-Wno-format", |
Abhishek Pandit-Subedi | 9eaf2ca | 2021-03-02 22:33:10 +0000 | [diff] [blame] | 103 | "-Wno-pessimizing-move", |
| 104 | "-Wno-unknown-warning-option", |
| 105 | "-Wno-final-dtor-non-final-class", |
Abhishek Pandit-Subedi | 7396ad4 | 2021-01-08 19:53:23 -0800 | [diff] [blame] | 106 | ] |
| 107 | |
Abhishek Pandit-Subedi | 9956a0a | 2021-04-10 00:41:07 +0000 | [diff] [blame] | 108 | cflags_cc = [ |
| 109 | "-std=c++17", |
| 110 | ] |
Abhishek Pandit-Subedi | 7396ad4 | 2021-01-08 19:53:23 -0800 | [diff] [blame] | 111 | |
| 112 | defines = [ |
| 113 | "HAS_NO_BDROID_BUILDCFG", |
| 114 | "OS_GENERIC", |
Abhishek Pandit-Subedi | 9eaf2ca | 2021-03-02 22:33:10 +0000 | [diff] [blame] | 115 | "OS_LINUX_GENERIC", |
Abhishek Pandit-Subedi | e1ab5b8 | 2021-04-26 12:40:11 -0700 | [diff] [blame] | 116 | "TARGET_FLOSS", |
| 117 | "USE_LINUX_HCI_SOCKET", |
Abhishek Pandit-Subedi | 9eaf2ca | 2021-03-02 22:33:10 +0000 | [diff] [blame] | 118 | "EXPORT_SYMBOL=__attribute__((visibility(\"default\")))", |
| 119 | "FALLTHROUGH_INTENDED=[[clang::fallthrough]]", |
Abhishek Pandit-Subedi | 7396ad4 | 2021-01-08 19:53:23 -0800 | [diff] [blame] | 120 | ] |
| 121 | |
Abhishek Pandit-Subedi | ea1b00b | 2021-03-02 22:33:18 +0000 | [diff] [blame] | 122 | # If not configured as a dynamic library, default to static library |
| 123 | if (!(defined(use.bt_dynlib) && use.bt_dynlib)) { |
Abhishek Pandit-Subedi | 9956a0a | 2021-04-10 00:41:07 +0000 | [diff] [blame] | 124 | defines += [ |
Abhishek Pandit-Subedi | ea1b00b | 2021-03-02 22:33:18 +0000 | [diff] [blame] | 125 | "STATIC_LIBBLUETOOTH", |
| 126 | ] |
| 127 | } |
| 128 | |
Abhishek Pandit-Subedi | 9eaf2ca | 2021-03-02 22:33:10 +0000 | [diff] [blame] | 129 | if (!(defined(use.bt_nonstandard_codecs) && use.bt_nonstandard_codecs)) { |
| 130 | defines += [ "EXCLUDE_NONSTANDARD_CODECS" ] |
| 131 | } |
| 132 | |
| 133 | configs = [ ":external_libchrome" ] |
Abhishek Pandit-Subedi | 7396ad4 | 2021-01-08 19:53:23 -0800 | [diff] [blame] | 134 | } |
| 135 | |
Abhishek Pandit-Subedi | 6f798c8 | 2021-03-02 22:33:33 +0000 | [diff] [blame] | 136 | group("libbt-platform-protos-lite") { |
| 137 | deps = [ |
| 138 | "//external/proto_logging/stats/enums/bluetooth:libbt-platform-protos-lite", |
| 139 | ] |
| 140 | } |
| 141 | |
Abhishek Pandit-Subedi | 7396ad4 | 2021-01-08 19:53:23 -0800 | [diff] [blame] | 142 | # Configurations to use as dependencies for GN build |
| 143 | config("external_gtest") { |
| 144 | configs = [ |
| 145 | ":pkg_gtest", |
| 146 | ":pkg_gmock", |
| 147 | ] |
| 148 | } |
| 149 | |
| 150 | config("external_gtest_main") { |
| 151 | configs = [ ":pkg_gtest_main" ] |
| 152 | } |
| 153 | |
| 154 | config("external_gmock_main") { |
| 155 | configs = [ ":pkg_gmock_main" ] |
| 156 | } |
| 157 | |
| 158 | config("external_libchrome") { |
| 159 | configs = [ ":pkg_libchrome" ] |
| 160 | } |
| 161 | |
| 162 | config("external_modp_b64") { |
| 163 | configs = [ ":pkg_modp_b64" ] |
| 164 | } |
| 165 | |
| 166 | config("external_tinyxml2") { |
| 167 | configs = [ ":pkg_tinyxml2" ] |
| 168 | } |
| 169 | |
Abhishek Pandit-Subedi | 9eaf2ca | 2021-03-02 22:33:10 +0000 | [diff] [blame] | 170 | config("external_flatbuffers") { |
| 171 | lib_dirs = [ "${libdir}" ] |
| 172 | |
| 173 | libs = [ "flatbuffers" ] |
| 174 | } |
| 175 | |
Abhishek Pandit-Subedi | 7396ad4 | 2021-01-08 19:53:23 -0800 | [diff] [blame] | 176 | # Package configurations to extract dependencies from env |
| 177 | pkg_config("pkg_gtest") { |
| 178 | pkg_deps = [ "gtest" ] |
| 179 | } |
| 180 | |
| 181 | pkg_config("pkg_gtest_main") { |
| 182 | pkg_deps = [ "gtest_main" ] |
| 183 | } |
| 184 | |
| 185 | pkg_config("pkg_gmock") { |
| 186 | pkg_deps = [ "gmock" ] |
| 187 | } |
| 188 | |
| 189 | pkg_config("pkg_gmock_main") { |
| 190 | pkg_deps = [ "gmock_main" ] |
| 191 | } |
| 192 | |
| 193 | pkg_config("pkg_libchrome") { |
| 194 | pkg_deps = [ "libchrome" ] |
| 195 | } |
| 196 | |
| 197 | pkg_config("pkg_modp_b64") { |
| 198 | pkg_deps = [ "libmodp_b64" ] |
| 199 | } |
| 200 | |
| 201 | pkg_config("pkg_tinyxml2") { |
| 202 | pkg_deps = [ "tinyxml2" ] |
| 203 | } |
| 204 | |
Sonny Sasaka | 33cc2ad | 2021-02-03 19:14:56 +0000 | [diff] [blame] | 205 | # To use non-standard codecs (i.e. ldac, aac, aptx), set this use flag when |
| 206 | # building. These codecs may have licensing issues that need to be resolved |
| 207 | # first. |
| 208 | if (defined(use.bt_nonstandard_codecs) && use.bt_nonstandard_codecs) { |
| 209 | config("external_aac") { |
| 210 | configs = [ ":pkg_aac" ] |
| 211 | } |
| 212 | |
| 213 | pkg_config("pkg_aac") { |
| 214 | pkg_deps = [ "fdk-aac" ] |
| 215 | } |
| 216 | |
| 217 | config("external_libldac") { |
| 218 | configs = [ |
| 219 | ":pkg_libldacBT_enc", |
| 220 | ":pkg_libldacBT_abr", |
| 221 | ] |
| 222 | } |
| 223 | |
| 224 | pkg_config("pkg_libldacBT_enc") { |
Abhishek Pandit-Subedi | 9eaf2ca | 2021-03-02 22:33:10 +0000 | [diff] [blame] | 225 | pkg_deps = [ "ldacBT-enc" ] |
Sonny Sasaka | 33cc2ad | 2021-02-03 19:14:56 +0000 | [diff] [blame] | 226 | } |
| 227 | |
| 228 | pkg_config("pkg_libldacBT_abr") { |
Abhishek Pandit-Subedi | 9eaf2ca | 2021-03-02 22:33:10 +0000 | [diff] [blame] | 229 | pkg_deps = [ "ldacBT-abr" ] |
Sonny Sasaka | 33cc2ad | 2021-02-03 19:14:56 +0000 | [diff] [blame] | 230 | } |
| 231 | } |