1# Copyright (c) 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("//build/config/components/hdi/hdi.gni") 15import("//build/ohos.gni") 16import("./../usb.gni") 17 18config("ddk_public_config") { 19 include_dirs = [ 20 "include/", 21 "${usb_driver_path}/ddk/ndk/", 22 "${usb_driver_path}/utils/include", 23 ] 24} 25 26ohos_shared_library("libusb_ddk_service_1.0") { 27 sanitize = { 28 integer_overflow = true 29 ubsan = true 30 boundary_sanitize = true 31 cfi = true 32 cfi_cross_dso = true 33 debug = false 34 } 35 branch_protector_ret = "pac_ret" 36 37 sources = [ 38 "src/usb_ddk_hash.cpp", 39 "src/usb_ddk_permission.cpp", 40 "src/usb_ddk_service.cpp", 41 ] 42 include_dirs = [ 43 "${usb_driver_path}/interfaces/ddk/host", 44 "${usb_driver_path}/interfaces/ddk/common", 45 "${usb_driver_path}/ddk/host/include", 46 "//drivers/hdf_core/framework/model/usb/include", 47 "${usb_driver_path}/utils/include", 48 ] 49 50 configs = [ ":ddk_public_config" ] 51 52 deps = [ 53 "${usb_driver_path}/ddk:libusb_ddk_host", 54 "${usb_driver_path}/ddk:libusb_pnp_manager", 55 ] 56 57 if (is_standard_system) { 58 external_deps = [ 59 "drivers_interface_usb:usb_ddk_idl_headers", 60 "hdf_core:libhdf_host", 61 "hdf_core:libhdf_ipc_adapter", 62 "hdf_core:libhdf_utils", 63 "hdf_core:libhdi", 64 "hilog:libhilog", 65 "ipc:ipc_single", 66 ] 67 if (usb_hisysevent_enable) { 68 external_deps += [ "hisysevent:libhisysevent" ] 69 } 70 if (usb_c_utils_enable) { 71 external_deps += [ "c_utils:utils" ] 72 } 73 } else { 74 external_deps = [ "hilog:libhilog" ] 75 } 76 77 install_images = [ chipset_base_dir ] 78 subsystem_name = "hdf" 79 part_name = "drivers_peripheral_usb" 80} 81 82ohos_shared_library("usb_ddk_dynamic_library_wrapper") { 83 sanitize = { 84 integer_overflow = true 85 ubsan = true 86 boundary_sanitize = true 87 cfi = true 88 cfi_cross_dso = true 89 debug = false 90 } 91 branch_protector_ret = "pac_ret" 92 93 sources = [ "src/usb_ddk_dynamic_library_wrapper.cpp" ] 94 95 external_deps = [ "access_token:libaccesstoken_sdk" ] 96 if (usb_c_utils_enable) { 97 external_deps += [ "c_utils:utils" ] 98 } 99 100 install_images = [ chipset_base_dir ] 101 subsystem_name = "hdf" 102 part_name = "drivers_peripheral_usb" 103} 104 105ohos_shared_library("libusb_ddk_driver") { 106 sanitize = { 107 integer_overflow = true 108 ubsan = true 109 boundary_sanitize = true 110 cfi = true 111 cfi_cross_dso = true 112 debug = false 113 } 114 branch_protector_ret = "pac_ret" 115 116 sources = [ "src/usb_ddk_driver.cpp" ] 117 118 if (is_standard_system) { 119 external_deps = [ 120 "drivers_interface_usb:libusb_ddk_stub_1.0", 121 "hdf_core:libhdf_host", 122 "hdf_core:libhdf_ipc_adapter", 123 "hdf_core:libhdf_utils", 124 "hdf_core:libhdi", 125 "hilog:libhilog", 126 "ipc:ipc_single", 127 ] 128 if (usb_c_utils_enable) { 129 external_deps += [ "c_utils:utils" ] 130 } 131 } else { 132 external_deps = [ "hilog:libhilog" ] 133 } 134 configs = [ ":ddk_public_config" ] 135 136 shlib_type = "hdi" 137 install_images = [ chipset_base_dir ] 138 subsystem_name = "hdf" 139 part_name = "drivers_peripheral_usb" 140} 141 142group("usb_ddk_target") { 143 deps = [ 144 ":libusb_ddk_driver", 145 ":libusb_ddk_service_1.0", 146 ":usb_ddk_dynamic_library_wrapper", 147 ] 148} 149