• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (C) 2021-2022 Huawei Device Co., Ltd.
2# Licensed under the Apache License, Version 2.0 (the "License");
3# you may not use this file except in compliance with the License.
4# You may obtain a copy of the License at
5#
6#     http://www.apache.org/licenses/LICENSE-2.0
7#
8# Unless required by applicable law or agreed to in writing, software
9# distributed under the License is distributed on an "AS IS" BASIS,
10# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11# See the License for the specific language governing permissions and
12# limitations under the License.
13
14import("//build/ohos.gni")
15import("//foundation/communication/bluetooth/bluetooth.gni")
16
17SUBSYSTEM_DIR = "//foundation/communication"
18
19ohos_shared_library("bluetooth") {
20  branch_protector_ret = "pac_ret"  # Enable PAC CFI
21
22  #install_enable = true
23  include_dirs = [
24    "include",
25    "src",
26    "$SUBSYSTEM_DIR/bluetooth/frameworks/inner/include",
27    "$SUBSYSTEM_DIR/bluetooth/frameworks/js/napi/src/access",
28    "$SUBSYSTEM_DIR/bluetooth/frameworks/js/napi/src/base_profile",
29    "$SUBSYSTEM_DIR/bluetooth/frameworks/js/napi/src/constant",
30  ]
31
32  defines = [
33    "BT_LOG_TAG = \"bluetooth_napi\"",
34    "BT_LOG_DOMAIN = 0xD000100",
35    "BT_MODULE_NAME = \"bluetooth\"",
36  ]
37  sanitize = {
38    cfi = true  # Enable/disable control flow integrity detection
39    boundary_sanitize = true  # Enable boundary san detection
40    cfi_cross_dso = true  # Cross-SO CFI Checks
41    integer_overflow = true  # Enable integer overflow detection
42    ubsan = true  # Enable some Ubsan options
43    debug = false
44  }
45
46  sources = [
47    "src/a2dp/napi_bluetooth_a2dp_src.cpp",
48    "src/a2dp/napi_bluetooth_a2dp_src_observer.cpp",
49    "src/access/napi_bluetooth_access.cpp",
50    "src/access/napi_bluetooth_access_observer.cpp",
51    "src/audio_manager/napi_bluetooth_audio_manager.cpp",
52    "src/base_profile/napi_bluetooth_base_profile.cpp",
53    "src/ble/napi_bluetooth_ble.cpp",
54    "src/ble/napi_bluetooth_ble_advertise_callback.cpp",
55    "src/ble/napi_bluetooth_ble_central_manager_callback.cpp",
56    "src/ble/napi_bluetooth_ble_utils.cpp",
57    "src/ble/napi_bluetooth_gatt_client.cpp",
58    "src/ble/napi_bluetooth_gatt_client_callback.cpp",
59    "src/ble/napi_bluetooth_gatt_server.cpp",
60    "src/ble/napi_bluetooth_gatt_server_callback.cpp",
61    "src/common/napi_bluetooth_profile.cpp",
62    "src/connection/napi_bluetooth_connection.cpp",
63    "src/connection/napi_bluetooth_connection_observer.cpp",
64    "src/connection/napi_bluetooth_remote_device_observer.cpp",
65    "src/constant/napi_bluetooth_constant.cpp",
66    "src/hfp/napi_bluetooth_hfp_ag.cpp",
67    "src/hfp/napi_bluetooth_hfp_ag_observer.cpp",
68    "src/hfp/napi_bluetooth_hfp_hf.cpp",
69    "src/hfp/napi_bluetooth_hfp_hf_observer.cpp",
70    "src/hid/napi_bluetooth_hid_host.cpp",
71    "src/hid/napi_bluetooth_hid_host_observer.cpp",
72    "src/napi_bluetooth_a2dp_snk.cpp",
73    "src/napi_bluetooth_a2dp_snk_observer.cpp",
74    "src/napi_bluetooth_avrcp_ct.cpp",
75    "src/napi_bluetooth_avrcp_ct_observer.cpp",
76    "src/napi_bluetooth_avrcp_tg.cpp",
77    "src/napi_bluetooth_avrcp_tg_observer.cpp",
78    "src/napi_bluetooth_host.cpp",
79    "src/native_module.cpp",
80    "src/pan/napi_bluetooth_pan.cpp",
81    "src/pan/napi_bluetooth_pan_observer.cpp",
82    "src/socket/napi_bluetooth_spp_client.cpp",
83    "src/socket/napi_bluetooth_spp_server.cpp",
84  ]
85
86  deps = [
87    "$SUBSYSTEM_DIR/bluetooth/frameworks/inner:btframework",
88    "$SUBSYSTEM_DIR/bluetooth/frameworks/js/napi/src/common:bt_napi_common",
89  ]
90
91  external_deps = [
92    "ability_base:want",
93    "ability_runtime:ability_manager",
94    "bundle_framework:appexecfwk_base",
95    "bundle_framework:appexecfwk_core",
96    "c_utils:utils",
97    "hicollie:libhicollie",
98    "hilog:libhilog",
99    "hitrace:hitrace_meter",
100    "ipc:ipc_single",
101    "libuv:uv",
102    "napi:ace_napi",
103  ]
104
105  if (bluetooth_kia_enable) {
106    defines += [ "BLUETOOTH_KIA_ENABLE" ]
107    external_deps += [
108      "cJSON:cjson",
109      "security_guard:libsg_collect_sdk",
110    ]
111  }
112
113  relative_install_dir = "module"
114  part_name = "bluetooth"
115  subsystem_name = "communication"
116}
117
118ohos_shared_library("bluetoothmanager") {
119  branch_protector_ret = "pac_ret"  # Enable PAC CFI
120
121  #install_enable = true
122  include_dirs = [
123    "include",
124    "src",
125    "$SUBSYSTEM_DIR/bluetooth/frameworks/inner/include",
126    "$SUBSYSTEM_DIR/bluetooth/frameworks/js/napi/src/access",
127    "$SUBSYSTEM_DIR/bluetooth/frameworks/js/napi/src/base_profile",
128    "$SUBSYSTEM_DIR/bluetooth/frameworks/js/napi/src/constant",
129  ]
130
131  defines = [
132    "BT_LOG_TAG = \"bluetooth_napi\"",
133    "BT_LOG_DOMAIN = 0xD000100",
134    "ENABLE_NAPI_BLUETOOTH_MANAGER",
135    "BT_MODULE_NAME = \"bluetoothmanager\"",
136  ]
137
138  sanitize = {
139    cfi = true  # Enable/disable control flow integrity detection
140    boundary_sanitize = true  # Enable boundary san detection
141    cfi_cross_dso = true  # Cross-SO CFI Checks
142    integer_overflow = true  # Enable integer overflow detection
143    ubsan = true  # Enable some Ubsan options
144    debug = false
145  }
146  sources = [
147    "src/a2dp/napi_bluetooth_a2dp_src.cpp",
148    "src/a2dp/napi_bluetooth_a2dp_src_observer.cpp",
149    "src/access/napi_bluetooth_access.cpp",
150    "src/access/napi_bluetooth_access_observer.cpp",
151    "src/audio_manager/napi_bluetooth_audio_manager.cpp",
152    "src/base_profile/napi_bluetooth_base_profile.cpp",
153    "src/ble/napi_bluetooth_ble.cpp",
154    "src/ble/napi_bluetooth_ble_advertise_callback.cpp",
155    "src/ble/napi_bluetooth_ble_central_manager_callback.cpp",
156    "src/ble/napi_bluetooth_ble_utils.cpp",
157    "src/ble/napi_bluetooth_gatt_client.cpp",
158    "src/ble/napi_bluetooth_gatt_client_callback.cpp",
159    "src/ble/napi_bluetooth_gatt_server.cpp",
160    "src/ble/napi_bluetooth_gatt_server_callback.cpp",
161    "src/common/napi_bluetooth_profile.cpp",
162    "src/connection/napi_bluetooth_connection.cpp",
163    "src/connection/napi_bluetooth_connection_observer.cpp",
164    "src/connection/napi_bluetooth_remote_device_observer.cpp",
165    "src/constant/napi_bluetooth_constant.cpp",
166    "src/hfp/napi_bluetooth_hfp_ag.cpp",
167    "src/hfp/napi_bluetooth_hfp_ag_observer.cpp",
168    "src/hfp/napi_bluetooth_hfp_hf.cpp",
169    "src/hfp/napi_bluetooth_hfp_hf_observer.cpp",
170    "src/hid/napi_bluetooth_hid_host.cpp",
171    "src/hid/napi_bluetooth_hid_host_observer.cpp",
172    "src/napi_bluetooth_a2dp_snk.cpp",
173    "src/napi_bluetooth_a2dp_snk_observer.cpp",
174    "src/napi_bluetooth_avrcp_ct.cpp",
175    "src/napi_bluetooth_avrcp_ct_observer.cpp",
176    "src/napi_bluetooth_avrcp_tg.cpp",
177    "src/napi_bluetooth_avrcp_tg_observer.cpp",
178    "src/napi_bluetooth_host.cpp",
179    "src/native_module.cpp",
180    "src/pan/napi_bluetooth_pan.cpp",
181    "src/pan/napi_bluetooth_pan_observer.cpp",
182    "src/socket/napi_bluetooth_spp_client.cpp",
183    "src/socket/napi_bluetooth_spp_server.cpp",
184  ]
185
186  deps = [
187    "$SUBSYSTEM_DIR/bluetooth/frameworks/inner:btframework",
188    "$SUBSYSTEM_DIR/bluetooth/frameworks/js/napi/src/common:bt_napi_common",
189  ]
190
191  external_deps = [
192    "ability_base:want",
193    "ability_runtime:ability_manager",
194    "bundle_framework:appexecfwk_base",
195    "bundle_framework:appexecfwk_core",
196    "c_utils:utils",
197    "hicollie:libhicollie",
198    "hilog:libhilog",
199    "hitrace:hitrace_meter",
200    "ipc:ipc_core",
201    "ipc:ipc_single",
202    "libuv:uv",
203    "napi:ace_napi",
204  ]
205
206  if (bluetooth_kia_enable) {
207    defines += [ "BLUETOOTH_KIA_ENABLE" ]
208    external_deps += [
209      "cJSON:cjson",
210      "security_guard:libsg_collect_sdk",
211    ]
212  }
213
214  relative_install_dir = "module"
215  part_name = "bluetooth"
216  subsystem_name = "communication"
217}
218
219group("bluetooth_napi") {
220  deps = [
221    "$SUBSYSTEM_DIR/bluetooth/frameworks/js/napi:bluetooth",
222    "$SUBSYSTEM_DIR/bluetooth/frameworks/js/napi:bluetoothmanager",
223    "$SUBSYSTEM_DIR/bluetooth/frameworks/js/napi/src/a2dp:a2dp",
224    "$SUBSYSTEM_DIR/bluetooth/frameworks/js/napi/src/access:access",
225    "$SUBSYSTEM_DIR/bluetooth/frameworks/js/napi/src/audio_manager:weardetection",
226    "$SUBSYSTEM_DIR/bluetooth/frameworks/js/napi/src/base_profile:baseprofile",
227    "$SUBSYSTEM_DIR/bluetooth/frameworks/js/napi/src/ble:ble",
228    "$SUBSYSTEM_DIR/bluetooth/frameworks/js/napi/src/connection:connection",
229    "$SUBSYSTEM_DIR/bluetooth/frameworks/js/napi/src/constant:constant",
230    "$SUBSYSTEM_DIR/bluetooth/frameworks/js/napi/src/hfp:hfp",
231    "$SUBSYSTEM_DIR/bluetooth/frameworks/js/napi/src/hid:hid",
232    "$SUBSYSTEM_DIR/bluetooth/frameworks/js/napi/src/map:map",
233    "$SUBSYSTEM_DIR/bluetooth/frameworks/js/napi/src/opp:opp",
234    "$SUBSYSTEM_DIR/bluetooth/frameworks/js/napi/src/pan:pan",
235    "$SUBSYSTEM_DIR/bluetooth/frameworks/js/napi/src/pbap:pbap",
236    "$SUBSYSTEM_DIR/bluetooth/frameworks/js/napi/src/socket:socket",
237  ]
238}
239