1# Copyright (c) 2021-2023 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("./../../../../usbmgr.gni")
15
16config("usbnapi_private_config") {
17  include_dirs = [
18    "${usb_manager_path}/interfaces/kits/js/napi/include",
19    "${usb_manager_path}/interfaces/innerkits/native/include",
20  ]
21}
22
23ohos_shared_library("usb") {
24  sanitize = {
25    integer_overflow = true
26    ubsan = true
27    boundary_sanitize = true
28  }
29
30  sources = [ "src/usb_middle.cpp" ]
31  external_deps = [
32    "hilog:libhilog",
33    "napi:ace_napi",
34  ]
35
36  configs = [ "${utils_path}:utils_config" ]
37
38  relative_install_dir = "module"
39
40  subsystem_name = "usb"
41  part_name = "usb_manager"
42}
43
44ohos_shared_library("usbmanager") {
45  sanitize = {
46    integer_overflow = true
47    ubsan = true
48    boundary_sanitize = true
49  }
50
51  sources = [
52    "${utils_path}/native/src/usb_napi_errors.cpp",
53    "src/napi_util.cpp",
54    "src/usb_info.cpp",
55    "src/usbmanager_middle.cpp",
56  ]
57  configs = [
58    "${utils_path}:utils_config",
59    ":usbnapi_private_config",
60  ]
61  deps = [ "${usb_manager_path}/interfaces/innerkits:usbsrv_client" ]
62  public_external_deps = [ "cJSON:cjson" ]
63  external_deps = [
64    "bounds_checking_function:libsec_shared",
65    "drivers_interface_usb:usb_idl_headers_1.1",
66    "hilog:libhilog",
67    "napi:ace_napi",
68  ]
69
70  relative_install_dir = "module"
71
72  subsystem_name = "usb"
73  part_name = "usb_manager"
74}
75