1# Copyright (c) 2021-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 14import("../../core/common/dfx/dsoftbus_dfx.gni") 15import("../../dsoftbus.gni") 16import("../common/dfx/dsoftbus_dfx.gni") 17import("../connection/common/conn_common.gni") 18import("../transmission/common/trans_common.gni") 19 20dsoftbus_root_path = "../.." 21softbus_adapter_common = "${dsoftbus_root_path}/adapter/common" 22 23common_utils_src = [ 24 "bitmap/softbus_bitmap.c", 25 "network/softbus_network_utils.c", 26 "json_utils/softbus_json_utils.c", 27 "message_handler/message_handler.c", 28 "queue/softbus_queue.c", 29 "security/sequence_verification/softbus_sequence_verification.c", 30 "softbus_property/softbus_feature_config.c", 31 "utils/softbus_utils.c", 32 "dfx/hisysevent_adapter/softbus_hisysevt_bus_center.c", 33 "dfx/hisysevent_adapter/softbus_hisysevt_common.c", 34 "dfx/hisysevent_adapter/softbus_hisysevt_connreporter.c", 35 "dfx/hisysevent_adapter/softbus_hisysevt_discreporter.c", 36 "dfx/hisysevent_adapter/softbus_hisysevt_transreporter.c", 37] 38external_deps = [] 39 40if (defined(ohos_lite)) { 41 if (ohos_kernel_type == "liteos_m") { 42 diff_deps = [ 43 "$hilog_lite_deps_path", 44 "//build/lite/config/component/cJSON:cjson_static", 45 ] 46 diff_external_deps = [ "bounds_checking_function:libsec_static" ] 47 build_type = "static_library" 48 } else { 49 diff_deps = [ 50 "$hilog_lite_deps_path", 51 "//build/lite/config/component/cJSON:cjson_shared", 52 ] 53 diff_external_deps = [ "bounds_checking_function:libsec_shared" ] 54 build_type = "shared_library" 55 } 56 config("dsoftbus_utils_interface") { 57 include_dirs = [ 58 "$dsoftbus_root_path/core/common/include", 59 "$dsoftbus_root_path/interfaces/kits/common", 60 "$dsoftbus_root_path/core/common/dfx/hidumper_adapter/include", 61 "$dsoftbus_root_path/core/common/dfx/hisysevent_adapter/include", 62 "$dsoftbus_root_path/core/common/dfx/interface/include", 63 "$softbus_adapter_common/include", 64 "$hilog_lite_include_path", 65 "$utils_lite_include_path", 66 ] 67 include_dirs += conn_common_inc + trans_common_inc 68 if (board_toolchain_type != "iccarm") { 69 cflags = [ 70 "-ffunction-sections", 71 "-fdata-sections", 72 "-Os", 73 ] 74 } else { 75 cflags = [ 76 "--diag_suppress", 77 "Pe186", 78 ] 79 } 80 cflags_cc = cflags 81 } 82 83 target(build_type, "softbus_utils") { 84 include_dirs = [ 85 "$dsoftbus_root_path/interfaces/kits/common", 86 "$dsoftbus_root_path/components/nstackx/nstackx_core/dfile/interface", 87 ] 88 include_dirs += conn_common_inc + trans_common_inc 89 dfx_src = [ "dfx/hisysevent_adapter/softbus_hisysevt_nstack_virtual.c" ] 90 sources = common_utils_src 91 sources += conn_common_src + trans_common_src + dfx_src 92 if (board_toolchain_type != "iccarm") { 93 cflags = [ 94 "-Wall", 95 "-fPIC", 96 "-std=c99", 97 ] 98 } 99 if (ohos_kernel_type == "liteos_m") { 100 defines += [ "SOFTBUS_LITEOS_M" ] 101 defines += [ "__STDC_FORMAT_MACROS" ] 102 } else { 103 defines += [ "DEFAULT_STORAGE_PATH=\"/storage/data\"" ] 104 defines += [ "__STDC_FORMAT_MACROS" ] 105 defines += [ "SOFTBUS_LITEOS_A" ] 106 } 107 deps = [ 108 "$dsoftbus_dfx_path/anonymize:softbus_dfx_anonymizer", 109 "$dsoftbus_dfx_path/event:softbus_dfx_event", 110 "$dsoftbus_dfx_path/log:softbus_dfx_log", 111 "$dsoftbus_root_path/adapter:softbus_adapter", 112 ] 113 deps += diff_deps 114 external_deps += diff_external_deps 115 public_configs = [ ":dsoftbus_utils_interface" ] 116 } 117} else { 118 dstream_native_source_path = rebase_path("$dsoftbus_root_path") 119 dstream_dep_file = "components/nstackx_enhanced/fillp/BUILD.gn" 120 enhanced = exec_script("$dsoftbus_root_path/check_sub_module.py", 121 [ 122 "$dstream_native_source_path", 123 "$dstream_dep_file", 124 ], 125 "value") 126 127 cflags = [ "-DFILLP_LINUX" ] 128 config("dsoftbus_utils_interface_L2") { 129 include_dirs = [ 130 "$dsoftbus_root_path/core/common/include", 131 "$dsoftbus_root_path/core/common/dfx/hidumper_adapter/include", 132 "$dsoftbus_root_path/core/common/dfx/hisysevent_adapter/include", 133 "$dsoftbus_root_path/core/common/dfx/interface/include", 134 "$dsoftbus_root_path/interfaces/kits/common", 135 "$softbus_adapter_common/include", 136 "$dsoftbus_root_path/components/nstackx/nstackx_core/dfile/interface", 137 ] 138 include_dirs += conn_common_inc + trans_common_inc 139 } 140 ohos_shared_library("softbus_utils") { 141 sanitize = { 142 cfi = true 143 cfi_cross_dso = true 144 debug = false 145 } 146 branch_protector_ret = "pac_ret" 147 148 include_dirs = [ 149 "$dsoftbus_root_path/interfaces/kits/common", 150 "$dsoftbus_root_path/core/bus_center/utils/include", 151 "$dsoftbus_root_path/core/common/include", 152 "$dsoftbus_root_path/components/nstackx/fillp/include", 153 "$dsoftbus_root_path/components/nstackx/nstackx_core/dfile/interface", 154 "$dsoftbus_root_path/components/nstackx/nstackx_util/interface", 155 "$dsoftbus_root_path/components/nstackx/nstackx_ctrl/interface", 156 ] 157 include_dirs += conn_common_inc + trans_common_inc 158 dfx_source = [ 159 "dfx/hidumper_adapter/softbus_hidumper.c", 160 "dfx/hidumper_adapter/softbus_hidumper_bc_mgr.c", 161 "dfx/hidumper_adapter/softbus_hidumper_broadcast.c", 162 "dfx/hidumper_adapter/softbus_hidumper_disc.c", 163 "dfx/hidumper_adapter/softbus_hidumper_conn.c", 164 "dfx/hidumper_adapter/softbus_hidumper_nstack.c", 165 "dfx/hidumper_adapter/softbus_hidumper_trans.c", 166 "dfx/hidumper_adapter/softbus_hidumper_buscenter.c", 167 "dfx/hisysevent_adapter/softbus_hisysevt_nstack.c", 168 ] 169 sources = common_utils_src + conn_common_src + trans_common_src + dfx_source 170 sources += [ "$dsoftbus_root_path/core/common/utils/sqlite3_utils.c" ] 171 defines += [ "DEFAULT_STORAGE_PATH=\"/data/service/el1/public\"" ] 172 defines += [ "__STDC_FORMAT_MACROS" ] 173 if (is_asan) { 174 defines += [ "ASAN_BUILD" ] 175 } 176 177 public_configs = [ ":dsoftbus_utils_interface_L2" ] 178 public_deps = [ 179 "$dsoftbus_dfx_path/anonymize:softbus_dfx_anonymizer", 180 "$dsoftbus_dfx_path/event:softbus_dfx_event", 181 "$dsoftbus_dfx_path/log:softbus_dfx_log", 182 "$dsoftbus_root_path/adapter:softbus_adapter", 183 ] 184 public_external_deps = [ 185 "cJSON:cjson", 186 "sqlite:sqlite", 187 ] 188 external_deps += [ 189 "bounds_checking_function:libsec_shared", 190 "cJSON:cjson", 191 ] 192 if (!enhanced) { 193 cflags += [ "-DFILLP_ENHANCED" ] 194 public_deps += [ 195 "$dsoftbus_root_path/components/nstackx/fillp:FillpSo.open", 196 "$dsoftbus_root_path/components/nstackx/nstackx_core/dfile:nstackx_dfile.open", 197 "$dsoftbus_root_path/components/nstackx/nstackx_ctrl:nstackx_ctrl", 198 "$dsoftbus_root_path/components/nstackx/nstackx_util:nstackx_util.open", 199 ] 200 } 201 if (is_standard_system) { 202 external_deps += [ 203 "hilog:libhilog", 204 "hisysevent:libhisysevent", 205 ] 206 } 207 innerapi_tags = [ "platformsdk_indirect" ] 208 part_name = "dsoftbus" 209 subsystem_name = "communication" 210 } 211} 212