1# Copyright (c) 2022-2024 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
14if (defined(ohos_lite)) {
15  import("//build/lite/config/component/lite_component.gni")
16} else {
17  import("//build/ohos.gni")
18}
19
20import("//foundation/distributedhardware/device_manager/device_manager.gni")
21
22if (defined(ohos_lite)) {
23  if (ohos_kernel_type == "linux") {
24    shared_library("devicemanagerutils") {
25      include_dirs = [
26        "include",
27        "include/crypto",
28        "include/fwkload/lite",
29        "include/appInfo/lite",
30        "include/timer/lite",
31        "${common_path}/include",
32        "${common_path}/include/dfx",
33        "${common_path}/include/dfx/lite",
34        "${common_path}/include/ipc",
35        "${common_path}/include/ipc/lite",
36        "${common_path}/include/ipc/model",
37        "${innerkits_path}/native_cpp/include",
38        "${interfaces_path}/c/ipc/include",
39        "//third_party/json/include",
40        "//third_party/bounds_checking_function/include",
41      ]
42
43      sources = [
44        "${common_path}/src/dfx/lite/dm_hidumper.cpp",
45        "${common_path}/src/dfx/lite/dm_hisysevent.cpp",
46        "${common_path}/src/dfx/lite/dm_hitrace.cpp",
47        "${common_path}/src/dm_anonymous.cpp",
48        "${common_path}/src/dm_error_message.cpp",
49        "${common_path}/src/ipc/lite/ipc_cmd_register.cpp",
50        "src/appInfo/lite/app_manager.cpp",
51        "src/crypto/dm_crypto.cpp",
52        "src/dm_random.cpp",
53        "src/fwkload/lite/dm_distributed_hardware_load.cpp",
54        "src/timer/lite/dm_timer.cpp",
55      ]
56
57      defines = [
58        "LITE_DEVICE",
59        "hI_LOG_ENABLE",
60        "DH_LOG_TAG=\"devicemanagerutils\"",
61        "lOG_DOMAIN=0xD004110",
62      ]
63
64      deps = [
65        "//base/hiviewdfx/hilog_lite/frameworks/featured:hilog_shared",
66        "//third_party/bounds_checking_function:libsec_shared",
67        "//third_party/openssl:libcrypto_shared",
68      ]
69    }
70  }
71} else {
72  config("devicemanagerutils_config") {
73    include_dirs = [
74      "include",
75      "include/crypto",
76      "include/kvadapter",
77      "include/fwkload/standard",
78      "include/appInfo/standard",
79      "include/timer",
80      "${innerkits_path}/native_cpp/include",
81      "${common_path}/include",
82    ]
83  }
84
85  ohos_shared_library("devicemanagerutils") {
86    branch_protector_ret = "pac_ret"
87
88    sanitize = {
89      boundary_sanitize = true
90      cfi = true
91      cfi_cross_dso = true
92      debug = false
93      integer_overflow = true
94      ubsan = true
95    }
96
97    sources = [
98      "${common_path}/src/dm_anonymous.cpp",
99      "src/appInfo/standard/app_manager.cpp",
100      "src/crypto/dm_crypto.cpp",
101      "src/dm_random.cpp",
102      "src/kvadapter/dm_kv_info.cpp",
103      "src/kvadapter/kv_adapter.cpp",
104      "src/kvadapter/kv_adapter_manager.cpp",
105      "src/timer/dm_timer.cpp",
106    ]
107
108    if (support_jsapi) {
109      sources += [ "src/fwkload/standard/dm_distributed_hardware_load.cpp" ]
110    }
111
112    public_configs = [ ":devicemanagerutils_config" ]
113
114    defines = [
115      "HI_LOG_ENABLE",
116      "DH_LOG_TAG=\"devicemanagerutils\"",
117      "LOG_DOMAIN=0xD004110",
118    ]
119
120    external_deps = [
121      "access_token:libaccesstoken_sdk",
122      "bundle_framework:appexecfwk_base",
123      "bundle_framework:appexecfwk_core",
124      "cJSON:cjson",
125      "c_utils:utils",
126      "eventhandler:libeventhandler",
127      "ffrt:libffrt",
128      "hilog:libhilog",
129      "ipc:ipc_core",
130      "ipc:ipc_single",
131      "openssl:libcrypto_shared",
132      "samgr:samgr_proxy",
133    ]
134
135    public_external_deps = [
136      "json:nlohmann_json_static",
137      "kv_store:distributeddata_inner",
138    ]
139
140    if (support_jsapi) {
141      external_deps += [ "bundle_framework:appexecfwk_core" ]
142    }
143
144    subsystem_name = "distributedhardware"
145
146    part_name = "device_manager"
147  }
148}
149