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("//build/config/components/hdi/hdi.gni") 15import("//build/ohos.gni") 16import("./../usb.gni") 17import("./serial.gni") 18 19# group("usbhost_acm") { 20# deps = [ ":libusbhost_acm" ] 21# } 22config("serial_public_config") { 23 include_dirs = [ 24 "${usb_driver_path}/serial", 25 "include", 26 "${usb_driver_path}/utils/include", 27 "${usb_driver_path}/ddk/host/include", 28 "${usb_driver_path}/hdi_service/include", 29 "${usb_driver_path}/hdf_usb/include", 30 "${usb_driver_path}/hdi_service", 31 "${usb_driver_path}/utils/include", 32 ] 33} 34 35ohos_shared_library("libusbhost_acm") { 36 sanitize = { 37 integer_overflow = true 38 ubsan = true 39 boundary_sanitize = true 40 cfi = true 41 cfi_cross_dso = true 42 debug = false 43 } 44 branch_protector_ret = "pac_ret" 45 46 sources = [ "src/usb_serial.c" ] 47 48 include_dirs = [ 49 "./../ddk/common/include", 50 "./../ddk/host/include", 51 "./../interfaces/ddk/common", 52 "./../interfaces/ddk/host", 53 "./../gadget/function/include", 54 "//drivers/hdf_core/framework/model/usb/include", 55 "include", 56 "${usb_driver_path}/utils/include", 57 ] 58 59 deps = [ "./../ddk:libusb_ddk_host" ] 60 61 if (is_standard_system) { 62 external_deps = [ 63 "hdf_core:libhdf_host", 64 "hdf_core:libhdf_utils", 65 "hilog:libhilog", 66 ] 67 68 if (usb_c_utils_enable) { 69 external_deps += [ "c_utils:utils" ] 70 } 71 } else { 72 external_deps = [ "hilog:libhilog" ] 73 } 74 75 shlib_type = "hdi" 76 install_images = [ chipset_base_dir ] 77 subsystem_name = "hdf" 78 part_name = "drivers_peripheral_usb" 79} 80 81ohos_shared_library("libusbhost_acm_rawapi") { 82 sanitize = { 83 integer_overflow = true 84 ubsan = true 85 boundary_sanitize = true 86 cfi = true 87 cfi_cross_dso = true 88 debug = false 89 } 90 branch_protector_ret = "pac_ret" 91 92 sources = [ "src/usb_serial_rawapi.c" ] 93 94 include_dirs = [ 95 "./../ddk/common/include", 96 "./../usb/ddk/host/include", 97 "./../gadget/function/include", 98 "./../interfaces/ddk/common", 99 "./../interfaces/ddk/host", 100 "//drivers/hdf_core/framework/model/usb/include", 101 "include", 102 "${usb_driver_path}/utils/include", 103 ] 104 105 deps = [ "./../ddk:libusb_ddk_host" ] 106 107 if (is_standard_system) { 108 external_deps = [ 109 "hdf_core:libhdf_host", 110 "hdf_core:libhdf_utils", 111 "hilog:libhilog", 112 ] 113 if (usb_c_utils_enable) { 114 external_deps += [ "c_utils:utils" ] 115 } 116 } else { 117 external_deps = [ "hilog:libhilog" ] 118 } 119 120 shlib_type = "hdi" 121 install_images = [ chipset_base_dir ] 122 subsystem_name = "hdf" 123 part_name = "drivers_peripheral_usb" 124} 125 126ohos_shared_library("libserial_interface_service_1.0") { 127 version_script = "serial_interface_service.map" 128 sanitize = { 129 integer_overflow = true 130 ubsan = true 131 boundary_sanitize = true 132 cfi = true 133 cfi_cross_dso = true 134 debug = false 135 } 136 branch_protector_ret = "pac_ret" 137 138 sources = [ "src/serial_impl.cpp" ] 139 defines = [] 140 if (linux_serial_enable == true) { 141 sources += [ "src/linux_serial.cpp" ] 142 defines += [ "LINUX_SERIAL" ] 143 deps = [ 144 "${usb_driver_path}/ddk:libusb_ddk_host", 145 "${usb_driver_path}/ddk:libusb_pnp_manager", 146 ] 147 } else { 148 sources += [ "src/libusb_serial.cpp" ] 149 } 150 151 shlib_type = "hdi" 152 153 public_configs = [ ":serial_public_config" ] 154 155 if (is_standard_system) { 156 external_deps = [ 157 "drivers_interface_usb:libserial_proxy_1.0", 158 "drivers_interface_usb:libserial_stub_1.0", 159 "hdf_core:libhdf_host", 160 "hdf_core:libhdf_utils", 161 "hdf_core:libhdi", 162 "hilog:libhilog", 163 "hisysevent:libhisysevent", 164 "hitrace:hitrace_meter", 165 "init:libbegetutil", 166 "libusb:libusb", 167 ] 168 if (usb_c_utils_enable) { 169 external_deps += [ "c_utils:utils" ] 170 } 171 } else { 172 external_deps = [ 173 "drivers_interface_usb:libserial_proxy_1.0", 174 "drivers_interface_usb:libserial_stub_1.0", 175 "hilog:libhilog", 176 "libusb:libusb", 177 ] 178 } 179 180 subsystem_name = "hdf" 181 part_name = "drivers_peripheral_usb" 182} 183 184group("usbhost_acm") { 185 deps = [ 186 ":libserial_interface_service_1.0", 187 ":libusbhost_acm", 188 ":libusbhost_acm_rawapi", 189 ] 190} 191