1# Copyright (c) 2022-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
18ohos_shared_library("libusbfn_mtp_interface_service_1.0") {
19  sanitize = {
20    integer_overflow = true
21    ubsan = true
22    boundary_sanitize = true
23    cfi = true
24    cfi_cross_dso = true
25    debug = false
26  }
27  branch_protector_ret = "pac_ret"
28
29  sources = [ "src/usbfn_mtp_impl.cpp" ]
30
31  include_dirs = [
32    "./../../../interfaces/ddk/device",
33    "./../../../interfaces/ddk/common",
34    "${usb_driver_path}/gadget/function/include",
35    "${usb_driver_path}/gadget/function/mtp/include",
36    "${usb_driver_path}/utils/include",
37  ]
38
39  deps = [ "${usb_driver_path}/ddk:libusb_ddk_device" ]
40
41  if (is_standard_system) {
42    external_deps = [
43      "drivers_interface_usb:usbfn_mtp_idl_headers",
44      "hdf_core:libhdf_host",
45      "hdf_core:libhdf_utils",
46      "hilog:libhilog",
47      "ipc:ipc_single",
48    ]
49    if (usb_c_utils_enable) {
50      external_deps += [ "c_utils:utils" ]
51    }
52  } else {
53    external_deps = [ "hilog:libhilog" ]
54  }
55  install_images = [ chipset_base_dir ]
56  subsystem_name = "hdf"
57  part_name = "drivers_peripheral_usb"
58}
59
60ohos_shared_library("libusbfn_mtp_driver") {
61  sanitize = {
62    integer_overflow = true
63    ubsan = true
64    boundary_sanitize = true
65  }
66
67  sources = [ "src/usbfn_mtp_interface_driver.cpp" ]
68
69  include_dirs = [
70    "./../../../interfaces/ddk/device",
71    "./../../../interfaces/ddk/common",
72    "${usb_driver_path}/gadget/function/include",
73    "${usb_driver_path}/gadget/function/mtp/include",
74    "${usb_driver_path}/utils/include",
75  ]
76
77  deps = []
78
79  if (is_standard_system) {
80    external_deps = [
81      "drivers_interface_usb:libusbfn_mtp_stub_1.0",
82      "hdf_core:libhdf_host",
83      "hdf_core:libhdf_ipc_adapter",
84      "hdf_core:libhdf_utils",
85      "hdf_core:libhdi",
86      "hilog:libhilog",
87      "ipc:ipc_single",
88    ]
89    if (usb_c_utils_enable) {
90      external_deps += [ "c_utils:utils" ]
91    }
92  } else {
93    external_deps = [ "hilog:libhilog" ]
94  }
95
96  shlib_type = "hdi"
97  install_images = [ chipset_base_dir ]
98  subsystem_name = "hdf"
99  part_name = "drivers_peripheral_usb"
100}
101
102group("hdi_usbfn_mtp_service") {
103  deps = [
104    ":libusbfn_mtp_driver",
105    ":libusbfn_mtp_interface_service_1.0",
106  ]
107}
108