1# 2# Copyright 2015 Google 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 17config("service_config") { 18 include_dirs = [ 19 "//bt/", 20 "//bt/linux_include", 21 "//bt/include", 22 "//bt/service", 23 "//bt/service/common", 24 ] 25 26 configs = [ "//bt:target_defaults" ] 27} 28 29source_set("service_daemon_src") { 30 sources = [ 31 "a2dp_sink.cc", 32 "a2dp_source.cc", 33 "adapter.cc", 34 "avrcp_control.cc", 35 "avrcp_target.cc", 36 "daemon.cc", 37 "gatt_client.cc", 38 "gatt_server.cc", 39 "gatt_server_old.cc", 40 "hal/bluetooth_av_interface.cc", 41 "hal/bluetooth_avrcp_interface.cc", 42 "hal/bluetooth_gatt_interface.cc", 43 "hal/bluetooth_interface.cc", 44 "ipc/ipc_handler.cc", 45 "ipc/ipc_manager.cc", 46 "logging_helpers.cc", 47 "low_energy_advertiser.cc", 48 "low_energy_client.cc", 49 "low_energy_scanner.cc", 50 "settings.cc", 51 ] 52 53 deps = [ 54 "//bt/gd/rust/shim:init_flags_bridge_header", 55 "//bt/osi", 56 "//bt/types", 57 ] 58 59 configs += [ ":service_config" ] 60} 61 62source_set("service_linux_src") { 63 sources = [ 64 "ipc/ipc_handler_linux.cc", 65 "ipc/linux_ipc_host.cc", 66 "ipc/dbus/ipc_handler_dbus.cc", 67 "ipc/dbus/bluetooth_adapter.cc", 68 ] 69 70 deps = [ 71 "//bt/gd/rust/shim:init_flags_bridge_header", 72 "//bt/osi", 73 "//bt/types", 74 ] 75 76 configs += [ ":service_config" ] 77} 78 79static_library("service") { 80 sources = [ 81 "common/bluetooth/a2dp_codec_config.cc", 82 "common/bluetooth/adapter_state.cc", 83 "common/bluetooth/advertise_data.cc", 84 "common/bluetooth/advertise_settings.cc", 85 "common/bluetooth/avrcp_int_value.cc", 86 "common/bluetooth/avrcp_media_attr.cc", 87 "common/bluetooth/avrcp_register_notification_response.cc", 88 "common/bluetooth/characteristic.cc", 89 "common/bluetooth/descriptor.cc", 90 "common/bluetooth/remote_device_props.cc", 91 "common/bluetooth/scan_filter.cc", 92 "common/bluetooth/scan_result.cc", 93 "common/bluetooth/scan_settings.cc", 94 "common/bluetooth/service.cc", 95 "common/bluetooth/util/atomic_string.cc", 96 ] 97 98 deps = [ 99 ":service_daemon_src", 100 ":service_linux_src", 101 "//bt/gd/rust/shim:init_flags_bridge_header", 102 "//bt/osi", 103 "//bt/types", 104 ] 105 106 configs += [ ":service_config" ] 107} 108 109executable("bluetoothtbd") { 110 sources = [ "main.cc" ] 111 112 deps = [ 113 ":service", 114 "//bt/btcore", 115 "//bt/main:bluetooth", 116 ] 117 118 configs += [ ":service_config" ] 119 120 libs = [ 121 "dl", 122 "pthread", 123 "rt", 124 "bt_shim_ffi", 125 "ssl", 126 "crypto", 127 ] 128 129 lib_dirs = [ 130 "${root_out_dir}/rust" 131 ] 132} 133 134if (use.test) { 135 source_set("service_base_test_src") { 136 sources = [ 137 "hal/fake_bluetooth_av_interface.cc", 138 "hal/fake_bluetooth_gatt_interface.cc", 139 "hal/fake_bluetooth_interface.cc", 140 "test/a2dp_sink_unittest.cc", 141 "test/a2dp_source_unittest.cc", 142 "test/adapter_unittest.cc", 143 "test/advertise_data_unittest.cc", 144 "test/fake_hal_util.cc", 145 "test/gatt_client_unittest.cc", 146 "test/gatt_server_unittest.cc", 147 "test/low_energy_advertiser_unittest.cc", 148 "test/low_energy_client_unittest.cc", 149 "test/low_energy_scanner_unittest.cc", 150 "test/settings_unittest.cc", 151 ] 152 153 configs += [ ":service_config" ] 154 } 155 156 executable("bluetoothtbd_test") { 157 sources = [ "test/main.cc" ] 158 159 deps = [ 160 ":service_base_test_src", 161 ":service_daemon_src", 162 ":service_linux_src", 163 "//bt/service/common:libbluetooth_common", 164 ] 165 166 configs += [ 167 "//bt:external_gmock_main", 168 ":service_config", 169 ] 170 } 171} 172