communication_dsoftbus/adapter/BUILD.gn
yyh 6754b1cd24 Description:change reference library
Feature or Bugfix:Bugfix
Bunary Source:No

Signed-off-by: yyh <yangyinghua1@huawei.com>
2024-05-28 19:07:17 +08:00

307 lines
12 KiB
Plaintext

# Copyright (c) 2021 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")
dsoftbus_root_path = ".."
softbus_adapter_common = "${dsoftbus_root_path}/adapter/common"
dsoftbus_feature_product_config_path =
"${dsoftbus_root_path}/adapter/default_config"
softbus_adapter_config = "${dsoftbus_root_path}/adapter/default_config"
native_source_path = rebase_path("$dsoftbus_root_path")
dep_feature = "dsoftbus_enhance/adapter/default_config/spec_config/softbus_config_adapter.c"
enhance_feature = exec_script("$dsoftbus_root_path/check_sub_module.py",
[
"$native_source_path",
"$dep_feature",
],
"value")
if (defined(ohos_lite)) {
import("//build/lite/config/component/lite_component.gni")
config("dsoftbus_adapter_common_interface") {
include_dirs = [
"$softbus_adapter_common/include",
"$softbus_adapter_common/include/OS_adapter_define/linux",
"$softbus_adapter_config/spec_config",
"$dsoftbus_root_path/core/common/include",
"$hilog_lite_include_path",
"$utils_lite_include_path",
]
if (board_name == "v200zr") {
defines += [ "DSOFTBUS_V200ZR" ]
}
}
common_include = [
"$dsoftbus_root_path/core/common/dfx/interface/include",
"$dsoftbus_root_path/interfaces/kits",
"$dsoftbus_root_path/interfaces/kits/common",
]
if (ohos_kernel_type == "liteos_m") {
static_library("softbus_adapter") {
include_dirs = common_include
include_dirs += [ "//kernel/liteos_m/kal/cmsis" ]
external_deps = [
"bounds_checking_function:libsec_static",
"init:libbegetutil",
"json:nlohmann_json_static",
]
if (board_name == "hispark_pegasus") {
include_dirs +=
[ "$hispark_pegasus_sdk_path/third_party/lwip_sack/include" ]
defines += [ "HISPARK_PEGASUS_USE_NETIF_GET_ADDR" ]
}
if (board_toolchain_type == "iccarm") {
include_dirs += [
"//kernel/liteos_m/components/net/lwip-2.1/porting/include",
"//third_party/lwip/src/include",
]
cflags = [
"--diag_suppress",
"Pe226,Pe513",
]
ldflags = [ "-lpthread" ]
} else {
cflags = [ "-Wall" ]
}
sources = [
"$softbus_adapter_common/dfx/softbus_adapter_hisysevent_mini.c",
"$softbus_adapter_common/dfx/softbus_adapter_hitrace_virtual.c",
"$softbus_adapter_common/kernel/liteos_m/lnn_ip_utils_adapter.c",
"$softbus_adapter_common/kernel/liteos_m/softbus_adapter_file.c",
"$softbus_adapter_common/kernel/liteos_m/softbus_adapter_mem.c",
"$softbus_adapter_common/kernel/liteos_m/softbus_adapter_timer.c",
"$softbus_adapter_common/kernel/posix/softbus_adapter_socket.c",
"$softbus_adapter_common/kernel/posix/softbus_adapter_thread.c",
"$softbus_adapter_common/range/softbus_adapter_range.c",
]
if (enhance_feature) {
sources += [ "$dsoftbus_root_path/dsoftbus_enhance/adapter/default_config/spec_config/softbus_config_adapter.c" ]
} else {
sources +=
[ "$softbus_adapter_config/spec_config/softbus_config_adapter.c" ]
}
if (board_name == "v200zr") {
external_deps += [ "json:nlohmann_json_static" ]
sources = []
sources = [
"$softbus_adapter_common/dfx/softbus_adapter_hisysevent_mini.c",
"$softbus_adapter_common/dfx/softbus_adapter_hitrace_virtual.c",
"$softbus_adapter_common/json/nlohmann/softbus_adapter_json.cpp",
"$softbus_adapter_common/kernel/liteos_m/lnn_ip_utils_adapter.c",
"$softbus_adapter_common/kernel/liteos_m/softbus_adapter_mem.c",
"$softbus_adapter_common/kernel/liteos_m/softbus_adapter_timer.c",
"$softbus_adapter_common/kernel/posix/softbus_adapter_file.c",
"$softbus_adapter_common/kernel/posix/softbus_adapter_socket.c",
"$softbus_adapter_common/kernel/posix/softbus_adapter_thread.c",
"$softbus_adapter_common/perf/softbus_adapter_perf.c",
"$softbus_adapter_common/range/softbus_adapter_range.c",
]
if (enhance_feature) {
sources += [ "$dsoftbus_root_path/dsoftbus_enhance/adapter/default_config/spec_config/softbus_config_adapter.c" ]
} else {
sources +=
[ "$softbus_adapter_config/spec_config/softbus_config_adapter.c" ]
}
}
deps = [
"$dsoftbus_dfx_path/event:softbus_dfx_event",
"$dsoftbus_dfx_path/log:softbus_dfx_log",
"$hilog_lite_deps_path",
]
if (dsoftbus_feature_encrypt == 0) {
sources += [
"$softbus_adapter_common/mbedtls/softbus_adapter_crypto.c",
"$softbus_adapter_common/mbedtls/softbus_aes_encrypt_virtual.c",
]
deps += [ "//third_party/mbedtls" ]
} else if (dsoftbus_feature_encrypt == 1) {
sources += [
"$softbus_adapter_common/openssl/softbus_adapter_crypto.c",
"$softbus_adapter_common/openssl/softbus_aes_encrypt.c",
]
deps += [ "//third_party/openssl/ohos_lite:openssl_shared" ]
}
public_configs = [ ":dsoftbus_adapter_common_interface" ]
}
} else {
shared_library("softbus_adapter") {
include_dirs = common_include
cflags = [
"-Wall",
"-Werror",
"-fPIC",
"-fno-builtin",
"-std=c99",
]
cflags_cc = [ "-fPIC" ]
sources = [
"$softbus_adapter_common/dfx/softbus_adapter_hisysevent_mini.c",
"$softbus_adapter_common/dfx/softbus_adapter_hitrace_virtual.c",
"$softbus_adapter_common/json/nlohmann/softbus_adapter_json.cpp",
"$softbus_adapter_common/kernel/posix/lnn_ip_utils_adapter.c",
"$softbus_adapter_common/kernel/posix/softbus_adapter_file.c",
"$softbus_adapter_common/kernel/posix/softbus_adapter_mem.c",
"$softbus_adapter_common/kernel/posix/softbus_adapter_socket.c",
"$softbus_adapter_common/kernel/posix/softbus_adapter_thread.c",
"$softbus_adapter_common/kernel/posix/softbus_adapter_timer.c",
"$softbus_adapter_common/perf/softbus_adapter_perf.c",
"$softbus_adapter_common/range/softbus_adapter_range.c",
]
if (enhance_feature) {
sources += [ "$dsoftbus_root_path/dsoftbus_enhance/adapter/default_config/spec_config/softbus_config_adapter.c" ]
} else {
sources +=
[ "$softbus_adapter_config/spec_config/softbus_config_adapter.c" ]
}
deps = [
"$dsoftbus_dfx_path/event:softbus_dfx_event",
"$dsoftbus_dfx_path/log:softbus_dfx_log",
"$hilog_lite_deps_path",
]
external_deps = [
"bounds_checking_function:libsec_shared",
"init:libbegetutil",
]
external_deps += [ "json:nlohmann_json_static" ]
if (dsoftbus_feature_encrypt == 0) {
sources += [
"$softbus_adapter_common/mbedtls/softbus_adapter_crypto.c",
"$softbus_adapter_common/mbedtls/softbus_aes_encrypt_virtual.c",
]
deps += [ "//third_party/mbedtls" ]
} else if (dsoftbus_feature_encrypt == 1) {
sources += [
"$softbus_adapter_common/openssl/softbus_adapter_crypto.c",
"$softbus_adapter_common/openssl/softbus_aes_encrypt.c",
]
deps += [ "//third_party/openssl/ohos_lite:openssl_shared" ]
}
public_configs = [ ":dsoftbus_adapter_common_interface" ]
}
}
} else {
config("config_adapter_common") {
include_dirs = [
"$softbus_adapter_common/include",
"$softbus_adapter_common/include/OS_adapter_define/linux",
"$dsoftbus_feature_product_config_path/spec_config",
"$dsoftbus_root_path/core/common/dfx/interface/include",
"$dsoftbus_root_path/core/common/include",
]
}
ohos_shared_library("softbus_adapter") {
sanitize = {
ubsan = true
integer_overflow = true
boundary_sanitize = true
cfi = true
cfi_cross_dso = true
debug = false
}
branch_protector_ret = "pac_ret"
include_dirs = [
"$dsoftbus_root_path/core/common/dfx/interface/include",
"$dsoftbus_root_path/interfaces/kits",
"$dsoftbus_root_path/interfaces/kits/common",
]
external_deps = [ "bounds_checking_function:libsec_shared" ]
if (is_standard_system) {
external_deps += [
"c_utils:utils",
"json:nlohmann_json_static",
]
}
sources = [
"$softbus_adapter_common/dfx/softbus_adapter_hisysevent.cpp",
"$softbus_adapter_common/dfx/softbus_adapter_hitrace.c",
"$softbus_adapter_common/json/nlohmann/softbus_adapter_json.cpp",
"$softbus_adapter_common/kernel/posix/lnn_ip_utils_adapter.c",
"$softbus_adapter_common/kernel/posix/softbus_adapter_file.c",
"$softbus_adapter_common/kernel/posix/softbus_adapter_mem.c",
"$softbus_adapter_common/kernel/posix/softbus_adapter_socket.c",
"$softbus_adapter_common/kernel/posix/softbus_adapter_thread.c",
"$softbus_adapter_common/kernel/posix/softbus_adapter_timer.c",
"$softbus_adapter_common/perf/softbus_adapter_perf.c",
]
if (enhance_feature) {
sources += [ "$dsoftbus_root_path/dsoftbus_enhance/adapter/default_config/spec_config/softbus_config_adapter.c" ]
} else {
sources +=
[ "$softbus_adapter_config/spec_config/softbus_config_adapter.c" ]
}
public_deps = [
"$dsoftbus_dfx_path/event:softbus_dfx_event",
"$dsoftbus_dfx_path/log:softbus_dfx_log",
]
public_external_deps = [ "bounds_checking_function:libsec_shared" ]
ble_enhanced_impl =
"dsoftbus_enhance/adapter/common/range/softbus_adapter_range.c"
enhanced_range = exec_script("$dsoftbus_root_path/check_sub_module.py",
[
"$native_source_path",
"$ble_enhanced_impl",
],
"value")
if (enhanced_range && defined(global_parts_info.msdp_algorithm)) {
sources += [ "$dsoftbus_root_path/dsoftbus_enhance/adapter/common/range/softbus_adapter_range.c" ]
external_deps += [ "algorithm:msdp_ble_range" ]
} else {
sources += [ "$softbus_adapter_common/range/softbus_adapter_range.c" ]
}
if (dsoftbus_feature_encrypt == 0) {
sources += [
"$softbus_adapter_common/mbedtls/softbus_adapter_crypto.c",
"$softbus_adapter_common/mbedtls/softbus_aes_encrypt_virtual.c",
]
public_deps += [ "//third_party/mbedtls" ]
} else if (dsoftbus_feature_encrypt == 1) {
sources += [
"$softbus_adapter_common/openssl/softbus_adapter_crypto.c",
"$softbus_adapter_common/openssl/softbus_aes_encrypt.c",
]
public_external_deps += [ "openssl:libcrypto_shared" ]
}
public_configs = [ ":config_adapter_common" ]
public_external_deps += [ "hitrace:libhitracechain" ]
if (is_standard_system) {
external_deps += [
"hilog:libhilog",
"hisysevent:libhisysevent",
"hitrace:libhitracechain",
"init:libbegetutil",
]
}
innerapi_tags = [ "platformsdk_indirect" ]
part_name = "dsoftbus"
subsystem_name = "communication"
}
}