1# Copyright (c) 2021-2024 Huawei Device Co., Ltd. 2# Licensed under the Apache License, Version 2.0 (the "License"); 3# you may not use this file except in compliance with the License. 4# You may obtain a copy of the License at 5# 6# http://www.apache.org/licenses/LICENSE-2.0 7# 8# Unless required by applicable law or agreed to in writing, software 9# distributed under the License is distributed on an "AS IS" BASIS, 10# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11# See the License for the specific language governing permissions and 12# limitations under the License. 13 14import("../../dsoftbus.gni") 15import("../adapter/core_adapter.gni") 16import("../authentication/authentication.gni") 17import("../broadcast/broadcast.gni") 18import("../bus_center/bus_center_server.gni") 19import("../common/dfx/dsoftbus_dfx.gni") 20import("../common/security/permission/permission.gni") 21import("../connection/conn.gni") 22import("../discovery/disc.gni") 23import("../transmission/trans.gni") 24 25dsoftbus_root_path = "../.." 26dsoftbus_feature_product_config_path = 27 "${dsoftbus_root_path}/adapter/default_config" 28softbus_adapter_config = "${dsoftbus_root_path}/adapter/default_config" 29dsoftbus_core_path = "${dsoftbus_root_path}/core" 30 31dsoftbus_server_common_src = 32 auth_server_src + bus_center_server_src + conn_manager_src + 33 disc_server_src + trans_session_src + softbus_permission_src + broadcast_src 34dsoftbus_server_common_inc = 35 auth_server_inc + bus_center_server_inc + conn_manager_inc + 36 disc_server_inc + trans_session_inc + softbus_permission_inc + broadcast_inc 37dsoftbus_server_common_deps = 38 auth_server_deps + bus_center_server_deps + disc_server_deps + 39 conn_manager_common_deps + trans_session_deps + softbus_permission_deps + 40 broadcast_deps 41 42if (defined(ohos_lite)) { 43 copy("permission_json") { 44 sources = [ "$dsoftbus_core_path/common/security/permission/softbus_trans_permission.json" ] 45 outputs = [ "$root_out_dir/etc/softbus_trans_permission.json" ] 46 } 47 if (ohos_kernel_type == "liteos_m") { 48 static_library("softbus_server_frame") { 49 defines += AUTH_SERVER_DEFINES 50 defines += DISC_SERVER_DEFINES 51 defines += [ "__STDC_FORMAT_MACROS" ] 52 include_dirs = dsoftbus_server_common_inc 53 include_dirs += [ 54 "$dsoftbus_root_path/core/frame/common/include", 55 "$dsoftbus_root_path/interfaces/inner_kits/lnn", 56 "$dsoftbus_root_path/interfaces/kits", 57 "$dsoftbus_root_path/interfaces/kits/bus_center", 58 "$dsoftbus_root_path/interfaces/kits/transport", 59 "$dsoftbus_root_path/interfaces/kits/common", 60 "$dsoftbus_root_path/core/common/dfx/hisysevent_adapter/include", 61 "$dsoftbus_root_path/core/common/dfx/interface/include", 62 "$softbus_adapter_config/spec_config", 63 ] 64 sources = dsoftbus_server_common_src 65 sources += [ 66 "common/src/softbus_server_frame.c", 67 "mini/src/softbus_server_stub.c", 68 ] 69 if (board_toolchain_type != "iccarm") { 70 cflags = [ 71 "-Wall", 72 "-fPIC", 73 "-std=c99", 74 ] 75 cflags_cc = cflags 76 } else { 77 include_dirs += [ 78 "//kernel/liteos_m/components/net/lwip-2.1/porting/include", 79 "//third_party/lwip/src/include", 80 ] 81 cflags = [ 82 "--diag_suppress", 83 "Pe301", 84 ] 85 } 86 deps = dsoftbus_server_common_deps 87 deps += [ 88 "$dsoftbus_root_path/adapter:softbus_adapter", 89 "$dsoftbus_root_path/core/common:softbus_utils", 90 "$dsoftbus_root_path/core/common/dfx/hidumper_adapter:softbus_dfx_dump", 91 "$dsoftbus_root_path/core/connection/wifi_direct_cpp:wifi_direct", 92 "//build/lite/config/component/cJSON:cjson_static", 93 ] 94 public_deps = 95 [ "$dsoftbus_root_path/core/common/dfx/log:softbus_dfx_log" ] 96 external_deps = [ "device_auth:deviceauth_sdk" ] 97 external_deps += auth_server_ex_deps 98 if (defined(global_parts_info) && 99 defined(global_parts_info.hmoshiviewdfx_hiview_xcommradar_plugin)) { 100 include_dirs += [ 101 "$dsoftbus_root_path/../../../vendor/huawei/base/hiviewdfx/hiview_plugins/communication_radar_plugin/interfaces/inner_api/communication_radar", 102 "$dsoftbus_root_path/core/common/dfx/statistics/include", 103 ] 104 sources += [ 105 "$dsoftbus_root_path/core/common/dfx/statistics/instant/bt_statistic.cpp", 106 "$dsoftbus_root_path/core/common/dfx/statistics/instant/instant_statistics.cpp", 107 "$dsoftbus_root_path/core/common/dfx/statistics/instant/wifi_statistic.cpp", 108 ] 109 external_deps += 110 [ "hiview_xcommradar_plugin:communication_radar_client" ] 111 } else { 112 sources += [ "$dsoftbus_root_path/core/common/dfx/statistics/instant/instant_statistics_virtual.cpp" ] 113 } 114 if (support_bluetooth && 115 (dsoftbus_feature_conn_br || dsoftbus_feature_conn_ble)) { 116 deps += [ 117 "//foundation/communication/bluetooth/frameworks/inner:btframework", 118 ] 119 include_dirs += [ 120 "//foundation/communication/bluetooth/interfaces/inner_api/include", 121 "//foundation/communication/bluetooth/interfaces/inner_api/include/c_header", 122 ] 123 } 124 } 125 } else { 126 shared_library("softbus_server_frame") { 127 defines += AUTH_SERVER_DEFINES 128 defines += DISC_SERVER_DEFINES 129 defines += [ "__STDC_FORMAT_MACROS" ] 130 include_dirs = dsoftbus_server_common_inc 131 include_dirs += [ 132 "common/include", 133 "small/init/include", 134 "small/client_manager/include", 135 "$softbus_adapter_common/include", 136 "$softbus_adapter_config/spec_config", 137 "$dsoftbus_root_path/interfaces/kits/transport", 138 "$dsoftbus_root_path/core/common/dfx/hisysevent_adapter/include", 139 "$dsoftbus_root_path/core/common/dfx/interface/include", 140 "//commonlibrary/utils_lite/include", 141 ] 142 sources = dsoftbus_server_common_src 143 sources += [ 144 "common/src/softbus_server_frame.c", 145 "small/client_manager/src/softbus_client_info_manager.c", 146 "small/init/src/bus_center_server_stub.c", 147 "small/init/src/softbus_server_stub.c", 148 "small/init/src/trans_server_stub.c", 149 ] 150 151 cflags = [ 152 "-Wall", 153 "-fPIC", 154 "-fno-builtin", 155 "-std=c99", 156 ] 157 cflags_cc = cflags 158 deps = dsoftbus_server_common_deps 159 deps += [ 160 ":permission_json", 161 "$dsoftbus_root_path/adapter:softbus_adapter", 162 "$dsoftbus_root_path/core/common:softbus_utils", 163 "$dsoftbus_root_path/core/common/dfx/hidumper_adapter:softbus_dfx_dump", 164 "$dsoftbus_root_path/core/connection/wifi_direct_cpp:wifi_direct", 165 "//build/lite/config/component/cJSON:cjson_shared", 166 "//foundation/communication/ipc/interfaces/innerkits/c/ipc:ipc_single", 167 "//foundation/systemabilitymgr/samgr_lite/samgr:samgr", 168 ] 169 external_deps = [ 170 "bounds_checking_function:libsec_shared", 171 "device_auth:deviceauth_sdk", 172 ] 173 external_deps += auth_server_ex_deps 174 if (defined(global_parts_info) && 175 defined(global_parts_info.hmoshiviewdfx_hiview_xcommradar_plugin)) { 176 include_dirs += [ 177 "$dsoftbus_root_path/../../../vendor/huawei/base/hiviewdfx/hiview_plugins/communication_radar_plugin/interfaces/inner_api/communication_radar", 178 "$dsoftbus_root_path/core/common/dfx/statistics/include", 179 ] 180 sources += [ 181 "$dsoftbus_root_path/core/common/dfx/statistics/instant/bt_statistic.cpp", 182 "$dsoftbus_root_path/core/common/dfx/statistics/instant/instant_statistics.cpp", 183 "$dsoftbus_root_path/core/common/dfx/statistics/instant/wifi_statistic.cpp", 184 ] 185 external_deps += 186 [ "hiview_xcommradar_plugin:communication_radar_client" ] 187 } else { 188 sources += [ "$dsoftbus_root_path/core/common/dfx/statistics/instant/instant_statistics_virtual.cpp" ] 189 } 190 public_deps = 191 [ "$dsoftbus_root_path/core/common/dfx/log:softbus_dfx_log" ] 192 if (support_bluetooth && 193 (dsoftbus_feature_conn_br || dsoftbus_feature_conn_ble)) { 194 deps += [ 195 "//foundation/communication/bluetooth/frameworks/inner:btframework", 196 ] 197 include_dirs += [ 198 "//foundation/communication/bluetooth/interfaces/inner_api/include", 199 "//foundation/communication/bluetooth/interfaces/inner_api/include/c_header", 200 ] 201 } 202 } 203 executable("softbus_server") { 204 sources = [ "small/init/src/softbus_server_main.c" ] 205 include_dirs = [ "common/include" ] 206 deps = [ ":softbus_server_frame" ] 207 cflags = [ "-fPIC" ] 208 } 209 } 210} else { 211 ohos_prebuilt_etc("softbus_server.rc") { 212 relative_install_dir = "init" 213 if (use_musl) { 214 source = "$dsoftbus_root_path/core/frame/$os_type/init/src/softbus_server_musl.cfg" 215 } else { 216 source = 217 "$dsoftbus_root_path/core/frame/$os_type/init/src/softbus_server.cfg" 218 } 219 220 part_name = "dsoftbus" 221 subsystem_name = "communication" 222 } 223 ohos_prebuilt_etc("softbus_permission_json") { 224 source = "$dsoftbus_root_path/core/common/security/permission/softbus_trans_permission.json" 225 install_enable = true 226 relative_install_dir = "communication/softbus" 227 part_name = "dsoftbus" 228 subsystem_name = "communication" 229 } 230 ohos_shared_library("softbus_server") { 231 sanitize = { 232 cfi = true 233 cfi_cross_dso = true 234 debug = false 235 } 236 branch_protector_ret = "pac_ret" 237 238 defines += AUTH_SERVER_DEFINES 239 defines += DISC_SERVER_DEFINES 240 defines += [ "__STDC_FORMAT_MACROS" ] 241 include_dirs = dsoftbus_server_common_inc 242 include_dirs += [ 243 "$dsoftbus_root_path/core/frame/common/include", 244 "$dsoftbus_root_path/core/frame/$os_type/client_manager/include", 245 "$dsoftbus_root_path/core/frame/$os_type/init/include", 246 "$dsoftbus_root_path/interfaces/kits/common", 247 "$dsoftbus_root_path/interfaces/kits/transport", 248 "$dsoftbus_feature_product_config_path/spec_config", 249 "$dsoftbus_root_path/core/common/include", 250 "$dsoftbus_root_path/core/common/dfx/hidumper_adapter/include", 251 "$dsoftbus_root_path/core/common/dfx/hisysevent_adapter/include", 252 "$dsoftbus_root_path/core/common/dfx/interface/include", 253 ] 254 sources = dsoftbus_server_common_src 255 sources += [ 256 "$dsoftbus_root_path/sdk/frame/$os_type/src/if_softbus_client.cpp", 257 "$os_type/client_manager/src/permission_status_change_cb.cpp", 258 "$os_type/client_manager/src/softbus_client_info_manager.cpp", 259 "$os_type/init/src/if_softbus_server.cpp", 260 "$os_type/init/src/softbus_server.cpp", 261 "$os_type/init/src/softbus_server_death_recipient.cpp", 262 "$os_type/init/src/softbus_server_stub.cpp", 263 "common/src/softbus_server_frame.c", 264 ] 265 deps = dsoftbus_server_common_deps 266 deps += [ 267 ":softbus_permission_json", 268 ":softbus_server.rc", 269 "$dsoftbus_root_path/adapter:softbus_adapter", 270 "$dsoftbus_root_path/core/common:softbus_utils", 271 "$dsoftbus_root_path/core/common/dfx/hidumper_adapter:softbus_dfx_dump", 272 "$dsoftbus_root_path/core/connection/wifi_direct_cpp:wifi_direct", 273 "$dsoftbus_root_path/sdk:softbus_client", 274 ] 275 external_deps = [ "cJSON:cjson" ] 276 external_deps += auth_server_ex_deps 277 public_deps = [ "$dsoftbus_root_path/core/common/dfx/log:softbus_dfx_log" ] 278 dsoftbus_server_common_external_deps = 279 bus_center_server_external_deps + disc_server_external_deps + 280 softbus_permission_external_deps + trans_session_external_deps + 281 conn_manager_external_deps 282 if (is_standard_system) { 283 external_deps += dsoftbus_server_common_external_deps 284 external_deps += [ 285 "access_token:libaccesstoken_sdk", 286 "access_token:libprivacy_sdk", 287 "access_token:libtokenid_sdk", 288 "device_auth:deviceauth_sdk", 289 "hilog:libhilog", 290 "ipc:ipc_core", 291 "safwk:system_ability_fwk", 292 "samgr:samgr_proxy", 293 ] 294 if (!defined(global_parts_info) || 295 defined(global_parts_info.deviceprofile_device_info_manager)) { 296 external_deps += [ 297 "device_info_manager:distributed_device_profile_common", 298 "device_info_manager:distributed_device_profile_sdk", 299 ] 300 } 301 if (!defined(global_parts_info) || 302 defined(global_parts_info.communication_netmanager_base)) { 303 external_deps += [ "netmanager_base:net_policy_manager_if" ] 304 } 305 if (!defined(global_parts_info) || 306 defined(global_parts_info.bundlemanager_bundle_framework)) { 307 external_deps += [ 308 "bundle_framework:appexecfwk_base", 309 "bundle_framework:appexecfwk_core", 310 ] 311 cflags = [ "-DSUPPORT_BUNDLENAME" ] 312 } 313 if (!defined(global_parts_info) || 314 defined(global_parts_info.ability_ability_runtime)) { 315 cflags += [ 316 "-DSUPPORT_ABILITY_RUNTIME", 317 "-DENHANCED_FLAG", 318 ] 319 } 320 } 321 if (defined(global_parts_info) && 322 defined(global_parts_info.hmoshiviewdfx_hiview_xcommradar_plugin)) { 323 include_dirs += [ 324 "$dsoftbus_root_path/../../../vendor/huawei/base/hiviewdfx/hiview_plugins/communication_radar_plugin/interfaces/inner_api/communication_radar", 325 "$dsoftbus_root_path/core/common/dfx/statistics/include", 326 ] 327 sources += [ 328 "$dsoftbus_root_path/core/common/dfx/statistics/instant/bt_statistic.cpp", 329 "$dsoftbus_root_path/core/common/dfx/statistics/instant/instant_statistics.cpp", 330 "$dsoftbus_root_path/core/common/dfx/statistics/instant/wifi_statistic.cpp", 331 ] 332 external_deps += [ "hiview_xcommradar_plugin:communication_radar_client" ] 333 } else { 334 sources += [ "$dsoftbus_root_path/core/common/dfx/statistics/instant/instant_statistics_virtual.cpp" ] 335 } 336 part_name = "dsoftbus" 337 subsystem_name = "communication" 338 } 339} 340