• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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    "./../hdf_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    "./../hdf_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 += [
142      "src/linux_serial.cpp",
143      "src/serial_sysfs_device.cpp",
144    ]
145    defines += [ "LINUX_SERIAL" ]
146  } else {
147    sources += [ "src/libusb_serial.cpp" ]
148  }
149
150  shlib_type = "hdi"
151
152  public_configs = [ ":serial_public_config" ]
153
154  if (is_standard_system) {
155    external_deps = [
156      "drivers_interface_usb:libserial_proxy_1.0",
157      "drivers_interface_usb:libserial_stub_1.0",
158      "hdf_core:libhdf_host",
159      "hdf_core:libhdf_utils",
160      "hdf_core:libhdi",
161      "hilog:libhilog",
162      "hisysevent:libhisysevent",
163      "hitrace:hitrace_meter",
164      "init:libbegetutil",
165      "libusb:libusb",
166    ]
167    if (usb_c_utils_enable) {
168      external_deps += [ "c_utils:utils" ]
169    }
170  } else {
171    external_deps = [
172      "drivers_interface_usb:libserial_proxy_1.0",
173      "drivers_interface_usb:libserial_stub_1.0",
174      "hilog:libhilog",
175      "libusb:libusb",
176    ]
177  }
178
179  install_images = [ chipset_base_dir ]
180  innerapi_tags = [ "passthrough_indirect" ]
181  subsystem_name = "hdf"
182  part_name = "drivers_peripheral_usb"
183}
184
185group("usbhost_acm") {
186  deps = [
187    ":libserial_interface_service_1.0",
188    ":libusbhost_acm",
189    ":libusbhost_acm_rawapi",
190  ]
191}
192