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 "//third_party/cJSON", 27 "//kernel/liteos_m/kal/cmsis", 28 "//utils/native/lite/include", 29 "//kernel/liteos_m/kal/posix/include", 30 "//third_party/musl/porting/liteos_m/kernel/include", 31 "//device/bestechnic/bes2600w/sdk_liteos/bsp/platform/hal", 32 "//foundation/communication/wifi_lite/interfaces/wifiservice", 33 "//foundation/communication/dsoftbus/core/common/include", 34 "//foundation/communication/dsoftbus/interfaces/kits/bus_center", 35 "//foundation/communication/dsoftbus/interfaces/kits/common", 36 "//foundation/communication/dsoftbus/interfaces/kits/discovery", 37 "//foundation/communication/dsoftbus/interfaces/kits/transport", 38 "//foundation/communication/dsoftbus/interfaces/inner_kits/transport", 39 "//base/security/device_auth/interfaces/inner_api", 40 "//base/startup/init/interfaces/innerkits/include/syspara", 41 ] 42 43 sources = [ 44 "${innerkits_path}/native_cpp/src/mini/device_manager_impl_lite_m.c", 45 "${innerkits_path}/native_cpp/src/mini/hichain_adapter.c", 46 "${innerkits_path}/native_cpp/src/mini/softbus_adapter.c", 47 ] 48 49 deps = [ 50 "//base/hiviewdfx/hilog_lite/frameworks/featured:hilog_static", 51 "//commonlibrary/utils_lite:utils", 52 "//foundation/systemabilitymgr/samgr_lite/samgr", 53 "//third_party/bounds_checking_function:libsec_static", 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 "//third_party/bounds_checking_function/include", 86 "//third_party/json/include", 87 "${interfaces_path}/c/ipc/include", 88 "//foundation/distributedshedule/samgr_lite/interfaces/kits/samgr", 89 "//foundation/systemabilitymgr/samgr/interfaces/innerkits/samgr_proxy/include", 90 ] 91 92 sources = [ 93 "${common_path}/src/dfx/lite/dm_hidumper.cpp", 94 "${common_path}/src/dfx/lite/dm_hisysevent.cpp", 95 "${common_path}/src/dfx/lite/dm_hitrace.cpp", 96 "${common_path}/src/dm_anonymous.cpp", 97 "${common_path}/src/dm_constants.cpp", 98 "${common_path}/src/json_object.cpp", 99 "${devicemanager_path}/radar/src/lite/dm_radar_helper.cpp", 100 "src/device_manager.cpp", 101 "src/device_manager_impl.cpp", 102 "src/dm_device_info.cpp", 103 "src/ipc/ipc_client_proxy.cpp", 104 "src/ipc/lite/ipc_client_manager.cpp", 105 "src/ipc/lite/ipc_client_server_proxy.cpp", 106 "src/ipc/lite/ipc_client_stub.cpp", 107 "src/ipc/lite/ipc_cmd_parser.cpp", 108 "src/notify/device_manager_notify.cpp", 109 ] 110 111 defines = [ 112 "LITE_DEVICE", 113 "HI_LOG_ENABLE", 114 "DH_LOG_TAG=\"devicemanagerkit\"", 115 "LOG_DOMAIN=0xD004111", 116 ] 117 118 deps = [ 119 "${utils_path}:devicemanagerutils", 120 "//base/hiviewdfx/hilog_lite/frameworks/featured:hilog_shared", 121 "//base/security/device_auth/services:deviceauth_sdk", 122 "//base/startup/init/interfaces/innerkits:libbegetutil", 123 "//commonlibrary/utils_lite:utils", 124 "//foundation/communication/dsoftbus:dsoftbus", 125 "//foundation/systemabilitymgr/safwk_lite:safwk_lite", 126 "//foundation/systemabilitymgr/samgr_lite/samgr:samgr", 127 "//third_party/bounds_checking_function:libsec_shared", 128 ] 129 } 130 } 131} else { 132 config("devicemanagersdk_config") { 133 include_dirs = [ 134 "include", 135 "include/ipc", 136 "include/ipc/standard", 137 "include/notify", 138 "${common_path}/include", 139 "${common_path}/include/ipc", 140 "${common_path}/include/ipc/model", 141 "${common_path}/include/ipc/standard", 142 "${common_path}/include/dfx", 143 "${common_path}/include/dfx/standard", 144 "${devicemanager_path}/radar/include", 145 ] 146 } 147 148 ohos_shared_library("devicemanagersdk") { 149 branch_protector_ret = "pac_ret" 150 151 sanitize = { 152 boundary_sanitize = true 153 integer_overflow = true 154 ubsan = true 155 } 156 157 cflags = [ 158 "-Werror", 159 "-fPIC", 160 "-fstack-protector-strong", 161 ] 162 163 ldflags = [ 164 "-Wl,-z,relro", 165 "-Wl,-z,now", 166 ] 167 168 sources = [ 169 "${common_path}/src/dfx/standard/dm_hisysevent.cpp", 170 "${common_path}/src/dfx/standard/dm_hitrace.cpp", 171 "${common_path}/src/dm_anonymous.cpp", 172 "${common_path}/src/dm_constants.cpp", 173 "${common_path}/src/ipc/standard/ipc_cmd_register.cpp", 174 "${common_path}/src/ipc/standard/ipc_model_codec.cpp", 175 "${common_path}/src/json_object.cpp", 176 "${devicemanager_path}/radar/src/dm_radar_helper.cpp", 177 "src/device_manager.cpp", 178 "src/device_manager_impl.cpp", 179 "src/dm_device_info.cpp", 180 "src/ipc/ipc_client_proxy.cpp", 181 "src/ipc/standard/dm_service_load.cpp", 182 "src/ipc/standard/ipc_client_manager.cpp", 183 "src/ipc/standard/ipc_client_server_proxy.cpp", 184 "src/ipc/standard/ipc_client_stub.cpp", 185 "src/ipc/standard/ipc_cmd_parser.cpp", 186 "src/notify/device_manager_notify.cpp", 187 ] 188 189 public_configs = [ ":devicemanagersdk_config" ] 190 191 innerapi_tags = [ "platformsdk" ] 192 193 defines = [ 194 "HI_LOG_ENABLE", 195 "DH_LOG_TAG=\"devicemanagerkit\"", 196 "LOG_DOMAIN=0xD004111", 197 ] 198 199 external_deps = [ 200 "access_token:libaccesstoken_sdk", 201 "access_token:libtokenid_sdk", 202 "cJSON:cjson", 203 "c_utils:utils", 204 "ffrt:libffrt", 205 "hilog:libhilog", 206 "hisysevent:libhisysevent", 207 "hitrace:hitrace_meter", 208 "init:libbegetutil", 209 "ipc:ipc_core", 210 "ipc:ipc_napi", 211 "ipc:ipc_single", 212 "ipc:libdbinder", 213 "openssl:libcrypto_shared", 214 "samgr:samgr_proxy", 215 ] 216 217 public_external_deps = [ "cJSON:cjson" ] 218 219 subsystem_name = "distributedhardware" 220 221 part_name = "device_manager" 222 } 223} 224