# 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("../dsoftbus.gni") 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", ] if (board_name == "v200zr") { defines = [ "DSOFTBUS_V200ZR" ] } } common_include = [ "$dsoftbus_root_path/interfaces/kits", "$dsoftbus_root_path/interfaces/kits/common", "//base/startup/init/interfaces/innerkits/include/syspara", "//third_party/bounds_checking_function/include", "//third_party/json/include", ] if (ohos_kernel_type == "liteos_m") { static_library("softbus_adapter") { include_dirs = common_include include_dirs += [ "//kernel/liteos_m/kal/cmsis" ] 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/log/softbus_adapter_log.c", "$softbus_adapter_common/range/softbus_adapter_range.c", "$softbus_adapter_config/spec_config/softbus_config_adapter.c", ] if (board_name == "v200zr") { sources = [] 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_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/log/softbus_adapter_log.c", "$softbus_adapter_common/range/softbus_adapter_range.c", "$softbus_adapter_config/spec_config/softbus_config_adapter.c", ] } deps = [ "$hilog_lite_deps_path" ] if (dsoftbus_feature_encrypt == 0) { sources += [ "$softbus_adapter_common/mbedtls/softbus_adapter_crypto.c" ] deps += [ "//third_party/mbedtls" ] } else if (dsoftbus_feature_encrypt == 1) { sources += [ "$softbus_adapter_common/openssl/softbus_adapter_crypto.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/log/softbus_adapter_log.c", "$softbus_adapter_common/perf/softbus_adapter_perf.c", "$softbus_adapter_common/range/softbus_adapter_range.c", "$softbus_adapter_config/spec_config/softbus_config_adapter.c", ] deps = [ "$hilog_lite_deps_path", "//base/startup/init/interfaces/innerkits:libbegetutil", "//third_party/bounds_checking_function:libsec_shared", ] if (dsoftbus_feature_encrypt == 0) { sources += [ "$softbus_adapter_common/mbedtls/softbus_adapter_crypto.c" ] deps += [ "//third_party/mbedtls" ] } else if (dsoftbus_feature_encrypt == 1) { sources += [ "$softbus_adapter_common/openssl/softbus_adapter_crypto.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/include", "//base/hiviewdfx/hitrace/interfaces/native/innerkits/include", ] } ohos_shared_library("softbus_adapter") { include_dirs = [ "$dsoftbus_root_path/interfaces/kits", "$dsoftbus_root_path/interfaces/kits/common", "//commonlibrary/c_utils/base/include", "//third_party/bounds_checking_function/include", "//third_party/json/include", ] sources = [ "$dsoftbus_feature_product_config_path/spec_config/softbus_config_adapter.c", "$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/log/softbus_adapter_log.c", "$softbus_adapter_common/perf/softbus_adapter_perf.c", ] public_deps = [ "//third_party/bounds_checking_function:libsec_shared" ] native_source_path = rebase_path("$dsoftbus_root_path") 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) { include_dirs += [ "$dsoftbus_root_path/dsoftbus_enhance/adapter/common/mlps/include", "$dsoftbus_root_path/dsoftbus_enhance/core/bus_center/lnn/lane_hub/mlps/include", "$dsoftbus_root_path/dsoftbus_enhance/core/bus_center/lnn/lane_hub/mlps/interface", ] sources += [ "$dsoftbus_root_path/dsoftbus_enhance/adapter/common/mlps/src/softbus_adapter_mlps.cpp", "$dsoftbus_root_path/dsoftbus_enhance/core/bus_center/lnn/lane_hub/mlps/src/mlps.cpp", ] } external_deps = [] if (enhanced_range && defined(global_parts_info.msdp_algorithm)) { include_dirs += [ "//base/msdp/algorithm/ble_range/include" ] 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" ] public_deps += [ "//third_party/mbedtls" ] } else if (dsoftbus_feature_encrypt == 1) { sources += [ "$softbus_adapter_common/openssl/softbus_adapter_crypto.c" ] public_deps += [ "//third_party/openssl:libcrypto_shared" ] } public_configs = [ ":config_adapter_common" ] if (is_standard_system) { external_deps += [ "hilog:libhilog", "hisysevent:libhisysevent", "hitrace:libhitracechain", "init:libbegetutil", ] } innerapi_tags = [ "platformsdk_indirect" ] part_name = "dsoftbus" subsystem_name = "communication" } }