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