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} 19 20import("//foundation/distributedhardware/device_manager/device_manager.gni") 21 22if (defined(ohos_lite)) { 23 if (ohos_kernel_type == "linux") { 24 executable("devicemanagerservice") { 25 include_dirs = [ 26 "include", 27 "include/advertise", 28 "include/discovery", 29 "include/hichain", 30 "include/notify", 31 "include/softbus", 32 "include/ipc/lite", 33 "include/permission/lite", 34 "include/pinholder", 35 "${common_path}/include", 36 "${common_path}/include/ipc", 37 "${common_path}/include/ipc/lite", 38 "${common_path}/include/ipc/model", 39 "${common_path}/include/dfx", 40 "${common_path}/include/dfx/lite", 41 "${utils_path}/include", 42 "${utils_path}/include/appInfo/lite", 43 "${utils_path}/include/crypto", 44 "${utils_path}/include/fwkload/lite", 45 "${utils_path}/include/kvadapter", 46 "${utils_path}/include/timer/lite", 47 "${innerkits_path}/native_cpp/include", 48 "${innerkits_path}/native_cpp/include/ipc", 49 "${innerkits_path}/native_cpp/include/ipc/lite", 50 "//third_party/json/include", 51 "//third_party/bounds_checking_function/include", 52 "//base/hiviewdfx/hilog_lite/interfaces/native/kits/hilog", 53 "//base/hiviewdfx/hilog_lite/interfaces/native/kits/hilog_lite", 54 "${interfaces_path}/c/ipc/include", 55 "//foundation/communication/dsoftbus/interfaces/kits/bus_center", 56 "//foundation/communication/dsoftbus/interfaces/inner_kits/transport", 57 "//foundation/communication/dsoftbus/interfaces/kits/common", 58 "//foundation/communication/dsoftbus/interfaces/kits/transport", 59 "//foundation/distributedshedule/samgr_lite/interfaces/kits/samgr", 60 "//foundation/systemabilitymgr/samgr/interfaces/innerkits/samgr_proxy/include", 61 "${devicemanager_path}/radar/include", 62 "${softbuscache_parh}/include", 63 ] 64 65 sources = [ 66 "${common_path}/src/dm_anonymous.cpp", 67 "src/advertise/advertise_manager.cpp", 68 "src/device_manager_service.cpp", 69 "src/device_manager_service_listener.cpp", 70 "src/discovery/discovery_filter.cpp", 71 "src/discovery/discovery_manager.cpp", 72 "src/ipc/lite/ipc_cmd_parser.cpp", 73 "src/ipc/lite/ipc_server_listener.cpp", 74 "src/ipc/lite/ipc_server_listenermgr.cpp", 75 "src/ipc/lite/ipc_server_main.cpp", 76 "src/ipc/lite/ipc_server_stub.cpp", 77 "src/notify/device_manager_service_notify.cpp", 78 "src/permission/lite/permission_manager.cpp", 79 "src/pinholder/pin_holder.cpp", 80 "src/pinholder/pin_holder_session.cpp", 81 "src/softbus/mine_softbus_listener.cpp", 82 "src/softbus/softbus_listener.cpp", 83 ] 84 85 defines = [ 86 "LITE_DEVICE", 87 "HI_LOG_ENABLE", 88 "DH_LOG_TAG=\"devicemanagerservice\"", 89 "LOG_DOMAIN=0xD004110", 90 ] 91 92 deps = [ 93 "${devicemanager_path}/radar:devicemanagerradar", 94 "${innerkits_path}/native_cpp:devicemanagersdk", 95 "${softbuscache_parh}:dmdevicecache", 96 "${utils_path}:devicemanagerutils", 97 "//base/security/device_auth/services:deviceauth_sdk", 98 "//base/startup/init/interfaces/innerkits:libbegetutil", 99 "//commonlibrary/utils_lite:utils", 100 "//foundation/communication/dsoftbus:dsoftbus", 101 "//foundation/systemabilitymgr/safwk_lite:safwk_lite", 102 "//foundation/systemabilitymgr/samgr_lite/samgr:samgr", 103 ] 104 105 external_deps = [ 106 "bounds_checking_function:libsec_shared", 107 "openssl:libcrypto_shared", 108 ] 109 110 cflags = [ 111 "-Wall", 112 "-O2", 113 "-Wdate-time", 114 "-Wextra", 115 "-Wfloat-equal", 116 "-Wshadow", 117 ] 118 119 cflags_cc = cflags 120 } 121 } 122} else if (!support_jsapi) { 123 group("devicemanagerservice") { 124 deps = [] 125 } 126} else { 127 config("devicemanagerservice_config") { 128 include_dirs = [ 129 "include", 130 "include/advertise", 131 "include/devicenamemgr", 132 "include/discovery", 133 "include/hichain", 134 "include/ipc", 135 "include/ipc/standard", 136 "include/notify", 137 "include/permission/standard", 138 "include/pinholder", 139 "include/publishcommonevent", 140 "include/relationshipsyncmgr", 141 "include/softbus", 142 "${common_path}/include", 143 "${common_path}/include/dfx", 144 "${common_path}/include/dfx/standard", 145 "${common_path}/include/ipc", 146 "${common_path}/include/ipc/model", 147 "${common_path}/include/ipc/standard", 148 "${devicemanager_path}/commondependency/include", 149 "${devicemanager_path}/radar/include", 150 "${innerkits_path}/native_cpp/include", 151 "${servicesimpl_path}/include/dependency/deviceprofile", 152 "${softbuscache_parh}/include", 153 "${utils_path}/include/appInfo/standard", 154 "${utils_path}/include/crypto", 155 "${utils_path}/include/kvadapter", 156 "${utils_path}/include/timer", 157 ] 158 } 159 160 ohos_shared_library("devicemanagerservice") { 161 branch_protector_ret = "pac_ret" 162 163 sanitize = { 164 boundary_sanitize = true 165 cfi = true 166 cfi_cross_dso = true 167 debug = false 168 integer_overflow = true 169 ubsan = true 170 } 171 172 cflags = [ 173 "-Werror", 174 "-fPIC", 175 "-fstack-protector-strong", 176 ] 177 178 ldflags = [ 179 "-Wl,-z,relro", 180 "-Wl,-z,now", 181 ] 182 183 sources = [ 184 "${common_path}/src/dfx/standard/dm_hidumper.cpp", 185 "${common_path}/src/dm_anonymous.cpp", 186 "${common_path}/src/ipc/standard/ipc_cmd_register.cpp", 187 "${common_path}/src/ipc/standard/ipc_model_codec.cpp", 188 "src/advertise/advertise_manager.cpp", 189 "src/device_manager_service.cpp", 190 "src/device_manager_service_listener.cpp", 191 "src/devicenamemgr/device_name_change_monitor.cpp", 192 "src/devicenamemgr/device_name_manager.cpp", 193 "src/devicenamemgr/local_device_name_mgr.cpp", 194 "src/devicenamemgr/settings_data_event_monitor.cpp", 195 "src/discovery/discovery_filter.cpp", 196 "src/discovery/discovery_manager.cpp", 197 "src/hichain/hichain_listener.cpp", 198 "src/ipc/standard/ipc_cmd_parser.cpp", 199 "src/ipc/standard/ipc_server_client_proxy.cpp", 200 "src/ipc/standard/ipc_server_listener.cpp", 201 "src/ipc/standard/ipc_server_stub.cpp", 202 "src/notify/device_manager_service_notify.cpp", 203 "src/permission/standard/permission_manager.cpp", 204 "src/pinholder/pin_holder.cpp", 205 "src/pinholder/pin_holder_session.cpp", 206 "src/publishcommonevent/dm_account_common_event.cpp", 207 "src/publishcommonevent/dm_datashare_common_event.cpp", 208 "src/publishcommonevent/dm_package_common_event.cpp", 209 "src/publishcommonevent/dm_screen_common_event.cpp", 210 "src/relationshipsyncmgr/dm_comm_tool.cpp", 211 "src/relationshipsyncmgr/dm_transport.cpp", 212 "src/relationshipsyncmgr/dm_transport_msg.cpp", 213 "src/relationshipsyncmgr/relationship_sync_mgr.cpp", 214 "src/softbus/mine_softbus_listener.cpp", 215 "src/softbus/softbus_listener.cpp", 216 ] 217 218 public_configs = [ ":devicemanagerservice_config" ] 219 220 defines = [ 221 "HI_LOG_ENABLE", 222 "DH_LOG_TAG=\"devicemanagerservice\"", 223 "LOG_DOMAIN=0xD004110", 224 ] 225 226 deps = [ 227 "${devicemanager_path}/commondependency:devicemanagerdependency", 228 "${devicemanager_path}/radar:devicemanagerradar", 229 "${innerkits_path}/native_cpp:devicemanagersdk", 230 "${softbuscache_parh}:dmdevicecache", 231 "${utils_path}:devicemanagerutils", 232 ] 233 234 external_deps = [ 235 "ability_base:want", 236 "access_token:libaccesstoken_sdk", 237 "access_token:libtokenid_sdk", 238 "bundle_framework:appexecfwk_base", 239 "cJSON:cjson", 240 "c_utils:utils", 241 "common_event_service:cesfwk_core", 242 "common_event_service:cesfwk_innerkits", 243 "data_share:datashare_common", 244 "data_share:datashare_consumer", 245 "device_auth:deviceauth_sdk", 246 "device_info_manager:distributed_device_profile_common", 247 "device_info_manager:distributed_device_profile_sdk", 248 "dsoftbus:softbus_client", 249 "eventhandler:libeventhandler", 250 "ffrt:libffrt", 251 "hicollie:libhicollie", 252 "hilog:libhilog", 253 "init:libbeget_proxy", 254 "init:libbegetutil", 255 "ipc:ipc_core", 256 "ipc:ipc_single", 257 "openssl:libcrypto_shared", 258 "os_account:libaccountkits", 259 "os_account:os_account_innerkits", 260 "safwk:system_ability_fwk", 261 "samgr:samgr_proxy", 262 ] 263 264 if ((support_bluetooth || support_wifi) && 265 device_manager_feature_product == "default") { 266 sources += [ 267 "src/publishcommonevent/dm_publish_common_event.cpp", 268 "src/softbus/softbus_publish.cpp", 269 ] 270 } 271 272 if (support_bluetooth && device_manager_feature_product == "default") { 273 defines += [ "SUPPORT_BLUETOOTH" ] 274 external_deps += [ "bluetooth:btframework" ] 275 } 276 277 if (support_wifi && device_manager_feature_product == "default") { 278 defines += [ "SUPPORT_WIFI" ] 279 external_deps += [ "wifi:wifi_sdk" ] 280 } 281 282 if (support_power_manager) { 283 defines += [ "SUPPORT_POWER_MANAGER" ] 284 external_deps += [ "power_manager:powermgr_client" ] 285 } 286 287 if (support_memmgr) { 288 defines += [ "SUPPORT_MEMMGR" ] 289 external_deps += [ "memmgr:memmgrclient" ] 290 } 291 292 if (device_manager_common) { 293 defines += [ "DEVICE_MANAGER_COMMON_FLAG" ] 294 } 295 296 if (device_manager_feature_product == "default") { 297 defines += [ "SUPPORT_WISEDEVICE" ] 298 } 299 300 public_external_deps = [ "cJSON:cjson" ] 301 302 subsystem_name = "distributedhardware" 303 304 part_name = "device_manager" 305 } 306} 307