• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (C) 2025 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
16BT_PART_DIR = "../../../../.."
17BT_NAPI_DIR = "$BT_PART_DIR/frameworks/js/napi"
18
19config("btcommon_config") {
20  include_dirs = [
21    "$BT_NAPI_DIR/src",
22    "$BT_PART_DIR/frameworks/inner/include",
23    "$BT_PART_DIR/interfaces/inner_api/include",
24    "$BT_PART_DIR/interfaces/inner_api/include/c_header",
25  ]
26}
27
28config("btcommon_public_config") {
29  include_dirs = [
30    "$BT_NAPI_DIR/include",
31    "$BT_NAPI_DIR/src/parser",
32  ]
33}
34
35ohos_shared_library("bt_napi_common") {
36  branch_protector_ret = "pac_ret"  # Enable PAC CFI
37  innerapi_tags = [ "platformsdk" ]
38
39  configs = [":btcommon_config"]
40  public_configs = [":btcommon_public_config"]
41
42  defines = [
43    "BT_LOG_TAG = \"bluetooth_napi\"",
44    "BT_LOG_DOMAIN = 0xD000100",
45    "ENABLE_NAPI_BLUETOOTH_MANAGER",
46    "BLUETOOTH_API_SINCE_10",
47  ]
48
49  sanitize = {
50    cfi = true  # Enable/disable control flow integrity detection
51    boundary_sanitize = true  # Enable boundary san detection
52    cfi_cross_dso = true  # Cross-SO CFI Checks
53    integer_overflow = true  # Enable integer overflow detection
54    ubsan = true  # Enable some Ubsan options
55    debug = false
56  }
57
58  sources = [
59    "$BT_NAPI_DIR/src/common/napi_async_callback.cpp",
60    "$BT_NAPI_DIR/src/common/napi_async_work.cpp",
61    "$BT_NAPI_DIR/src/common/napi_bluetooth_error.cpp",
62    "$BT_NAPI_DIR/src/common/napi_bluetooth_event.cpp",
63    "$BT_NAPI_DIR/src/common/napi_bluetooth_utils.cpp",
64    "$BT_NAPI_DIR/src/common/napi_ha_event_utils.cpp",
65    "$BT_NAPI_DIR/src/common/napi_event_subscribe_module.cpp",
66    "$BT_NAPI_DIR/src/common/napi_native_object.cpp",
67    "$BT_NAPI_DIR/src/common/napi_timer.cpp",
68    "$BT_NAPI_DIR/src/parser/napi_parser_utils.cpp",
69  ]
70
71  deps = [ "$BT_PART_DIR/frameworks/inner:btframework" ]
72
73  external_deps = [
74    "bundle_framework:appexecfwk_base",
75    "bundle_framework:appexecfwk_core",
76    "c_utils:utils",
77    "hilog:libhilog",
78    "hitrace:hitrace_meter",
79    "ipc:ipc_single",
80    "libuv:uv",
81    "hiappevent:hiappevent_innerapi",
82    "napi:ace_napi",
83    "samgr:samgr_proxy",
84  ]
85
86  part_name = "bluetooth"
87  subsystem_name = "communication"
88}
89