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/cJSON", 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 "${common_path}/src/json_object.cpp", 51 "src/appInfo/lite/app_manager.cpp", 52 "src/crypto/dm_crypto.cpp", 53 "src/dm_random.cpp", 54 "src/fwkload/lite/dm_distributed_hardware_load.cpp", 55 "src/timer/lite/dm_timer.cpp", 56 ] 57 58 defines = [ 59 "LITE_DEVICE", 60 "hI_LOG_ENABLE", 61 "DH_LOG_TAG=\"devicemanagerutils\"", 62 "lOG_DOMAIN=0xD004110", 63 ] 64 65 deps = [ "//base/hiviewdfx/hilog_lite/frameworks/featured:hilog_shared" ] 66 external_deps = [ 67 "bounds_checking_function:libsec_shared", 68 "openssl:libcrypto_shared", 69 ] 70 } 71 } 72} else { 73 config("devicemanagerutils_config") { 74 include_dirs = [ 75 "include", 76 "include/crypto", 77 "include/kvadapter", 78 "include/fwkload/standard", 79 "include/appInfo/standard", 80 "include/timer", 81 "${innerkits_path}/native_cpp/include", 82 "${common_path}/include", 83 ] 84 } 85 86 ohos_shared_library("devicemanagerutils") { 87 branch_protector_ret = "pac_ret" 88 89 sanitize = { 90 boundary_sanitize = true 91 cfi = true 92 cfi_cross_dso = true 93 debug = false 94 integer_overflow = true 95 ubsan = true 96 } 97 98 cflags = [ 99 "-fPIC", 100 "-fstack-protector-strong", 101 "-Werror", 102 ] 103 104 ldflags = [ 105 "-Wl,-z,relro", 106 "-Wl,-z,now", 107 ] 108 109 sources = [ 110 "${common_path}/src/dm_anonymous.cpp", 111 "${common_path}/src/json_object.cpp", 112 "src/appInfo/standard/app_manager.cpp", 113 "src/crypto/dm_crypto.cpp", 114 "src/dm_random.cpp", 115 "src/kvadapter/dm_kv_info.cpp", 116 "src/kvadapter/kv_adapter.cpp", 117 "src/kvadapter/kv_adapter_manager.cpp", 118 "src/timer/dm_timer.cpp", 119 ] 120 121 if (support_jsapi) { 122 sources += [ "src/fwkload/standard/dm_distributed_hardware_load.cpp" ] 123 } 124 125 public_configs = [ ":devicemanagerutils_config" ] 126 127 defines = [ 128 "HI_LOG_ENABLE", 129 "DH_LOG_TAG=\"devicemanagerutils\"", 130 "LOG_DOMAIN=0xD004110", 131 ] 132 133 external_deps = [ 134 "access_token:libaccesstoken_sdk", 135 "access_token:libtokenid_sdk", 136 "bundle_framework:appexecfwk_base", 137 "bundle_framework:appexecfwk_core", 138 "cJSON:cjson", 139 "c_utils:utils", 140 "eventhandler:libeventhandler", 141 "ffrt:libffrt", 142 "hilog:libhilog", 143 "ipc:ipc_core", 144 "ipc:ipc_single", 145 "openssl:libcrypto_shared", 146 "os_account:os_account_innerkits", 147 "samgr:samgr_proxy", 148 ] 149 150 public_external_deps = [ 151 "bundle_framework:appexecfwk_core", 152 "cJSON:cjson", 153 "kv_store:distributeddata_inner", 154 ] 155 156 if (support_jsapi) { 157 external_deps += [ "bundle_framework:appexecfwk_core" ] 158 } 159 160 subsystem_name = "distributedhardware" 161 162 part_name = "device_manager" 163 } 164} 165