1cc_defaults {
2    name: "fluoride_osi_defaults",
3    defaults: ["fluoride_defaults"],
4    include_dirs: [
5        "system/bt",
6        "system/bt/include",
7        "system/bt/osi/src/protos",
8        "system/bt/utils/include",
9        "system/bt/stack/include",
10    ]
11}
12
13// Static libraries required by other modules
14// ========================================================
15cc_test_library {
16    name: "libosi-AllocationTestHarness",
17    defaults: ["fluoride_osi_defaults"],
18    srcs: [
19        "test/AllocationTestHarness.cc",
20    ],
21    host_supported: true,
22    shared: {
23        enabled: false
24    }
25}
26
27cc_test_library {
28    name: "libosi-AlarmTestHarness",
29    defaults: ["fluoride_osi_defaults"],
30    srcs: [
31        "test/AlarmTestHarness.cc",
32    ],
33    host_supported: true,
34    shared: {
35        enabled: false
36    }
37}
38
39// Bluetooth Protobuf static library for target and host
40// ========================================================
41cc_library_static {
42    name: "libbt-protos",
43    defaults: ["fluoride_defaults"],
44    srcs: ["src/protos/bluetooth.proto"],
45    proto: {
46        export_proto_headers: true,
47    },
48    host_supported: true
49}
50
51
52// libosi static library for target
53// ========================================================
54cc_library_static {
55    name: "libosi",
56    defaults: ["fluoride_osi_defaults"],
57    // TODO(mcchou): Remove socket_utils sources after platform specific
58    // dependencies are abstracted.
59    srcs: [
60        "src/alarm.cc",
61        "src/allocation_tracker.cc",
62        "src/allocator.cc",
63        "src/array.cc",
64        "src/buffer.cc",
65        "src/compat.cc",
66        "src/config.cc",
67        "src/data_dispatcher.cc",
68        "src/fixed_queue.cc",
69        "src/future.cc",
70        "src/hash_map_utils.cc",
71        "src/list.cc",
72        "src/metrics.cc",
73        "src/mutex.cc",
74        "src/osi.cc",
75        "src/properties.cc",
76        "src/reactor.cc",
77        "src/ringbuffer.cc",
78        "src/semaphore.cc",
79        "src/socket.cc",
80        "src/socket_utils/socket_local_client.cc",
81        "src/socket_utils/socket_local_server.cc",
82        "src/thread.cc",
83        "src/time.cc",
84        "src/wakelock.cc",
85    ],
86    shared_libs: [
87        "liblog",
88    ],
89    static_libs: ["libbt-protos"],
90    host_supported: true,
91    // TODO(armansito): Setting _GNU_SOURCE isn't very platform-independent but
92    // should be compatible for a Linux host OS. We should figure out what to do for
93    // a non-Linux host OS.
94    target: {
95        darwin: {
96            enabled: false,
97        },
98        linux: {
99            cflags: [
100                "-D_GNU_SOURCE",
101                "-DOS_GENERIC",
102            ],
103        },
104    },
105}
106
107// libosi unit tests for target and host
108// ========================================================
109cc_test {
110    name: "net_test_osi",
111    defaults: ["fluoride_osi_defaults"],
112    host_supported: true,
113    srcs: [
114        "test/AlarmTestHarness.cc",
115        "test/AllocationTestHarness.cc",
116        "test/alarm_test.cc",
117        "test/allocation_tracker_test.cc",
118        "test/allocator_test.cc",
119        "test/array_test.cc",
120        "test/config_test.cc",
121        "test/data_dispatcher_test.cc",
122        "test/fixed_queue_test.cc",
123        "test/future_test.cc",
124        "test/hash_map_utils_test.cc",
125        "test/leaky_bonded_queue_test.cc",
126        "test/list_test.cc",
127        "test/metrics_test.cc",
128        "test/properties_test.cc",
129        "test/rand_test.cc",
130        "test/reactor_test.cc",
131        "test/ringbuffer_test.cc",
132        "test/semaphore_test.cc",
133        "test/thread_test.cc",
134        "test/time_test.cc",
135        "test/wakelock_test.cc",
136    ],
137    shared_libs: [
138        "liblog",
139        "libprotobuf-cpp-lite",
140        "libcutils",
141    ],
142    static_libs: [
143        "libbt-protos",
144        "libgmock",
145        "libosi",
146    ],
147    target: {
148        linux: {
149            cflags: ["-DOS_GENERIC"],
150            host_ldlibs: [
151                "-lrt",
152                "-lpthread",
153            ],
154        },
155        darwin: {
156            enabled: false,
157        }
158    },
159}
160