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/ohos.gni")
15import("./../../../adapter/uhdf2/uhdf.gni")
16
17group("uhdf_hidl_pkg") {
18  deps = [ ":libhdi" ]
19}
20
21hdf_framework_path = "./../../../framework"
22hdf_interface_path = "./../../../interfaces"
23hdf_uhdf_path = "./.."
24
25config("libhdi_pub_config") {
26  visibility = [ ":*" ]
27
28  include_dirs = [
29    "$hdf_interface_path/inner_api/hdi",
30    "$hdf_interface_path/inner_api/hdi/base",
31    "$hdf_interface_path/inner_api/core",
32  ]
33}
34if (defined(ohos_lite)) {
35  ohos_shared_library("libhdi") {
36    output_extension = "z.so"
37
38    defines = []
39    if (target_cpu == "arm64" || target_cpu == "x86_64") {
40      defines += [ "__ARCH64__" ]
41    }
42
43    include_dirs = [
44      "$hdf_interface_path/inner_api/utils",
45      "$hdf_interface_path/inner_api/osal/uhdf",
46    ]
47    public_configs = [ ":libhdi_pub_config" ]
48    sources = [ "src/hdi_support.cpp" ]
49
50    deps = [
51      "//base/hiviewdfx/hilog_lite/frameworks/featured:hilog_shared",
52      "//third_party/bounds_checking_function:libsec_shared",
53    ]
54
55    defines += [ "__USER__" ]
56
57    # install_images = [ system_base_dir ]
58    subsystem_name = "hdf"
59    part_name = "hdf_core"
60  }
61} else {
62  ohos_shared_library("libhdi") {
63    branch_protector_ret = "pac_ret"
64    if (target_cpu == "arm64" || target_cpu == "x86_64") {
65      defines = [ "__ARCH64__" ]
66    }
67
68    include_dirs = [
69      "$hdf_framework_path/core/shared/include",
70      "$hdf_framework_path/core/host/include",
71      "$hdf_framework_path/core/manager/include",
72      "$hdf_framework_path/include/utils",
73      "$hdf_framework_path/include/osal",
74      "$hdf_framework_path/utils/include",
75      "$hdf_framework_path/include/core",
76      "$hdf_uhdf_path/include/devhost",
77      "$hdf_uhdf_path/devhost/include",
78      "$hdf_uhdf_path/devmgr/include",
79      "$hdf_uhdf_path/host/include",
80      "$hdf_uhdf_path/manager/include",
81      "$hdf_uhdf_path/include/hdi",
82      "$hdf_uhdf_path/ipc/include",
83      "$hdf_interface_path/inner_api/ipc",
84      "$hdf_interface_path/inner_api/utils",
85      "$hdf_interface_path/inner_api/host/shared",
86      "$hdf_interface_path/inner_api/host/uhdf",
87    ]
88    public_configs = [ ":libhdi_pub_config" ]
89    sources = [
90      "$hdf_framework_path/core/shared/src/service_status.c",
91      "src/buffer_util.c",
92      "src/devmgr_client.c",
93      "src/hdi_smq_syncer.cpp",
94      "src/hdi_support.cpp",
95      "src/idevmgr_client.cpp",
96      "src/iservmgr_client.cpp",
97      "src/native_buffer.cpp",
98      "src/object_collector.cpp",
99      "src/servmgr_client.c",
100      "src/servstat_listener.c",
101      "src/servstat_listener_stub.cpp",
102      "src/stub_collector.cpp",
103    ]
104
105    if (is_standard_system) {
106      deps = [
107        "../ipc:libhdf_ipc_adapter",
108        "../pub_utils:libpub_utils",
109      ]
110      external_deps = [
111        "c_utils:utils",
112        "hilog:libhilog",
113        "ipc:ipc_single",
114        "samgr:samgr_proxy",
115      ]
116    } else {
117      external_deps = [
118        "hilog:libhilog",
119        "ipc:ipc_single",
120        "samgr:samgr_proxy",
121      ]
122    }
123
124    innerapi_tags = [
125      "chipsetsdk",
126      "platformsdk_indirect",
127    ]
128    install_images = [
129      system_base_dir,
130      updater_base_dir,
131    ]
132    subsystem_name = "hdf"
133    part_name = "hdf_core"
134  }
135}
136