1# Copyright (c) 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} 19import("//foundation/distributedhardware/device_manager/device_manager.gni") 20if (defined(ohos_lite)) { 21 if (ohos_kernel_type == "linux") { 22 shared_library("dmdevicecache") { 23 include_dirs = [ 24 "include", 25 "${common_path}/include", 26 "${innerkits_path}/native_cpp/include", 27 "${utils_path}/include/crypto", 28 "${json_path}/include", 29 ] 30 31 sources = [ 32 "${common_path}/src/dm_anonymous.cpp", 33 "src/dm_softbus_cache.cpp", 34 ] 35 36 defines = [ 37 "LITE_DEVICE", 38 "DH_LOG_TAG=\"dmdevicecache\"", 39 "LOG_DOMAIN=0xD004113", 40 ] 41 42 deps = [ 43 "${dsoftbussdk_path}:softbus_client", 44 "${hilog_path}:hilog_shared", 45 "${json_path}:devicemanagerjson", 46 "${third_path}:libsec_shared", 47 "${utils_path}:devicemanagerutils", 48 ] 49 } 50 } 51} else { 52 ohos_shared_library("dmdevicecache") { 53 sanitize = { 54 boundary_sanitize = true 55 cfi = true 56 cfi_cross_dso = true 57 debug = false 58 integer_overflow = true 59 ubsan = true 60 } 61 62 cflags = [ 63 "-Werror", 64 "-fPIC", 65 "-fstack-protector-strong", 66 ] 67 68 ldflags = [ 69 "-Wl,-z,relro", 70 "-Wl,-z,now", 71 ] 72 73 include_dirs = [ 74 "include", 75 "${common_path}/include", 76 "${utils_path}/include/crypto", 77 ] 78 79 sources = [ "src/dm_softbus_cache.cpp" ] 80 81 defines = [ 82 "HI_LOG_ENABLE", 83 "DH_LOG_TAG=\"dmdevicecache\"", 84 "LOG_DOMAIN=0xD004113", 85 ] 86 87 deps = [ 88 "${innerkits_path}/native_cpp:devicemanagersdk", 89 "${json_path}:devicemanagerjson", 90 "${utils_path}:devicemanagerutils", 91 ] 92 93 external_deps = [ 94 "bounds_checking_function:libsec_shared", 95 "dsoftbus:softbus_client", 96 "hilog:libhilog", 97 ] 98 99 subsystem_name = "distributedhardware" 100 101 part_name = "device_manager" 102 } 103} 104