1// libbtcore static library for target and host
2package {
3    // See: http://go/android-license-faq
4    // A large-scale-change added 'default_applicable_licenses' to import
5    // all of the 'license_kinds' from "system_bt_license"
6    // to get the below license kinds:
7    //   SPDX-license-identifier-Apache-2.0
8    default_applicable_licenses: ["system_bt_license"],
9}
10
11cc_defaults {
12    name: "libbtcore_defaults",
13    defaults: ["fluoride_defaults"],
14    local_include_dirs: ["include"],
15    include_dirs: [
16        "packages/modules/Bluetooth/system",
17        "packages/modules/Bluetooth/system/gd",
18    ],
19    srcs: [
20        "src/device_class.cc",
21        "src/module.cc",
22        "src/osi_module.cc",
23        "src/property.cc",
24    ],
25    header_libs: ["libbluetooth_headers"],
26    host_supported: true,
27    apex_available: [
28        "com.android.btservices",
29    ],
30    target: {
31        host_linux: {
32            cflags: ["-D_GNU_SOURCE"],
33        },
34    },
35}
36
37cc_library_static {
38    name: "libbthalutils",
39    defaults: ["fluoride_defaults"],
40    srcs: [
41        "src/hal_util.cc",
42    ],
43    local_include_dirs: ["include"],
44    include_dirs: [
45        "packages/modules/Bluetooth/system",
46        "packages/modules/Bluetooth/system/gd",
47    ],
48    header_libs: ["libbluetooth_headers"],
49    host_supported: true,
50    apex_available: [
51        "com.android.btservices",
52    ],
53    target: {
54        host_linux: {
55            cflags: ["-D_GNU_SOURCE"],
56        },
57    },
58    static_libs: [
59        "libbluetooth_log",
60        "libbt_shim_bridge",
61    ],
62}
63
64cc_library_static {
65    name: "libbtcore",
66    visibility: [
67        "//packages/apps/Test/connectivity/sl4n",
68        "//packages/modules/Bluetooth:__subpackages__",
69    ],
70    defaults: ["libbtcore_defaults"],
71    min_sdk_version: "Tiramisu",
72    static_libs: [
73        "libbluetooth_log",
74        "libbt_shim_bridge",
75    ],
76}
77
78cc_library_headers {
79    name: "libbtcore_headers",
80    export_include_dirs: ["./"],
81    vendor_available: true,
82    host_supported: true,
83    apex_available: [
84        "//apex_available:platform",
85        "com.android.btservices",
86    ],
87    min_sdk_version: "30",
88}
89
90// Note: It's good to get the tests compiled both for the host and the target so
91// we get to test with both Bionic libc and glibc
92// libbtcore unit tests for target and host
93cc_test {
94    name: "net_test_btcore",
95    test_suites: ["general-tests"],
96    defaults: [
97        "fluoride_defaults",
98        "mts_defaults",
99    ],
100    local_include_dirs: ["include"],
101    include_dirs: ["packages/modules/Bluetooth/system"],
102    srcs: [
103        "test/device_class_test.cc",
104        "test/property_test.cc",
105    ],
106    shared_libs: [
107        "libbase",
108        "liblog",
109    ],
110    static_libs: [
111        "libbluetooth-types",
112        "libbluetooth_log",
113        "libbtcore",
114        "libchrome",
115        "libosi",
116    ],
117    host_supported: true,
118    test_options: {
119        unit_test: true,
120    },
121    sanitize: {
122        address: true,
123    },
124    header_libs: ["libbluetooth_headers"],
125}
126