# 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("../../dsoftbus.gni") import("../adapter/core_adapter.gni") import("../authentication/authentication.gni") import("../broadcast/broadcast.gni") import("../bus_center/bus_center_server.gni") import("../common/dfx/dsoftbus_dfx.gni") import("../common/security/permission/permission.gni") import("../connection/conn.gni") import("../discovery/disc.gni") import("../transmission/trans.gni") dsoftbus_root_path = "../.." dsoftbus_feature_product_config_path = "${dsoftbus_root_path}/adapter/default_config" softbus_adapter_config = "${dsoftbus_root_path}/adapter/default_config" dsoftbus_core_path = "${dsoftbus_root_path}/core" dsoftbus_server_common_src = auth_server_src + bus_center_server_src + conn_manager_src + disc_server_src + trans_session_src + softbus_permission_src + broadcast_src dsoftbus_server_common_inc = auth_server_inc + bus_center_server_inc + conn_manager_inc + disc_server_inc + trans_session_inc + softbus_permission_inc + broadcast_inc dsoftbus_server_common_deps = auth_server_deps + bus_center_server_deps + disc_server_deps + conn_manager_common_deps + trans_session_deps + softbus_permission_deps + broadcast_deps if (defined(ohos_lite)) { copy("permission_json") { sources = [ "$dsoftbus_core_path/common/security/permission/softbus_trans_permission.json" ] outputs = [ "$root_out_dir/etc/softbus_trans_permission.json" ] } if (ohos_kernel_type == "liteos_m") { static_library("softbus_server_frame") { defines += AUTH_SERVER_DEFINES defines += [ "__STDC_FORMAT_MACROS" ] include_dirs = dsoftbus_server_common_inc include_dirs += [ "$dsoftbus_root_path/core/frame/common/include", "$dsoftbus_root_path/interfaces/inner_kits/lnn", "$dsoftbus_root_path/interfaces/kits", "$dsoftbus_root_path/interfaces/kits/bus_center", "$dsoftbus_root_path/interfaces/kits/transport", "$dsoftbus_root_path/interfaces/kits/common", "$dsoftbus_root_path/core/common/dfx/hisysevent_adapter/include", "$dsoftbus_root_path/core/common/dfx/interface/include", "$softbus_adapter_config/spec_config", ] sources = dsoftbus_server_common_src sources += [ "common/src/softbus_server_frame.c", "mini/src/softbus_server_stub.c", ] if (board_toolchain_type != "iccarm") { cflags = [ "-Wall", "-fPIC", "-std=c99", ] cflags_cc = cflags } else { include_dirs += [ "//kernel/liteos_m/components/net/lwip-2.1/porting/include", "//third_party/lwip/src/include", ] cflags = [ "--diag_suppress", "Pe301", ] } deps = dsoftbus_server_common_deps deps += [ "$dsoftbus_root_path/adapter:softbus_adapter", "$dsoftbus_root_path/core/common:softbus_utils", "$dsoftbus_root_path/core/common/dfx/hidumper_adapter:softbus_dfx_dump", "$dsoftbus_root_path/core/connection/wifi_direct_cpp:wifi_direct", "//build/lite/config/component/cJSON:cjson_static", ] external_deps = [ "device_auth:deviceauth_sdk" ] external_deps += auth_server_ex_deps if (defined(global_parts_info) && defined(global_parts_info.hmoshiviewdfx_hiview_xcommradar_plugin)) { include_dirs += [ "$dsoftbus_root_path/../../../vendor/huawei/base/hiviewdfx/hiview_plugins/communication_radar_plugin/interfaces/inner_api/communication_radar" ] sources += [ "$dsoftbus_root_path/core/common/dfx/statistics/instant/instant_statistics.cpp" ] external_deps += [ "hiview_xcommradar_plugin:communication_radar_client" ] } else { sources += [ "$dsoftbus_root_path/core/common/dfx/statistics/instant/instant_statistics_virtual.cpp" ] } public_deps = [ "$dsoftbus_root_path/core/common/dfx/log:softbus_dfx_log" ] if (support_bluetooth && (dsoftbus_feature_conn_br || dsoftbus_feature_conn_ble)) { deps += [ "//foundation/communication/bluetooth/frameworks/inner:btframework", ] include_dirs += [ "//foundation/communication/bluetooth/interfaces/inner_api/include", "//foundation/communication/bluetooth/interfaces/inner_api/include/c_header", ] } } } else { shared_library("softbus_server_frame") { defines += AUTH_SERVER_DEFINES defines += [ "__STDC_FORMAT_MACROS" ] include_dirs = dsoftbus_server_common_inc include_dirs += [ "common/include", "small/init/include", "small/client_manager/include", "$softbus_adapter_common/include", "$softbus_adapter_config/spec_config", "$dsoftbus_root_path/interfaces/kits/transport", "$dsoftbus_root_path/core/common/dfx/hisysevent_adapter/include", "$dsoftbus_root_path/core/common/dfx/interface/include", "//commonlibrary/utils_lite/include", ] sources = dsoftbus_server_common_src sources += [ "common/src/softbus_server_frame.c", "small/client_manager/src/softbus_client_info_manager.c", "small/init/src/bus_center_server_stub.c", "small/init/src/disc_server_stub.c", "small/init/src/softbus_server_stub.c", "small/init/src/trans_server_stub.c", ] cflags = [ "-Wall", "-fPIC", "-fno-builtin", "-std=c99", ] cflags_cc = cflags deps = dsoftbus_server_common_deps deps += [ ":permission_json", "$dsoftbus_root_path/adapter:softbus_adapter", "$dsoftbus_root_path/core/common:softbus_utils", "$dsoftbus_root_path/core/common/dfx/hidumper_adapter:softbus_dfx_dump", "$dsoftbus_root_path/core/connection/wifi_direct_cpp:wifi_direct", "//build/lite/config/component/cJSON:cjson_shared", "//foundation/communication/ipc/interfaces/innerkits/c/ipc:ipc_single", "//foundation/systemabilitymgr/samgr_lite/samgr:samgr", ] external_deps = [ "bounds_checking_function:libsec_shared", "device_auth:deviceauth_sdk", ] external_deps += auth_server_ex_deps if (defined(global_parts_info) && defined(global_parts_info.hmoshiviewdfx_hiview_xcommradar_plugin)) { include_dirs += [ "$dsoftbus_root_path/../../../vendor/huawei/base/hiviewdfx/hiview_plugins/communication_radar_plugin/interfaces/inner_api/communication_radar" ] sources += [ "$dsoftbus_root_path/core/common/dfx/statistics/instant/instant_statistics.cpp" ] external_deps += [ "hiview_xcommradar_plugin:communication_radar_client" ] } else { sources += [ "$dsoftbus_root_path/core/common/dfx/statistics/instant/instant_statistics_virtual.cpp" ] } public_deps = [ "$dsoftbus_root_path/core/common/dfx/log:softbus_dfx_log" ] if (support_bluetooth && (dsoftbus_feature_conn_br || dsoftbus_feature_conn_ble)) { deps += [ "//foundation/communication/bluetooth/frameworks/inner:btframework", ] include_dirs += [ "//foundation/communication/bluetooth/interfaces/inner_api/include", "//foundation/communication/bluetooth/interfaces/inner_api/include/c_header", ] } } executable("softbus_server") { sources = [ "small/init/src/softbus_server_main.c" ] include_dirs = [ "common/include" ] deps = [ ":softbus_server_frame" ] cflags = [ "-fPIC" ] } } } else { ohos_prebuilt_etc("softbus_server.rc") { relative_install_dir = "init" if (use_musl) { source = "$dsoftbus_root_path/core/frame/$os_type/init/src/softbus_server_musl.cfg" } else { source = "$dsoftbus_root_path/core/frame/$os_type/init/src/softbus_server.cfg" } part_name = "dsoftbus" subsystem_name = "communication" } ohos_prebuilt_etc("softbus_permission_json") { source = "$dsoftbus_root_path/core/common/security/permission/softbus_trans_permission.json" install_enable = true relative_install_dir = "communication/softbus" part_name = "dsoftbus" subsystem_name = "communication" } ohos_shared_library("softbus_server") { sanitize = { cfi = true cfi_cross_dso = true debug = false } branch_protector_ret = "pac_ret" defines += AUTH_SERVER_DEFINES defines += [ "__STDC_FORMAT_MACROS" ] include_dirs = dsoftbus_server_common_inc include_dirs += [ "$dsoftbus_root_path/core/frame/common/include", "$dsoftbus_root_path/core/frame/$os_type/client_manager/include", "$dsoftbus_root_path/core/frame/$os_type/init/include", "$dsoftbus_root_path/interfaces/kits/common", "$dsoftbus_root_path/interfaces/kits/transport", "$dsoftbus_feature_product_config_path/spec_config", "$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", ] sources = dsoftbus_server_common_src sources += [ "$dsoftbus_root_path/sdk/frame/$os_type/src/if_softbus_client.cpp", "$os_type/client_manager/src/permission_status_change_cb.cpp", "$os_type/client_manager/src/softbus_client_info_manager.cpp", "$os_type/init/src/if_softbus_server.cpp", "$os_type/init/src/softbus_server.cpp", "$os_type/init/src/softbus_server_death_recipient.cpp", "$os_type/init/src/softbus_server_stub.cpp", "common/src/softbus_server_frame.c", ] deps = dsoftbus_server_common_deps deps += [ ":softbus_permission_json", ":softbus_server.rc", "$dsoftbus_root_path/adapter:softbus_adapter", "$dsoftbus_root_path/core/common:softbus_utils", "$dsoftbus_root_path/core/common/dfx/hidumper_adapter:softbus_dfx_dump", "$dsoftbus_root_path/core/connection/wifi_direct_cpp:wifi_direct", ] external_deps = [ "cJSON:cjson" ] external_deps += auth_server_ex_deps public_deps = [ "$dsoftbus_root_path/core/common/dfx/log:softbus_dfx_log" ] dsoftbus_server_common_external_deps = bus_center_server_external_deps + disc_server_external_deps + softbus_permission_external_deps + trans_session_external_deps + conn_manager_external_deps if (is_standard_system) { external_deps += dsoftbus_server_common_external_deps external_deps += [ "access_token:libaccesstoken_sdk", "access_token:libprivacy_sdk", "device_auth:deviceauth_sdk", "hilog:libhilog", "ipc:ipc_core", "kv_store:distributeddata_inner", "netmanager_base:net_conn_manager_if", "safwk:system_ability_fwk", "samgr:samgr_proxy", ] if (!defined(global_parts_info) || defined(global_parts_info.deviceprofile_device_info_manager)) { external_deps += [ "device_info_manager:distributed_device_profile_common", "device_info_manager:distributed_device_profile_sdk", ] } if (!defined(global_parts_info) || defined(global_parts_info.bundlemanager_bundle_framework)) { external_deps += [ "bundle_framework:appexecfwk_base", "bundle_framework:appexecfwk_core", ] cflags = [ "-DSUPPORT_BUNDLENAME" ] } if (!defined(global_parts_info) || defined(global_parts_info.ability_ability_runtime)) { cflags += [ "-DSUPPORT_ABILITY_RUNTIME" ] } if (enhanced) { cflags += [ "-DENHANCED_FLAG" ] external_deps += [ "device_certificate_manager:device_cert_mgr_sdk", "zlib:libz", ] } } if (defined(global_parts_info) && defined(global_parts_info.hmoshiviewdfx_hiview_xcommradar_plugin)) { include_dirs += [ "$dsoftbus_root_path/../../../vendor/huawei/base/hiviewdfx/hiview_plugins/communication_radar_plugin/interfaces/inner_api/communication_radar" ] sources += [ "$dsoftbus_root_path/core/common/dfx/statistics/instant/instant_statistics.cpp" ] external_deps += [ "hiview_xcommradar_plugin:communication_radar_client" ] } else { sources += [ "$dsoftbus_root_path/core/common/dfx/statistics/instant/instant_statistics_virtual.cpp" ] } part_name = "dsoftbus" subsystem_name = "communication" } }