# Copyright (c) 2021-2024 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. import("../../core/common/dfx/dsoftbus_dfx.gni") import("../../dsoftbus.gni") import("../common/dfx/dsoftbus_dfx.gni") import("../connection/common/conn_common.gni") import("../transmission/common/trans_common.gni") dsoftbus_root_path = "../.." softbus_adapter_common = "${dsoftbus_root_path}/adapter/common" common_utils_src = [ "bitmap/softbus_bitmap.c", "network/softbus_network_utils.c", "json_utils/softbus_json_utils.c", "message_handler/message_handler.c", "queue/softbus_queue.c", "security/sequence_verification/softbus_sequence_verification.c", "softbus_property/softbus_feature_config.c", "utils/softbus_utils.c", "dfx/hisysevent_adapter/softbus_hisysevt_bus_center.c", "dfx/hisysevent_adapter/softbus_hisysevt_common.c", "dfx/hisysevent_adapter/softbus_hisysevt_connreporter.c", "dfx/hisysevent_adapter/softbus_hisysevt_discreporter.c", "dfx/hisysevent_adapter/softbus_hisysevt_transreporter.c", ] external_deps = [] if (defined(ohos_lite)) { if (ohos_kernel_type == "liteos_m") { diff_deps = [ "$hilog_lite_deps_path", "//build/lite/config/component/cJSON:cjson_static", ] diff_external_deps = [ "bounds_checking_function:libsec_static" ] build_type = "static_library" } else { diff_deps = [ "$hilog_lite_deps_path", "//build/lite/config/component/cJSON:cjson_shared", ] diff_external_deps = [ "bounds_checking_function:libsec_shared" ] build_type = "shared_library" } config("dsoftbus_utils_interface") { include_dirs = [ "$dsoftbus_root_path/core/common/include", "$dsoftbus_root_path/interfaces/kits/common", "$dsoftbus_root_path/core/common/dfx/hidumper_adapter/include", "$dsoftbus_root_path/core/common/dfx/hisysevent_adapter/include", "$dsoftbus_root_path/core/common/dfx/interface/include", "$softbus_adapter_common/include", "$hilog_lite_include_path", "$utils_lite_include_path", ] include_dirs += conn_common_inc + trans_common_inc if (board_toolchain_type != "iccarm") { cflags = [ "-ffunction-sections", "-fdata-sections", "-Os", ] } else { cflags = [ "--diag_suppress", "Pe186", ] } cflags_cc = cflags } target(build_type, "softbus_utils") { include_dirs = [ "$dsoftbus_root_path/interfaces/kits/common", "$dsoftbus_root_path/components/nstackx/nstackx_core/dfile/interface", ] include_dirs += conn_common_inc + trans_common_inc dfx_src = [ "dfx/hisysevent_adapter/softbus_hisysevt_nstack_virtual.c" ] sources = common_utils_src sources += conn_common_src + trans_common_src + dfx_src if (board_toolchain_type != "iccarm") { cflags = [ "-Wall", "-fPIC", "-std=c99", ] } if (ohos_kernel_type == "liteos_m") { defines += [ "SOFTBUS_LITEOS_M" ] defines += [ "__STDC_FORMAT_MACROS" ] } else { defines += [ "DEFAULT_STORAGE_PATH=\"/storage/data\"" ] defines += [ "__STDC_FORMAT_MACROS" ] defines += [ "SOFTBUS_LITEOS_A" ] } deps = [ "$dsoftbus_dfx_path/anonymize:softbus_dfx_anonymizer", "$dsoftbus_dfx_path/event:softbus_dfx_event", "$dsoftbus_dfx_path/log:softbus_dfx_log", "$dsoftbus_root_path/adapter:softbus_adapter", ] deps += diff_deps external_deps += diff_external_deps public_configs = [ ":dsoftbus_utils_interface" ] } } else { dstream_native_source_path = rebase_path("$dsoftbus_root_path") dstream_dep_file = "components/nstackx_enhanced/fillp/BUILD.gn" enhanced = exec_script("$dsoftbus_root_path/check_sub_module.py", [ "$dstream_native_source_path", "$dstream_dep_file", ], "value") cflags = [ "-DFILLP_LINUX" ] config("dsoftbus_utils_interface_L2") { include_dirs = [ "$dsoftbus_root_path/core/common/include", "$dsoftbus_root_path/core/common/dfx/hidumper_adapter/include", "$dsoftbus_root_path/core/common/dfx/hisysevent_adapter/include", "$dsoftbus_root_path/core/common/dfx/interface/include", "$dsoftbus_root_path/interfaces/kits/common", "$softbus_adapter_common/include", "$dsoftbus_root_path/components/nstackx/nstackx_core/dfile/interface", ] include_dirs += conn_common_inc + trans_common_inc } ohos_shared_library("softbus_utils") { sanitize = { cfi = true cfi_cross_dso = true debug = false } branch_protector_ret = "pac_ret" include_dirs = [ "$dsoftbus_root_path/interfaces/kits/common", "$dsoftbus_root_path/core/bus_center/utils/include", "$dsoftbus_root_path/core/common/include", "$dsoftbus_root_path/components/nstackx/fillp/include", "$dsoftbus_root_path/components/nstackx/nstackx_core/dfile/interface", "$dsoftbus_root_path/components/nstackx/nstackx_util/interface", "$dsoftbus_root_path/components/nstackx/nstackx_ctrl/interface", ] include_dirs += conn_common_inc + trans_common_inc dfx_source = [ "dfx/hidumper_adapter/softbus_hidumper.c", "dfx/hidumper_adapter/softbus_hidumper_bc_mgr.c", "dfx/hidumper_adapter/softbus_hidumper_broadcast.c", "dfx/hidumper_adapter/softbus_hidumper_disc.c", "dfx/hidumper_adapter/softbus_hidumper_conn.c", "dfx/hidumper_adapter/softbus_hidumper_nstack.c", "dfx/hidumper_adapter/softbus_hidumper_trans.c", "dfx/hidumper_adapter/softbus_hidumper_buscenter.c", "dfx/hisysevent_adapter/softbus_hisysevt_nstack.c", ] sources = common_utils_src + conn_common_src + trans_common_src + dfx_source sources += [ "$dsoftbus_root_path/core/common/utils/sqlite3_utils.c" ] defines += [ "DEFAULT_STORAGE_PATH=\"/data/service/el1/public\"" ] defines += [ "__STDC_FORMAT_MACROS" ] if (is_asan) { defines += [ "ASAN_BUILD" ] } public_configs = [ ":dsoftbus_utils_interface_L2" ] public_deps = [ "$dsoftbus_dfx_path/anonymize:softbus_dfx_anonymizer", "$dsoftbus_dfx_path/event:softbus_dfx_event", "$dsoftbus_dfx_path/log:softbus_dfx_log", "$dsoftbus_root_path/adapter:softbus_adapter", ] public_external_deps = [ "cJSON:cjson", "sqlite:sqlite", ] external_deps += [ "bounds_checking_function:libsec_shared", "cJSON:cjson", ] if (!enhanced) { cflags += [ "-DFILLP_ENHANCED" ] public_deps += [ "$dsoftbus_root_path/components/nstackx/fillp:FillpSo.open", "$dsoftbus_root_path/components/nstackx/nstackx_core/dfile:nstackx_dfile.open", "$dsoftbus_root_path/components/nstackx/nstackx_ctrl:nstackx_ctrl", "$dsoftbus_root_path/components/nstackx/nstackx_util:nstackx_util.open", ] } if (is_standard_system) { external_deps += [ "hilog:libhilog", "hisysevent:libhisysevent", ] } innerapi_tags = [ "platformsdk_indirect" ] part_name = "dsoftbus" subsystem_name = "communication" } }