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")
15
16SUBSYSTEM_DIR = "//foundation/communication"
17
18ohos_shared_library("bluetooth") {
19  branch_protector_ret = "pac_ret"  # Enable PAC CFI
20
21  #install_enable = true
22  include_dirs = [
23    "include",
24    "src",
25    "$SUBSYSTEM_DIR/bluetooth/frameworks/inner/include",
26    "$SUBSYSTEM_DIR/bluetooth/frameworks/js/napi/src/access",
27    "$SUBSYSTEM_DIR/bluetooth/frameworks/js/napi/src/base_profile",
28    "$SUBSYSTEM_DIR/bluetooth/frameworks/js/napi/src/constant",
29  ]
30
31  defines = [
32    "BT_LOG_TAG = \"bluetooth_napi\"",
33    "BT_LOG_DOMAIN = 0xD000100",
34    "BT_MODULE_NAME = \"bluetooth\"",
35  ]
36  sanitize = {
37    cfi = true  # Enable/disable control flow integrity detection
38    boundary_sanitize = true  # Enable boundary san detection
39    cfi_cross_dso = true  # Cross-SO CFI Checks
40    integer_overflow = true  # Enable integer overflow detection
41    ubsan = true  # Enable some Ubsan options
42    debug = false
43  }
44  sources = [
45    "src/a2dp/napi_bluetooth_a2dp_src.cpp",
46    "src/a2dp/napi_bluetooth_a2dp_src_observer.cpp",
47    "src/access/napi_bluetooth_access.cpp",
48    "src/access/napi_bluetooth_access_observer.cpp",
49    "src/audio_manager/napi_bluetooth_audio_manager.cpp",
50    "src/base_profile/napi_bluetooth_base_profile.cpp",
51    "src/ble/napi_bluetooth_ble.cpp",
52    "src/ble/napi_bluetooth_ble_advertise_callback.cpp",
53    "src/ble/napi_bluetooth_ble_central_manager_callback.cpp",
54    "src/ble/napi_bluetooth_ble_utils.cpp",
55    "src/ble/napi_bluetooth_gatt_client.cpp",
56    "src/ble/napi_bluetooth_gatt_client_callback.cpp",
57    "src/ble/napi_bluetooth_gatt_server.cpp",
58    "src/ble/napi_bluetooth_gatt_server_callback.cpp",
59    "src/common/napi_bluetooth_profile.cpp",
60    "src/connection/napi_bluetooth_connection.cpp",
61    "src/connection/napi_bluetooth_connection_observer.cpp",
62    "src/connection/napi_bluetooth_remote_device_observer.cpp",
63    "src/constant/napi_bluetooth_constant.cpp",
64    "src/hfp/napi_bluetooth_hfp_ag.cpp",
65    "src/hfp/napi_bluetooth_hfp_ag_observer.cpp",
66    "src/hfp/napi_bluetooth_hfp_hf.cpp",
67    "src/hfp/napi_bluetooth_hfp_hf_observer.cpp",
68    "src/hid/napi_bluetooth_hid_host.cpp",
69    "src/hid/napi_bluetooth_hid_host_observer.cpp",
70    "src/napi_bluetooth_a2dp_snk.cpp",
71    "src/napi_bluetooth_a2dp_snk_observer.cpp",
72    "src/napi_bluetooth_avrcp_ct.cpp",
73    "src/napi_bluetooth_avrcp_ct_observer.cpp",
74    "src/napi_bluetooth_avrcp_tg.cpp",
75    "src/napi_bluetooth_avrcp_tg_observer.cpp",
76    "src/napi_bluetooth_host.cpp",
77    "src/native_module.cpp",
78    "src/pan/napi_bluetooth_pan.cpp",
79    "src/pan/napi_bluetooth_pan_observer.cpp",
80    "src/socket/napi_bluetooth_spp_client.cpp",
81    "src/socket/napi_bluetooth_spp_server.cpp",
82  ]
83
84  deps = [ "$SUBSYSTEM_DIR/bluetooth/frameworks/inner:btframework" ]
85
86  external_deps = [
87    "ability_base:want",
88    "ability_runtime:ability_manager",
89    "bundle_framework:appexecfwk_base",
90    "bundle_framework:appexecfwk_core",
91    "c_utils:utils",
92    "hicollie:libhicollie",
93    "hilog:libhilog",
94    "hitrace:hitrace_meter",
95    "ipc:ipc_single",
96    "libuv:uv",
97    "napi:ace_napi",
98  ]
99
100  relative_install_dir = "module"
101  part_name = "bluetooth"
102  subsystem_name = "communication"
103}
104
105ohos_shared_library("bluetoothmanager") {
106  branch_protector_ret = "pac_ret"  # Enable PAC CFI
107
108  #install_enable = true
109  include_dirs = [
110    "include",
111    "src",
112    "$SUBSYSTEM_DIR/bluetooth/frameworks/inner/include",
113    "$SUBSYSTEM_DIR/bluetooth/frameworks/js/napi/src/access",
114    "$SUBSYSTEM_DIR/bluetooth/frameworks/js/napi/src/base_profile",
115    "$SUBSYSTEM_DIR/bluetooth/frameworks/js/napi/src/constant",
116  ]
117
118  defines = [
119    "BT_LOG_TAG = \"bluetooth_napi\"",
120    "BT_LOG_DOMAIN = 0xD000100",
121    "ENABLE_NAPI_BLUETOOTH_MANAGER",
122    "BT_MODULE_NAME = \"bluetoothmanager\"",
123  ]
124
125  sanitize = {
126    cfi = true  # Enable/disable control flow integrity detection
127    boundary_sanitize = true  # Enable boundary san detection
128    cfi_cross_dso = true  # Cross-SO CFI Checks
129    integer_overflow = true  # Enable integer overflow detection
130    ubsan = true  # Enable some Ubsan options
131    debug = false
132  }
133  sources = [
134    "src/a2dp/napi_bluetooth_a2dp_src.cpp",
135    "src/a2dp/napi_bluetooth_a2dp_src_observer.cpp",
136    "src/access/napi_bluetooth_access.cpp",
137    "src/access/napi_bluetooth_access_observer.cpp",
138    "src/audio_manager/napi_bluetooth_audio_manager.cpp",
139    "src/base_profile/napi_bluetooth_base_profile.cpp",
140    "src/ble/napi_bluetooth_ble.cpp",
141    "src/ble/napi_bluetooth_ble_advertise_callback.cpp",
142    "src/ble/napi_bluetooth_ble_central_manager_callback.cpp",
143    "src/ble/napi_bluetooth_ble_utils.cpp",
144    "src/ble/napi_bluetooth_gatt_client.cpp",
145    "src/ble/napi_bluetooth_gatt_client_callback.cpp",
146    "src/ble/napi_bluetooth_gatt_server.cpp",
147    "src/ble/napi_bluetooth_gatt_server_callback.cpp",
148    "src/common/napi_bluetooth_profile.cpp",
149    "src/connection/napi_bluetooth_connection.cpp",
150    "src/connection/napi_bluetooth_connection_observer.cpp",
151    "src/connection/napi_bluetooth_remote_device_observer.cpp",
152    "src/constant/napi_bluetooth_constant.cpp",
153    "src/hfp/napi_bluetooth_hfp_ag.cpp",
154    "src/hfp/napi_bluetooth_hfp_ag_observer.cpp",
155    "src/hfp/napi_bluetooth_hfp_hf.cpp",
156    "src/hfp/napi_bluetooth_hfp_hf_observer.cpp",
157    "src/hid/napi_bluetooth_hid_host.cpp",
158    "src/hid/napi_bluetooth_hid_host_observer.cpp",
159    "src/napi_bluetooth_a2dp_snk.cpp",
160    "src/napi_bluetooth_a2dp_snk_observer.cpp",
161    "src/napi_bluetooth_avrcp_ct.cpp",
162    "src/napi_bluetooth_avrcp_ct_observer.cpp",
163    "src/napi_bluetooth_avrcp_tg.cpp",
164    "src/napi_bluetooth_avrcp_tg_observer.cpp",
165    "src/napi_bluetooth_host.cpp",
166    "src/native_module.cpp",
167    "src/pan/napi_bluetooth_pan.cpp",
168    "src/pan/napi_bluetooth_pan_observer.cpp",
169    "src/socket/napi_bluetooth_spp_client.cpp",
170    "src/socket/napi_bluetooth_spp_server.cpp",
171  ]
172
173  deps = [ "$SUBSYSTEM_DIR/bluetooth/frameworks/inner:btframework" ]
174
175  external_deps = [
176    "ability_base:want",
177    "ability_runtime:ability_manager",
178    "bundle_framework:appexecfwk_base",
179    "bundle_framework:appexecfwk_core",
180    "c_utils:utils",
181    "hicollie:libhicollie",
182    "hilog:libhilog",
183    "hitrace:hitrace_meter",
184    "ipc:ipc_core",
185    "ipc:ipc_single",
186    "libuv:uv",
187    "napi:ace_napi",
188  ]
189
190  relative_install_dir = "module"
191  part_name = "bluetooth"
192  subsystem_name = "communication"
193}
194
195group("bluetooth_napi") {
196  deps = [
197    "$SUBSYSTEM_DIR/bluetooth/frameworks/js/napi:bluetooth",
198    "$SUBSYSTEM_DIR/bluetooth/frameworks/js/napi:bluetoothmanager",
199    "$SUBSYSTEM_DIR/bluetooth/frameworks/js/napi/src/a2dp:a2dp",
200    "$SUBSYSTEM_DIR/bluetooth/frameworks/js/napi/src/access:access",
201    "$SUBSYSTEM_DIR/bluetooth/frameworks/js/napi/src/audio_manager:weardetection",
202    "$SUBSYSTEM_DIR/bluetooth/frameworks/js/napi/src/base_profile:baseprofile",
203    "$SUBSYSTEM_DIR/bluetooth/frameworks/js/napi/src/ble:ble",
204    "$SUBSYSTEM_DIR/bluetooth/frameworks/js/napi/src/connection:connection",
205    "$SUBSYSTEM_DIR/bluetooth/frameworks/js/napi/src/constant:constant",
206    "$SUBSYSTEM_DIR/bluetooth/frameworks/js/napi/src/hfp:hfp",
207    "$SUBSYSTEM_DIR/bluetooth/frameworks/js/napi/src/hid:hid",
208    "$SUBSYSTEM_DIR/bluetooth/frameworks/js/napi/src/map:map",
209    "$SUBSYSTEM_DIR/bluetooth/frameworks/js/napi/src/opp:opp",
210    "$SUBSYSTEM_DIR/bluetooth/frameworks/js/napi/src/pan:pan",
211    "$SUBSYSTEM_DIR/bluetooth/frameworks/js/napi/src/pbap:pbap",
212    "$SUBSYSTEM_DIR/bluetooth/frameworks/js/napi/src/socket:socket",
213  ]
214}
215