1#
2#  Copyright 2015 Google, Inc.
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
17static_library("osi") {
18  sources = [
19    "src/alarm.cc",
20    "src/allocator.cc",
21    "src/compat.cc",
22    "src/config.cc",
23    "src/fixed_queue.cc",
24    "src/future.cc",
25    "src/hash_map_utils.cc",
26    "src/list.cc",
27    "src/mutex.cc",
28    "src/properties.cc",
29    "src/reactor.cc",
30    "src/ringbuffer.cc",
31    "src/socket.cc",
32
33    # TODO(mcchou): Remove these sources after platform specific
34    # dependencies are abstracted.
35    "src/socket_utils/socket_local_client.cc",
36    "src/socket_utils/socket_local_server.cc",
37    "src/stack_power_telemetry.cc",
38    "src/thread.cc",
39    "src/wakelock.cc",
40
41    # internal dependencies to not be used outside
42    "src/internal/semaphore.cc",
43  ]
44
45  include_dirs = [
46    "//bt/system/",
47    "//bt/system/linux_include",
48    "//bt/system/osi/include_internal",
49    "//bt/system/stack/include",
50  ]
51
52  cflags = [
53    "-DLIB_OSI_INTERNAL",
54  ]
55
56  deps = [
57    "//bt/flags:bluetooth_flags_c_lib",
58    "//bt/sysprop:libcom.android.sysprop.bluetooth",
59    "//bt/system/common",
60  ]
61
62  configs += [
63    "//bt/system:target_defaults",
64    "//bt/system/log:log_defaults",
65  ]
66}
67
68if (use.test) {
69  executable("net_test_osi") {
70    sources = [
71      "test/alarm_test.cc",
72      "test/allocator_test.cc",
73      "test/config_test.cc",
74      "test/future_test.cc",
75      "test/hash_map_utils_test.cc",
76      "test/list_test.cc",
77      "test/properties_test.cc",
78      "test/reactor_test.cc",
79      "test/ringbuffer_test.cc",
80      "test/thread_test.cc",
81
82      "test/internal/semaphore_test.cc",
83    ]
84
85    include_dirs = [
86      "//bt/system/",
87      "//bt/system/osi/include_internal",
88      "//bt/system/osi/test",
89    ]
90
91    cflags = [
92      "-DLIB_OSI_INTERNAL",
93    ]
94
95    deps = [
96      "//bt/sysprop:libcom.android.sysprop.bluetooth",
97      "//bt/system/osi",
98    ]
99
100    configs += [
101      "//bt/system:external_gtest_main",
102      "//bt/system:external_gmock_main",
103      "//bt/system:target_defaults",
104    ]
105
106    libs = [
107      "pthread",
108      "rt",
109    ]
110  }
111}
112