1060ff233Sopenharmony_ci# Copyright (c) 2021-2024 Huawei Device Co., Ltd. 2060ff233Sopenharmony_ci# Licensed under the Apache License, Version 2.0 (the "License"); 3060ff233Sopenharmony_ci# you may not use this file except in compliance with the License. 4060ff233Sopenharmony_ci# You may obtain a copy of the License at 5060ff233Sopenharmony_ci# 6060ff233Sopenharmony_ci# http://www.apache.org/licenses/LICENSE-2.0 7060ff233Sopenharmony_ci# 8060ff233Sopenharmony_ci# Unless required by applicable law or agreed to in writing, software 9060ff233Sopenharmony_ci# distributed under the License is distributed on an "AS IS" BASIS, 10060ff233Sopenharmony_ci# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11060ff233Sopenharmony_ci# See the License for the specific language governing permissions and 12060ff233Sopenharmony_ci# limitations under the License. 13060ff233Sopenharmony_ci 14060ff233Sopenharmony_ciimport("../../core/common/dfx/dsoftbus_dfx.gni") 15060ff233Sopenharmony_ciimport("../../dsoftbus.gni") 16060ff233Sopenharmony_ciimport("../common/dfx/dsoftbus_dfx.gni") 17060ff233Sopenharmony_ciimport("../connection/common/conn_common.gni") 18060ff233Sopenharmony_ciimport("../transmission/common/trans_common.gni") 19060ff233Sopenharmony_ci 20060ff233Sopenharmony_cidsoftbus_root_path = "../.." 21060ff233Sopenharmony_cisoftbus_adapter_common = "${dsoftbus_root_path}/adapter/common" 22060ff233Sopenharmony_ci 23060ff233Sopenharmony_cicommon_utils_src = [ 24060ff233Sopenharmony_ci "bitmap/softbus_bitmap.c", 25060ff233Sopenharmony_ci "network/softbus_network_utils.c", 26060ff233Sopenharmony_ci "json_utils/softbus_json_utils.c", 27060ff233Sopenharmony_ci "message_handler/message_handler.c", 28060ff233Sopenharmony_ci "queue/softbus_queue.c", 29060ff233Sopenharmony_ci "security/sequence_verification/softbus_sequence_verification.c", 30060ff233Sopenharmony_ci "softbus_property/softbus_feature_config.c", 31060ff233Sopenharmony_ci "utils/softbus_utils.c", 32060ff233Sopenharmony_ci "dfx/hisysevent_adapter/softbus_hisysevt_bus_center.c", 33060ff233Sopenharmony_ci "dfx/hisysevent_adapter/softbus_hisysevt_common.c", 34060ff233Sopenharmony_ci "dfx/hisysevent_adapter/softbus_hisysevt_connreporter.c", 35060ff233Sopenharmony_ci "dfx/hisysevent_adapter/softbus_hisysevt_discreporter.c", 36060ff233Sopenharmony_ci "dfx/hisysevent_adapter/softbus_hisysevt_transreporter.c", 37060ff233Sopenharmony_ci] 38060ff233Sopenharmony_ciexternal_deps = [] 39060ff233Sopenharmony_ci 40060ff233Sopenharmony_ciif (defined(ohos_lite)) { 41060ff233Sopenharmony_ci if (ohos_kernel_type == "liteos_m") { 42060ff233Sopenharmony_ci diff_deps = [ 43060ff233Sopenharmony_ci "$hilog_lite_deps_path", 44060ff233Sopenharmony_ci "//build/lite/config/component/cJSON:cjson_static", 45060ff233Sopenharmony_ci ] 46060ff233Sopenharmony_ci diff_external_deps = [ "bounds_checking_function:libsec_static" ] 47060ff233Sopenharmony_ci build_type = "static_library" 48060ff233Sopenharmony_ci } else { 49060ff233Sopenharmony_ci diff_deps = [ 50060ff233Sopenharmony_ci "$hilog_lite_deps_path", 51060ff233Sopenharmony_ci "//build/lite/config/component/cJSON:cjson_shared", 52060ff233Sopenharmony_ci ] 53060ff233Sopenharmony_ci diff_external_deps = [ "bounds_checking_function:libsec_shared" ] 54060ff233Sopenharmony_ci build_type = "shared_library" 55060ff233Sopenharmony_ci } 56060ff233Sopenharmony_ci config("dsoftbus_utils_interface") { 57060ff233Sopenharmony_ci include_dirs = [ 58060ff233Sopenharmony_ci "$dsoftbus_root_path/core/common/include", 59060ff233Sopenharmony_ci "$dsoftbus_root_path/interfaces/kits/common", 60060ff233Sopenharmony_ci "$dsoftbus_root_path/core/common/dfx/hidumper_adapter/include", 61060ff233Sopenharmony_ci "$dsoftbus_root_path/core/common/dfx/hisysevent_adapter/include", 62060ff233Sopenharmony_ci "$dsoftbus_root_path/core/common/dfx/interface/include", 63060ff233Sopenharmony_ci "$softbus_adapter_common/include", 64060ff233Sopenharmony_ci "$hilog_lite_include_path", 65060ff233Sopenharmony_ci "$utils_lite_include_path", 66060ff233Sopenharmony_ci ] 67060ff233Sopenharmony_ci include_dirs += conn_common_inc + trans_common_inc 68060ff233Sopenharmony_ci if (board_toolchain_type != "iccarm") { 69060ff233Sopenharmony_ci cflags = [ 70060ff233Sopenharmony_ci "-ffunction-sections", 71060ff233Sopenharmony_ci "-fdata-sections", 72060ff233Sopenharmony_ci "-Os", 73060ff233Sopenharmony_ci ] 74060ff233Sopenharmony_ci } else { 75060ff233Sopenharmony_ci cflags = [ 76060ff233Sopenharmony_ci "--diag_suppress", 77060ff233Sopenharmony_ci "Pe186", 78060ff233Sopenharmony_ci ] 79060ff233Sopenharmony_ci } 80060ff233Sopenharmony_ci cflags_cc = cflags 81060ff233Sopenharmony_ci } 82060ff233Sopenharmony_ci 83060ff233Sopenharmony_ci target(build_type, "softbus_utils") { 84060ff233Sopenharmony_ci include_dirs = [ 85060ff233Sopenharmony_ci "$dsoftbus_root_path/interfaces/kits/common", 86060ff233Sopenharmony_ci "$dsoftbus_root_path/components/nstackx/nstackx_core/dfile/interface", 87060ff233Sopenharmony_ci ] 88060ff233Sopenharmony_ci include_dirs += conn_common_inc + trans_common_inc 89060ff233Sopenharmony_ci dfx_src = [ "dfx/hisysevent_adapter/softbus_hisysevt_nstack_virtual.c" ] 90060ff233Sopenharmony_ci sources = common_utils_src 91060ff233Sopenharmony_ci sources += conn_common_src + trans_common_src + dfx_src 92060ff233Sopenharmony_ci if (board_toolchain_type != "iccarm") { 93060ff233Sopenharmony_ci cflags = [ 94060ff233Sopenharmony_ci "-Wall", 95060ff233Sopenharmony_ci "-fPIC", 96060ff233Sopenharmony_ci "-std=c99", 97060ff233Sopenharmony_ci ] 98060ff233Sopenharmony_ci } 99060ff233Sopenharmony_ci if (ohos_kernel_type == "liteos_m") { 100060ff233Sopenharmony_ci defines += [ "SOFTBUS_LITEOS_M" ] 101060ff233Sopenharmony_ci defines += [ "__STDC_FORMAT_MACROS" ] 102060ff233Sopenharmony_ci } else { 103060ff233Sopenharmony_ci defines += [ "DEFAULT_STORAGE_PATH=\"/storage/data\"" ] 104060ff233Sopenharmony_ci defines += [ "__STDC_FORMAT_MACROS" ] 105060ff233Sopenharmony_ci defines += [ "SOFTBUS_LITEOS_A" ] 106060ff233Sopenharmony_ci } 107060ff233Sopenharmony_ci deps = [ 108060ff233Sopenharmony_ci "$dsoftbus_dfx_path/anonymize:softbus_dfx_anonymizer", 109060ff233Sopenharmony_ci "$dsoftbus_dfx_path/event:softbus_dfx_event", 110060ff233Sopenharmony_ci "$dsoftbus_dfx_path/log:softbus_dfx_log", 111060ff233Sopenharmony_ci "$dsoftbus_root_path/adapter:softbus_adapter", 112060ff233Sopenharmony_ci ] 113060ff233Sopenharmony_ci deps += diff_deps 114060ff233Sopenharmony_ci external_deps += diff_external_deps 115060ff233Sopenharmony_ci public_configs = [ ":dsoftbus_utils_interface" ] 116060ff233Sopenharmony_ci } 117060ff233Sopenharmony_ci} else { 118060ff233Sopenharmony_ci dstream_native_source_path = rebase_path("$dsoftbus_root_path") 119060ff233Sopenharmony_ci dstream_dep_file = "components/nstackx_enhanced/fillp/BUILD.gn" 120060ff233Sopenharmony_ci enhanced = exec_script("$dsoftbus_root_path/check_sub_module.py", 121060ff233Sopenharmony_ci [ 122060ff233Sopenharmony_ci "$dstream_native_source_path", 123060ff233Sopenharmony_ci "$dstream_dep_file", 124060ff233Sopenharmony_ci ], 125060ff233Sopenharmony_ci "value") 126060ff233Sopenharmony_ci 127060ff233Sopenharmony_ci cflags = [ "-DFILLP_LINUX" ] 128060ff233Sopenharmony_ci config("dsoftbus_utils_interface_L2") { 129060ff233Sopenharmony_ci include_dirs = [ 130060ff233Sopenharmony_ci "$dsoftbus_root_path/core/common/include", 131060ff233Sopenharmony_ci "$dsoftbus_root_path/core/common/dfx/hidumper_adapter/include", 132060ff233Sopenharmony_ci "$dsoftbus_root_path/core/common/dfx/hisysevent_adapter/include", 133060ff233Sopenharmony_ci "$dsoftbus_root_path/core/common/dfx/interface/include", 134060ff233Sopenharmony_ci "$dsoftbus_root_path/interfaces/kits/common", 135060ff233Sopenharmony_ci "$softbus_adapter_common/include", 136060ff233Sopenharmony_ci "$dsoftbus_root_path/components/nstackx/nstackx_core/dfile/interface", 137060ff233Sopenharmony_ci ] 138060ff233Sopenharmony_ci include_dirs += conn_common_inc + trans_common_inc 139060ff233Sopenharmony_ci } 140060ff233Sopenharmony_ci ohos_shared_library("softbus_utils") { 141060ff233Sopenharmony_ci sanitize = { 142060ff233Sopenharmony_ci ubsan = true 143060ff233Sopenharmony_ci integer_overflow = true 144060ff233Sopenharmony_ci boundary_sanitize = true 145060ff233Sopenharmony_ci cfi = true 146060ff233Sopenharmony_ci cfi_cross_dso = true 147060ff233Sopenharmony_ci debug = false 148060ff233Sopenharmony_ci } 149060ff233Sopenharmony_ci branch_protector_ret = "pac_ret" 150060ff233Sopenharmony_ci 151060ff233Sopenharmony_ci include_dirs = [ 152060ff233Sopenharmony_ci "$dsoftbus_root_path/interfaces/kits/common", 153060ff233Sopenharmony_ci "$dsoftbus_root_path/core/bus_center/utils/include", 154060ff233Sopenharmony_ci "$dsoftbus_root_path/core/common/include", 155060ff233Sopenharmony_ci "$dsoftbus_root_path/components/nstackx/fillp/include", 156060ff233Sopenharmony_ci "$dsoftbus_root_path/components/nstackx/nstackx_core/dfile/interface", 157060ff233Sopenharmony_ci "$dsoftbus_root_path/components/nstackx/nstackx_util/interface", 158060ff233Sopenharmony_ci "$dsoftbus_root_path/components/nstackx/nstackx_ctrl/interface", 159060ff233Sopenharmony_ci ] 160060ff233Sopenharmony_ci include_dirs += conn_common_inc + trans_common_inc 161060ff233Sopenharmony_ci dfx_source = [ 162060ff233Sopenharmony_ci "dfx/hidumper_adapter/softbus_hidumper.c", 163060ff233Sopenharmony_ci "dfx/hidumper_adapter/softbus_hidumper_bc_mgr.c", 164060ff233Sopenharmony_ci "dfx/hidumper_adapter/softbus_hidumper_broadcast.c", 165060ff233Sopenharmony_ci "dfx/hidumper_adapter/softbus_hidumper_disc.c", 166060ff233Sopenharmony_ci "dfx/hidumper_adapter/softbus_hidumper_conn.c", 167060ff233Sopenharmony_ci "dfx/hidumper_adapter/softbus_hidumper_nstack.c", 168060ff233Sopenharmony_ci "dfx/hidumper_adapter/softbus_hidumper_trans.c", 169060ff233Sopenharmony_ci "dfx/hidumper_adapter/softbus_hidumper_buscenter.c", 170060ff233Sopenharmony_ci "dfx/hisysevent_adapter/softbus_hisysevt_nstack.c", 171060ff233Sopenharmony_ci ] 172060ff233Sopenharmony_ci sources = common_utils_src + conn_common_src + trans_common_src + dfx_source 173060ff233Sopenharmony_ci sources += [ "$dsoftbus_root_path/core/common/utils/sqlite3_utils.c" ] 174060ff233Sopenharmony_ci defines += [ "DEFAULT_STORAGE_PATH=\"/data/service/el1/public\"" ] 175060ff233Sopenharmony_ci defines += [ "__STDC_FORMAT_MACROS" ] 176060ff233Sopenharmony_ci if (is_asan) { 177060ff233Sopenharmony_ci defines += [ "ASAN_BUILD" ] 178060ff233Sopenharmony_ci } 179060ff233Sopenharmony_ci 180060ff233Sopenharmony_ci public_configs = [ ":dsoftbus_utils_interface_L2" ] 181060ff233Sopenharmony_ci public_deps = [ 182060ff233Sopenharmony_ci "$dsoftbus_dfx_path/anonymize:softbus_dfx_anonymizer", 183060ff233Sopenharmony_ci "$dsoftbus_dfx_path/event:softbus_dfx_event", 184060ff233Sopenharmony_ci "$dsoftbus_dfx_path/log:softbus_dfx_log", 185060ff233Sopenharmony_ci "$dsoftbus_root_path/adapter:softbus_adapter", 186060ff233Sopenharmony_ci ] 187060ff233Sopenharmony_ci public_external_deps = [ 188060ff233Sopenharmony_ci "cJSON:cjson", 189060ff233Sopenharmony_ci "sqlite:sqlite", 190060ff233Sopenharmony_ci ] 191060ff233Sopenharmony_ci external_deps += [ 192060ff233Sopenharmony_ci "bounds_checking_function:libsec_shared", 193060ff233Sopenharmony_ci "cJSON:cjson", 194060ff233Sopenharmony_ci ] 195060ff233Sopenharmony_ci if (!enhanced) { 196060ff233Sopenharmony_ci cflags += [ "-DFILLP_ENHANCED" ] 197060ff233Sopenharmony_ci public_deps += [ 198060ff233Sopenharmony_ci "$dsoftbus_root_path/components/nstackx/fillp:FillpSo.open", 199060ff233Sopenharmony_ci "$dsoftbus_root_path/components/nstackx/nstackx_core/dfile:nstackx_dfile.open", 200060ff233Sopenharmony_ci "$dsoftbus_root_path/components/nstackx/nstackx_ctrl:nstackx_ctrl", 201060ff233Sopenharmony_ci "$dsoftbus_root_path/components/nstackx/nstackx_util:nstackx_util.open", 202060ff233Sopenharmony_ci ] 203060ff233Sopenharmony_ci } 204060ff233Sopenharmony_ci if (is_standard_system) { 205060ff233Sopenharmony_ci external_deps += [ 206060ff233Sopenharmony_ci "hilog:libhilog", 207060ff233Sopenharmony_ci "hisysevent:libhisysevent", 208060ff233Sopenharmony_ci ] 209060ff233Sopenharmony_ci } 210060ff233Sopenharmony_ci innerapi_tags = [ "platformsdk_indirect" ] 211060ff233Sopenharmony_ci part_name = "dsoftbus" 212060ff233Sopenharmony_ci subsystem_name = "communication" 213060ff233Sopenharmony_ci } 214060ff233Sopenharmony_ci} 215