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 "c_utils:utils", 33 "hilog:libhilog", 34 "napi:ace_napi", 35 ] 36 37 configs = [ "${utils_path}:utils_config" ] 38 39 relative_install_dir = "module" 40 41 subsystem_name = "usb" 42 part_name = "usb_manager" 43} 44 45ohos_shared_library("usbmanager") { 46 sanitize = { 47 integer_overflow = true 48 ubsan = true 49 boundary_sanitize = true 50 } 51 52 sources = [ 53 "${utils_path}/native/src/struct_parcel.cpp", 54 "${utils_path}/native/src/usb_napi_errors.cpp", 55 "src/napi_util.cpp", 56 "src/usb_info.cpp", 57 "src/usbmanager_middle.cpp", 58 ] 59 configs = [ 60 "${utils_path}:utils_config", 61 ":usbnapi_private_config", 62 ] 63 deps = [ "${usb_manager_path}/interfaces/innerkits:usbsrv_client" ] 64 65 defines = [] 66 if (usb_manager_feature_host) { 67 defines += [ "USB_MANAGER_FEATURE_HOST" ] 68 } 69 if (usb_manager_feature_device) { 70 defines += [ "USB_MANAGER_FEATURE_DEVICE" ] 71 } 72 if (usb_manager_feature_port) { 73 defines += [ "USB_MANAGER_FEATURE_PORT" ] 74 } 75 76 external_deps = [ 77 "bounds_checking_function:libsec_shared", 78 "cJSON:cjson", 79 "c_utils:utils", 80 "drivers_interface_usb:usb_idl_headers_1.2", 81 "hilog:libhilog", 82 "hitrace:hitrace_meter", 83 "ipc:ipc_single", 84 "napi:ace_napi", 85 ] 86 87 relative_install_dir = "module" 88 version_script = "usbmanager.versionscript" 89 90 subsystem_name = "usb" 91 part_name = "usb_manager" 92} 93 94ohos_shared_library("serial") { 95 sanitize = { 96 cfi = true 97 cfi_cross_dso = true 98 integer_overflow = true 99 boundary_sanitize = true 100 ubsan = true 101 } 102 103 defines = [ "SERIAL_NAPI" ] 104 105 sources = [ 106 "${utils_path}/native/src/usb_napi_errors.cpp", 107 "src/napi_util.cpp", 108 "src/serial_info.cpp", 109 "src/serial_middle.cpp", 110 ] 111 deps = [ "${usb_manager_path}/interfaces/innerkits:usbsrv_client" ] 112 external_deps = [ 113 "cJSON:cjson", 114 "c_utils:utils", 115 "drivers_interface_usb:libserial_proxy_1.0", 116 "drivers_interface_usb:libserial_stub_1.0", 117 "drivers_interface_usb:usb_idl_headers_1.1", 118 "hilog:libhilog", 119 "ipc:ipc_core", 120 "napi:ace_napi", 121 "samgr:samgr_proxy", 122 ] 123 124 configs = [ 125 "${utils_path}:utils_config", 126 ":usbnapi_private_config", 127 ] 128 129 relative_install_dir = "module/usbmanager" 130 131 subsystem_name = "usb" 132 part_name = "usb_manager" 133} 134