• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2022-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
14if (defined(ohos_lite)) {
15  import("//build/lite/config/component/lite_component.gni")
16} else {
17  import("//build/ohos.gni")
18}
19import("//foundation/distributedhardware/device_manager/device_manager.gni")
20
21if (defined(ohos_lite)) {
22  if (ohos_kernel_type == "liteos_m") {
23    static_library("devicemanagersdk") {
24      include_dirs = [
25        "${innerkits_path}/native_cpp/include/mini",
26        "//kernel/liteos_m/kal/cmsis",
27        "//utils/native/lite/include",
28        "//kernel/liteos_m/kal/posix/include",
29        "//third_party/musl/porting/liteos_m/kernel/include",
30        "//device/bestechnic/bes2600w/sdk_liteos/bsp/platform/hal",
31        "//foundation/communication/wifi_lite/interfaces/wifiservice",
32        "//foundation/communication/dsoftbus/core/common/include",
33        "//foundation/communication/dsoftbus/interfaces/kits/bus_center",
34        "//foundation/communication/dsoftbus/interfaces/kits/common",
35        "//foundation/communication/dsoftbus/interfaces/kits/discovery",
36        "//foundation/communication/dsoftbus/interfaces/kits/transport",
37        "//foundation/communication/dsoftbus/interfaces/inner_kits/transport",
38        "//base/security/device_auth/interfaces/inner_api",
39        "//base/startup/init/interfaces/innerkits/include/syspara",
40      ]
41
42      sources = [
43        "${innerkits_path}/native_cpp/src/mini/device_manager_impl_lite_m.c",
44        "${innerkits_path}/native_cpp/src/mini/hichain_adapter.c",
45        "${innerkits_path}/native_cpp/src/mini/softbus_adapter.c",
46      ]
47
48      deps = [
49        "//base/hiviewdfx/hilog_lite/frameworks/featured:hilog_static",
50        "//commonlibrary/utils_lite:utils",
51        "//foundation/systemabilitymgr/samgr_lite/samgr",
52        "//third_party/bounds_checking_function:libsec_static",
53        "//third_party/cJSON:cjson",
54      ]
55
56      cflags = [
57        "-Wall",
58        "-O2",
59        "-std=c99",
60        "-Wdate-time",
61        "-Wextra",
62        "-Wfloat-equal",
63      ]
64      cflags_cc = cflags
65    }
66  } else {
67    shared_library("devicemanagersdk") {
68      include_dirs = [
69        "include",
70        "include/ipc",
71        "include/ipc/lite",
72        "include/notify",
73        "${common_path}/include",
74        "${common_path}/include/dfx",
75        "${common_path}/include/dfx/lite",
76        "${common_path}/include/ipc",
77        "${common_path}/include/ipc/lite",
78        "${common_path}/include/ipc/model",
79        "${devicemanager_path}/radar/include",
80        "${interfaces_path}/c/ipc/include",
81        "${interfaces_path}/ipc_core/include",
82        "${samgr_lite_path}/kits/samgr",
83        "${samgr_lite_path}/kits/registry",
84        "${utils_lite_path}/include",
85        "${utils_path}/include",
86        "${json_path}/include",
87        "//third_party/bounds_checking_function/include",
88        "${interfaces_path}/c/ipc/include",
89        "//foundation/distributedshedule/samgr_lite/interfaces/kits/samgr",
90        "//foundation/systemabilitymgr/samgr/interfaces/innerkits/samgr_proxy/include",
91      ]
92
93      sources = [
94        "${common_path}/src/dfx/lite/dm_hidumper.cpp",
95        "${common_path}/src/dfx/lite/dm_hisysevent.cpp",
96        "${common_path}/src/dfx/lite/dm_hitrace.cpp",
97        "${common_path}/src/dm_anonymous.cpp",
98        "${common_path}/src/dm_constants.cpp",
99        "${devicemanager_path}/radar/src/lite/dm_radar_helper.cpp",
100        "${utils_path}/src/dm_random.cpp",
101        "src/device_manager.cpp",
102        "src/device_manager_impl.cpp",
103        "src/dm_device_info.cpp",
104        "src/ipc/ipc_client_proxy.cpp",
105        "src/ipc/lite/ipc_client_manager.cpp",
106        "src/ipc/lite/ipc_client_server_proxy.cpp",
107        "src/ipc/lite/ipc_client_stub.cpp",
108        "src/ipc/lite/ipc_cmd_parser.cpp",
109        "src/notify/device_manager_notify.cpp",
110      ]
111
112      defines = [
113        "LITE_DEVICE",
114        "HI_LOG_ENABLE",
115        "DH_LOG_TAG=\"devicemanagerkit\"",
116        "LOG_DOMAIN=0xD004111",
117      ]
118
119      deps = [
120        "${json_path}:devicemanagerjson",
121        "${utils_path}:devicemanagerutils",
122        "//base/hiviewdfx/hilog_lite/frameworks/featured:hilog_shared",
123        "//base/security/device_auth/services:deviceauth_sdk",
124        "//base/startup/init/interfaces/innerkits:libbegetutil",
125        "//commonlibrary/utils_lite:utils",
126        "//foundation/communication/dsoftbus:dsoftbus",
127        "//foundation/systemabilitymgr/safwk_lite:safwk_lite",
128        "//foundation/systemabilitymgr/samgr_lite/samgr:samgr",
129        "//third_party/bounds_checking_function:libsec_shared",
130      ]
131    }
132  }
133} else {
134  config("devicemanagersdk_config") {
135    include_dirs = [
136      "include",
137      "include/ipc",
138      "include/ipc/standard",
139      "include/notify",
140      "${common_path}/include",
141      "${common_path}/include/ipc",
142      "${common_path}/include/ipc/model",
143      "${common_path}/include/ipc/standard",
144      "${common_path}/include/dfx",
145      "${common_path}/include/dfx/standard",
146      "${devicemanager_path}/radar/include",
147      "${utils_path}/include",
148      "${json_path}/include",
149    ]
150  }
151
152  ohos_shared_library("devicemanagersdk") {
153    branch_protector_ret = "pac_ret"
154
155    sanitize = {
156      boundary_sanitize = true
157      integer_overflow = true
158      ubsan = true
159    }
160
161    cflags = [
162      "-Werror",
163      "-fPIC",
164      "-fstack-protector-strong",
165    ]
166
167    ldflags = [
168      "-Wl,-z,relro",
169      "-Wl,-z,now",
170    ]
171
172    sources = [
173      "${common_path}/src/dfx/standard/dm_hisysevent.cpp",
174      "${common_path}/src/dfx/standard/dm_hitrace.cpp",
175      "${common_path}/src/dm_anonymous.cpp",
176      "${common_path}/src/dm_constants.cpp",
177      "${common_path}/src/ipc/standard/ipc_cmd_register.cpp",
178      "${common_path}/src/ipc/standard/ipc_model_codec.cpp",
179      "${devicemanager_path}/radar/src/dm_radar_helper.cpp",
180      "${utils_path}/src/dm_random.cpp",
181      "src/device_manager.cpp",
182      "src/device_manager_impl.cpp",
183      "src/dm_device_info.cpp",
184      "src/ipc/ipc_client_proxy.cpp",
185      "src/ipc/standard/dm_service_load.cpp",
186      "src/ipc/standard/ipc_client_manager.cpp",
187      "src/ipc/standard/ipc_client_server_proxy.cpp",
188      "src/ipc/standard/ipc_client_stub.cpp",
189      "src/ipc/standard/ipc_cmd_parser.cpp",
190      "src/notify/device_manager_notify.cpp",
191    ]
192
193    public_configs = [ ":devicemanagersdk_config" ]
194
195    innerapi_tags = [ "platformsdk" ]
196
197    defines = [
198      "HI_LOG_ENABLE",
199      "DH_LOG_TAG=\"devicemanagerkit\"",
200      "LOG_DOMAIN=0xD004111",
201    ]
202
203    deps = [ "${json_path}:devicemanagerjson" ]
204
205    external_deps = [
206      "access_token:libaccesstoken_sdk",
207      "access_token:libtokenid_sdk",
208      "cJSON:cjson",
209      "c_utils:utils",
210      "ffrt:libffrt",
211      "hilog:libhilog",
212      "hisysevent:libhisysevent",
213      "hitrace:hitrace_meter",
214      "init:libbegetutil",
215      "ipc:ipc_core",
216      "ipc:ipc_napi",
217      "ipc:ipc_single",
218      "ipc:libdbinder",
219      "openssl:libcrypto_shared",
220      "samgr:samgr_proxy",
221    ]
222
223    subsystem_name = "distributedhardware"
224
225    part_name = "device_manager"
226  }
227}
228