1subdirs = [
2    "common",
3]
4
5cc_defaults {
6    name: "fluoride_service_defaults",
7    defaults: ["fluoride_defaults"],
8    include_dirs: [
9        "system/bt",
10    ],
11    header_libs: [ "libbluetooth_headers" ],
12}
13
14// Source variables
15// ========================================================
16btserviceDaemonSrc = [
17    "adapter.cc",
18    "daemon.cc",
19    "gatt_client.cc",
20    "gatt_server.cc",
21    "gatt_server_old.cc",
22    "hal/bluetooth_gatt_interface.cc",
23    "hal/bluetooth_interface.cc",
24    "ipc/ipc_handler.cc",
25    "ipc/ipc_manager.cc",
26    "logging_helpers.cc",
27    "low_energy_advertiser.cc",
28    "low_energy_scanner.cc",
29    "low_energy_client.cc",
30    "settings.cc",
31]
32
33btserviceLinuxSrc = [
34    "ipc/ipc_handler_linux.cc",
35    "ipc/linux_ipc_host.cc",
36]
37
38btserviceBinderDaemonSrc = [
39    "ipc/binder/bluetooth_binder_server.cc",
40    "ipc/binder/bluetooth_gatt_client_binder_server.cc",
41    "ipc/binder/bluetooth_gatt_server_binder_server.cc",
42    "ipc/binder/bluetooth_le_advertiser_binder_server.cc",
43    "ipc/binder/bluetooth_le_scanner_binder_server.cc",
44    "ipc/binder/bluetooth_low_energy_binder_server.cc",
45    "ipc/binder/interface_with_instances_base.cc",
46    "ipc/binder/ipc_handler_binder.cc",
47]
48
49// Main unit test sources. These get built for host and target.
50// ========================================================
51btserviceBaseTestSrc = [
52    "hal/fake_bluetooth_gatt_interface.cc",
53    "hal/fake_bluetooth_interface.cc",
54    "test/adapter_unittest.cc",
55    "test/advertise_data_unittest.cc",
56    "test/fake_hal_util.cc",
57    "test/gatt_client_unittest.cc",
58    "test/gatt_server_unittest.cc",
59    "test/low_energy_advertiser_unittest.cc",
60    "test/low_energy_client_unittest.cc",
61    "test/low_energy_scanner_unittest.cc",
62    "test/settings_unittest.cc",
63]
64
65// Native system service for target
66// ========================================================
67cc_binary {
68    name: "bluetoothtbd",
69    defaults: ["fluoride_service_defaults"],
70    srcs: btserviceBinderDaemonSrc +
71    btserviceLinuxSrc +
72    btserviceDaemonSrc +
73    ["main.cc"],
74    static_libs: [
75        "libbluetooth-binder-common",
76        "libbtcore",
77        "libbluetooth-types",
78        "libosi",
79    ],
80
81    shared_libs: [
82        "libbinder",
83        "libcutils",
84        "liblog",
85        "libutils",
86    ],
87    init_rc: ["bluetoothtbd.rc"],
88}
89
90// Native system service unit tests for target and host
91
92// ========================================================
93cc_test {
94    name: "bluetoothtbd_test",
95    test_suites: ["device-tests"],
96    defaults: ["fluoride_service_defaults"],
97    srcs: btserviceBaseTestSrc +
98    btserviceDaemonSrc + [
99        "test/main.cc",
100    ],
101    aidl: {
102        include_dirs: [
103            "system/bt/service/common",
104            "frameworks/native/aidl/binder",
105        ],
106    },
107    static_libs: [
108        "libbluetooth-common",
109        "libgmock",
110        "liblog",
111        "libbluetooth-types",
112    ],
113    host_supported: true,
114    target: {
115        // This includes Binder related tests that can only be run
116        // on target.
117        android: {
118            srcs: btserviceBinderDaemonSrc + [
119                "test/parcelable_unittest.cc",
120                "test/ParcelableTest.aidl",
121            ],
122            static_libs: [
123                "libbluetooth-binder-common",
124            ],
125            shared_libs: [
126                "libbinder",
127                "libutils",
128            ],
129        },
130        host: {
131            srcs: [
132                "test/stub_ipc_handler_binder.cc",
133            ],
134        },
135        linux_glibc: {
136            srcs: btserviceLinuxSrc + [
137                // TODO(bcf): Fix this test.
138                //"test/ipc_linux_unittest.cc",
139            ],
140        },
141    },
142    sanitize: {
143        cfi: false,
144    },
145}
146
147// Native system service CLI for target
148// ========================================================
149cc_binary {
150    name: "bluetooth-cli",
151    defaults: ["fluoride_defaults"],
152    srcs: ["client/main.cc"],
153    static_libs: [
154        "libbluetooth-binder-common",
155    ],
156    shared_libs: [
157        "libbinder",
158        "libutils",
159    ],
160}
161
162// Heart Rate GATT service example for target
163// ========================================================
164cc_binary {
165    name: "bt-example-hr-server",
166    defaults: ["fluoride_defaults"],
167    local_include_dirs: ["example/heart_rate"],
168    srcs: [
169        "example/heart_rate/heart_rate_server.cc",
170        "example/heart_rate/server_main.cc",
171    ],
172    static_libs: [
173        "libbluetooth-binder-common",
174    ],
175    shared_libs: [
176        "libbinder",
177        "libutils",
178    ],
179}
180
181cc_library_static {
182    name: "libbluetoothtbd_hal",
183    defaults: ["fluoride_defaults"],
184    include_dirs: ["system/bt"],
185    header_libs: ["libbluetooth_headers"],
186    srcs: [
187        "hal/bluetooth_gatt_interface.cc",
188        "hal/bluetooth_interface.cc",
189        "logging_helpers.cc",
190    ],
191}
192