1# Copyright (c) 2021 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("../bus_center/bus_center_server.gni") 18import("../common/security/permission/permission.gni") 19import("../connection/conn.gni") 20import("../discovery/disc.gni") 21import("../transmission/trans.gni") 22 23dsoftbus_server_common_src = 24 auth_server_src + bus_center_server_src + conn_manager_src + 25 disc_server_src + trans_session_src + softbus_permission_src 26dsoftbus_server_common_inc = 27 auth_server_inc + bus_center_server_inc + conn_manager_inc + 28 disc_server_inc + trans_session_inc + softbus_permission_inc 29dsoftbus_server_common_deps = 30 auth_server_deps + bus_center_server_deps + disc_server_deps + 31 trans_session_deps + softbus_permission_deps 32 33if (defined(ohos_lite)) { 34 copy("permission_json") { 35 sources = [ "$dsoftbus_core_path/common/security/permission/softbus_trans_permission.json" ] 36 outputs = [ "$root_out_dir/etc/softbus_trans_permission.json" ] 37 } 38 if (ohos_kernel_type == "liteos_m") { 39 static_library("softbus_server_frame") { 40 defines = AUTH_SERVER_DEFINES 41 defines += [ "__STDC_FORMAT_MACROS" ] 42 include_dirs = dsoftbus_server_common_inc 43 include_dirs += [ 44 "$dsoftbus_root_path/core/frame/common/include", 45 "$dsoftbus_root_path/interfaces/kits", 46 "$dsoftbus_root_path/interfaces/kits/bus_center", 47 "$dsoftbus_root_path/interfaces/kits/transport", 48 "$dsoftbus_root_path/interfaces/kits/common", 49 "$dsoftbus_root_path/core/common/dfx/hidumper_adapter/include", 50 "$dsoftbus_root_path/core/common/dfx/hisysevent_adapter/include", 51 "$softbus_adapter_config/spec_config", 52 "//base/security/device_auth/interfaces/inner_api", 53 ] 54 sources = dsoftbus_server_common_src 55 sources += [ 56 "common/src/softbus_server_frame.c", 57 "mini/src/softbus_server_stub.c", 58 ] 59 if (board_toolchain_type != "iccarm") { 60 cflags = [ 61 "-Wall", 62 "-fPIC", 63 "-std=c99", 64 ] 65 cflags_cc = cflags 66 } else { 67 include_dirs += [ 68 "//kernel/liteos_m/components/net/lwip-2.1/porting/include", 69 "//third_party/lwip/src/include", 70 ] 71 cflags = [ 72 "--diag_suppress", 73 "Pe301", 74 ] 75 } 76 deps = dsoftbus_server_common_deps 77 deps += [ 78 "$dsoftbus_root_path/adapter:softbus_adapter", 79 "$dsoftbus_root_path/core/common:softbus_utils", 80 "//build/lite/config/component/cJSON:cjson_static", 81 ] 82 if (support_bluetooth && 83 (dsoftbus_feature_conn_br || dsoftbus_feature_conn_ble)) { 84 deps += [ 85 "//foundation/communication/bluetooth/frameworks/inner:btframework", 86 ] 87 include_dirs += [ 88 "//foundation/communication/bluetooth/interfaces/inner_api/include", 89 "//foundation/communication/bluetooth/interfaces/inner_api/include/c_header", 90 ] 91 } 92 } 93 } else { 94 shared_library("softbus_server_frame") { 95 defines = AUTH_SERVER_DEFINES 96 defines += [ "__STDC_FORMAT_MACROS" ] 97 include_dirs = dsoftbus_server_common_inc 98 include_dirs += [ 99 "common/include", 100 "small/init/include", 101 "small/client_manager/include", 102 "$softbus_adapter_common/include", 103 "$softbus_adapter_config/spec_config", 104 "$dsoftbus_root_path/interfaces/kits/transport", 105 "$dsoftbus_root_path/core/common/dfx/hidumper_adapter/include", 106 "$dsoftbus_root_path/core/common/dfx/hisysevent_adapter/include", 107 "//base/security/device_auth/interfaces/inner_api", 108 "//commonlibrary/utils_lite/include", 109 "//third_party/bounds_checking_function/include", 110 ] 111 sources = dsoftbus_server_common_src 112 sources += [ 113 "common/src/softbus_server_frame.c", 114 "small/client_manager/src/softbus_client_info_manager.c", 115 "small/init/src/bus_center_server_stub.c", 116 "small/init/src/disc_server_stub.c", 117 "small/init/src/softbus_server_stub.c", 118 "small/init/src/trans_server_stub.c", 119 ] 120 121 cflags = [ 122 "-Wall", 123 "-fPIC", 124 "-fno-builtin", 125 "-std=c99", 126 ] 127 cflags_cc = cflags 128 deps = dsoftbus_server_common_deps 129 deps += [ 130 ":permission_json", 131 "$dsoftbus_root_path/adapter:softbus_adapter", 132 "$dsoftbus_root_path/core/common:softbus_utils", 133 "//build/lite/config/component/cJSON:cjson_shared", 134 "//foundation/communication/ipc/interfaces/innerkits/c/ipc:ipc_single", 135 "//foundation/systemabilitymgr/samgr_lite/samgr:samgr", 136 ] 137 if (support_bluetooth && 138 (dsoftbus_feature_conn_br || dsoftbus_feature_conn_ble)) { 139 deps += [ 140 "//foundation/communication/bluetooth/frameworks/inner:btframework", 141 ] 142 include_dirs += [ 143 "//foundation/communication/bluetooth/interfaces/inner_api/include", 144 "//foundation/communication/bluetooth/interfaces/inner_api/include/c_header", 145 ] 146 } 147 } 148 executable("softbus_server") { 149 sources = [ "small/init/src/softbus_server_main.c" ] 150 include_dirs = [ "common/include" ] 151 deps = [ ":softbus_server_frame" ] 152 cflags = [ "-fPIC" ] 153 } 154 } 155} else { 156 ohos_prebuilt_etc("softbus_server.rc") { 157 relative_install_dir = "init" 158 if (use_musl) { 159 source = "$dsoftbus_root_path/core/frame/$os_type/init/src/softbus_server_musl.cfg" 160 } else { 161 source = 162 "$dsoftbus_root_path/core/frame/$os_type/init/src/softbus_server.cfg" 163 } 164 165 part_name = "dsoftbus" 166 subsystem_name = "communication" 167 } 168 ohos_prebuilt_etc("softbus_permission_json") { 169 source = "$dsoftbus_root_path/core/common/security/permission/softbus_trans_permission.json" 170 install_enable = true 171 relative_install_dir = "communication/softbus" 172 part_name = "dsoftbus" 173 } 174 ohos_shared_library("softbus_server") { 175 defines = AUTH_SERVER_DEFINES 176 defines += [ "__STDC_FORMAT_MACROS" ] 177 include_dirs = dsoftbus_server_common_inc 178 include_dirs += [ 179 "$dsoftbus_root_path/core/frame/common/include", 180 "$dsoftbus_root_path/core/frame/$os_type/client_manager/include", 181 "$dsoftbus_root_path/core/frame/$os_type/init/include", 182 "$dsoftbus_root_path/interfaces/kits/common", 183 "$dsoftbus_root_path/interfaces/kits/transport", 184 "$dsoftbus_feature_product_config_path/spec_config", 185 "$dsoftbus_root_path/core/common/include", 186 "$dsoftbus_root_path/core/common/dfx/hidumper_adapter/include", 187 "$dsoftbus_root_path/core/common/dfx/hisysevent_adapter/include", 188 "//base/security/access_token/interfaces/innerkits/privacy/include", 189 "//foundation/bundlemanager/bundle_framework/interfaces/inner_api/appexecfwk_core/include/bundlemgr", 190 "//foundation/bundlemanager/bundle_framework/interfaces/inner_api/appexecfwk_base/include", 191 "//base/notification/common_event_service/interfaces/inner_api", 192 "//foundation/ability/ability_base/interfaces/kits/native/want/include", 193 "//foundation/ability/ability_base/interfaces/kits/native/uri/include", 194 "//foundation/ability/ability_base/interfaces/inner_api/base/include", 195 ] 196 sources = dsoftbus_server_common_src 197 sources += [ 198 "$dsoftbus_root_path/sdk/frame/$os_type/src/if_softbus_client.cpp", 199 "$os_type/client_manager/src/permission_status_change_cb.cpp", 200 "$os_type/client_manager/src/softbus_client_info_manager.cpp", 201 "$os_type/init/src/if_softbus_server.cpp", 202 "$os_type/init/src/softbus_server.cpp", 203 "$os_type/init/src/softbus_server_death_recipient.cpp", 204 "$os_type/init/src/softbus_server_stub.cpp", 205 "common/src/softbus_server_frame.c", 206 ] 207 deps = dsoftbus_server_common_deps 208 deps += [ 209 ":softbus_permission_json", 210 ":softbus_server.rc", 211 "$dsoftbus_root_path/adapter:softbus_adapter", 212 "$dsoftbus_root_path/core/common:softbus_utils", 213 "//third_party/cJSON:cjson", 214 ] 215 dsoftbus_server_common_external_deps = 216 bus_center_server_external_deps + disc_server_external_deps + 217 softbus_permission_external_deps + trans_session_external_deps + 218 conn_manager_external_deps 219 if (is_standard_system) { 220 external_deps = dsoftbus_server_common_external_deps 221 external_deps += [ 222 "access_token:libaccesstoken_sdk", 223 "access_token:libprivacy_sdk", 224 "device_auth:deviceauth_sdk", 225 "hilog:libhilog", 226 "ipc:ipc_core", 227 "safwk:system_ability_fwk", 228 "samgr:samgr_proxy", 229 ] 230 if (!defined(global_parts_info) || 231 defined(global_parts_info.bundlemanager_bundle_framework)) { 232 external_deps += [ "bundle_framework:appexecfwk_core" ] 233 cflags = [ "-DSUPPORT_BUNDLENAME" ] 234 } 235 } 236 237 part_name = "dsoftbus" 238 subsystem_name = "communication" 239 } 240} 241