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") 15 16dsoftbus_root_path = ".." 17softbus_adapter_common = "${dsoftbus_root_path}/adapter/common" 18dsoftbus_feature_product_config_path = 19 "${dsoftbus_root_path}/adapter/default_config" 20softbus_adapter_config = "${dsoftbus_root_path}/adapter/default_config" 21if (defined(ohos_lite)) { 22 import("//build/lite/config/component/lite_component.gni") 23 config("dsoftbus_adapter_common_interface") { 24 include_dirs = [ 25 "$dsoftbus_root_path/core/common/include", 26 "$hilog_lite_include_path", 27 "$softbus_adapter_common/include", 28 "$softbus_adapter_common/include/OS_adapter_define/linux", 29 "$softbus_adapter_common/security/access_token/include", 30 "$softbus_adapter_config/spec_config", 31 "$utils_lite_include_path", 32 ] 33 if (board_name == "v200zr") { 34 defines += [ "DSOFTBUS_V200ZR" ] 35 } 36 } 37 38 common_include = [ 39 "$dsoftbus_dfx_path/interface/include", 40 "$dsoftbus_root_path/interfaces/kits", 41 "$dsoftbus_root_path/adapter/common/net/bluetooth/broadcast/adapter/include", 42 "$dsoftbus_root_path/interfaces/kits/common", 43 "$softbus_adapter_common/security/access_token/include", 44 ] 45 46 if (ohos_kernel_type == "liteos_m") { 47 static_library("softbus_adapter") { 48 include_dirs = common_include 49 include_dirs += [ 50 "//kernel/liteos_m/kal/cmsis", 51 "$dsoftbus_root_path/interfaces/inner_kits/lnn", 52 ] 53 external_deps = [ 54 "bounds_checking_function:libsec_static", 55 "init:libbegetutil", 56 ] 57 public_external_deps = [ "json:nlohmann_json_static" ] 58 if (board_name == "hispark_pegasus") { 59 include_dirs += 60 [ "$hispark_pegasus_sdk_path/third_party/lwip_sack/include" ] 61 defines += [ "HISPARK_PEGASUS_USE_NETIF_GET_ADDR" ] 62 } 63 if (board_toolchain_type == "iccarm") { 64 include_dirs += [ 65 "//kernel/liteos_m/components/net/lwip-2.1/porting/include", 66 "//third_party/lwip/src/include", 67 ] 68 cflags = [ 69 "--diag_suppress", 70 "Pe226,Pe513", 71 ] 72 ldflags = [ "-lpthread" ] 73 } else { 74 cflags = [ "-Wall" ] 75 } 76 sources = [ 77 "$dsoftbus_dfx_path/event/legacy/softbus_adapter_hisysevent_mini.c", 78 "$dsoftbus_dfx_path/trace/legacy/softbus_adapter_hitrace_virtual.c", 79 "$softbus_adapter_common/kernel/liteos_m/lnn_ip_utils_adapter.c", 80 "$softbus_adapter_common/kernel/liteos_m/softbus_adapter_file.c", 81 "$softbus_adapter_common/kernel/liteos_m/softbus_adapter_mem.c", 82 "$softbus_adapter_common/kernel/liteos_m/softbus_adapter_timer.c", 83 "$softbus_adapter_common/kernel/posix/softbus_adapter_socket.c", 84 "$softbus_adapter_common/kernel/posix/softbus_adapter_thread.c", 85 "$softbus_adapter_common/range/softbus_adapter_range.c", 86 ] 87 88 if (dsoftbus_access_token_feature) { 89 sources += [ "$softbus_adapter_common/security/access_token/common/softbus_access_token_adapter.cpp" ] 90 external_deps += [ 91 "access_token:libaccesstoken_sdk", 92 "access_token:libprivacy_sdk", 93 "access_token:libtokenid_sdk", 94 ] 95 if (dsoftbus_ipc_feature) { 96 external_deps += [ "ipc:ipc_single" ] 97 } 98 } else { 99 sources += [ "$softbus_adapter_common/security/access_token/common/softbus_access_token_adapter_virtual.c" ] 100 } 101 102 sources += [ "$softbus_adapter_config/spec_config/softbus_config_adapter.c" ] 103 104 if (board_name == "v200zr") { 105 external_deps += [ "json:nlohmann_json_static" ] 106 sources = [] 107 sources = [ 108 "$dsoftbus_dfx_path/event/legacy/softbus_adapter_hisysevent_mini.c", 109 "$dsoftbus_dfx_path/trace/legacy/softbus_adapter_hitrace_virtual.c", 110 "$softbus_adapter_common/json/nlohmann/softbus_adapter_json.cpp", 111 "$softbus_adapter_common/kernel/liteos_m/lnn_ip_utils_adapter.c", 112 "$softbus_adapter_common/kernel/liteos_m/softbus_adapter_mem.c", 113 "$softbus_adapter_common/kernel/liteos_m/softbus_adapter_timer.c", 114 "$softbus_adapter_common/kernel/posix/softbus_adapter_file.c", 115 "$softbus_adapter_common/kernel/posix/softbus_adapter_socket.c", 116 "$softbus_adapter_common/kernel/posix/softbus_adapter_thread.c", 117 "$softbus_adapter_common/perf/softbus_adapter_perf.c", 118 "$softbus_adapter_common/range/softbus_adapter_range.c", 119 ] 120 121 sources += [ "$softbus_adapter_config/spec_config/softbus_config_adapter.c" ] 122 } 123 124 deps = [ 125 "$dsoftbus_dfx_path:softbus_dfx", 126 "$hilog_lite_deps_path", 127 ] 128 129 if (dsoftbus_feature_encrypt == 0) { 130 sources += [ 131 "$softbus_adapter_common/mbedtls/softbus_adapter_crypto.c", 132 "$softbus_adapter_common/mbedtls/softbus_aes_encrypt_virtual.c", 133 ] 134 deps += [ "//third_party/mbedtls" ] 135 } else if (dsoftbus_feature_encrypt == 1) { 136 sources += [ 137 "$softbus_adapter_common/openssl/softbus_adapter_crypto.c", 138 "$softbus_adapter_common/openssl/softbus_aes_encrypt.c", 139 ] 140 deps += [ "//third_party/openssl:libcrypto_shared" ] 141 } 142 public_configs = [ ":dsoftbus_adapter_common_interface" ] 143 } 144 } else { 145 shared_library("softbus_adapter") { 146 include_dirs = common_include 147 include_dirs += [ "$dsoftbus_root_path/interfaces/inner_kits/lnn" ] 148 cflags = [ 149 "-Wall", 150 "-Werror", 151 "-fPIC", 152 "-fno-builtin", 153 "-std=c99", 154 ] 155 cflags_cc = [ "-fPIC" ] 156 sources = [ 157 "$dsoftbus_dfx_path/event/legacy/softbus_adapter_hisysevent_mini.c", 158 "$dsoftbus_dfx_path/trace/legacy/softbus_adapter_hitrace_virtual.c", 159 "$softbus_adapter_common/json/nlohmann/softbus_adapter_json.cpp", 160 "$softbus_adapter_common/kernel/posix/lnn_ip_utils_adapter.c", 161 "$softbus_adapter_common/kernel/posix/softbus_adapter_file.c", 162 "$softbus_adapter_common/kernel/posix/softbus_adapter_mem.c", 163 "$softbus_adapter_common/kernel/posix/softbus_adapter_socket.c", 164 "$softbus_adapter_common/kernel/posix/softbus_adapter_thread.c", 165 "$softbus_adapter_common/kernel/posix/softbus_adapter_timer.c", 166 "$softbus_adapter_common/perf/softbus_adapter_perf.c", 167 "$softbus_adapter_common/range/softbus_adapter_range.c", 168 ] 169 170 if (dsoftbus_access_token_feature) { 171 sources += [ "$softbus_adapter_common/security/access_token/common/softbus_access_token_adapter.cpp" ] 172 external_deps += [ 173 "access_token:libaccesstoken_sdk", 174 "access_token:libprivacy_sdk", 175 "access_token:libtokenid_sdk", 176 ] 177 if (dsoftbus_ipc_feature) { 178 external_deps += [ "ipc:ipc_single" ] 179 } 180 } else { 181 sources += [ "$softbus_adapter_common/security/access_token/common/softbus_access_token_adapter_virtual.c" ] 182 } 183 184 sources += [ "$softbus_adapter_config/spec_config/softbus_config_adapter.c" ] 185 186 deps = [ 187 "$dsoftbus_dfx_path:softbus_dfx", 188 "$hilog_lite_deps_path", 189 ] 190 external_deps = [ 191 "bounds_checking_function:libsec_shared", 192 "init:libbegetutil", 193 ] 194 public_external_deps = [ "json:nlohmann_json_static" ] 195 196 if (dsoftbus_feature_encrypt == 0) { 197 sources += [ 198 "$softbus_adapter_common/mbedtls/softbus_adapter_crypto.c", 199 "$softbus_adapter_common/mbedtls/softbus_aes_encrypt_virtual.c", 200 ] 201 deps += [ "//third_party/mbedtls" ] 202 } else if (dsoftbus_feature_encrypt == 1) { 203 sources += [ 204 "$softbus_adapter_common/openssl/softbus_adapter_crypto.c", 205 "$softbus_adapter_common/openssl/softbus_aes_encrypt.c", 206 ] 207 deps += [ "//third_party/openssl:libcrypto_shared" ] 208 } 209 public_configs = [ ":dsoftbus_adapter_common_interface" ] 210 } 211 } 212} else { 213 config("config_adapter_common") { 214 include_dirs = [ 215 "$dsoftbus_dfx_path/interface/include", 216 "$dsoftbus_feature_product_config_path/spec_config", 217 "$dsoftbus_root_path/core/common/include", 218 "$softbus_adapter_common/include", 219 "$softbus_adapter_common/include/OS_adapter_define/linux", 220 "$softbus_adapter_common/security/access_token/include", 221 "$dsoftbus_root_path/interfaces/inner_kits/lnn", 222 ] 223 } 224 225 ohos_shared_library("softbus_adapter") { 226 sanitize = { 227 ubsan = true 228 integer_overflow = true 229 boundary_sanitize = true 230 cfi = true 231 cfi_cross_dso = true 232 debug = false 233 } 234 branch_protector_ret = "pac_ret" 235 236 include_dirs = [ 237 "$dsoftbus_dfx_path/interface/include", 238 "$dsoftbus_root_path/interfaces/kits", 239 "$dsoftbus_root_path/interfaces/kits/common", 240 "$softbus_adapter_common/security/access_token/include", 241 ] 242 243 external_deps = [ "bounds_checking_function:libsec_shared" ] 244 if (is_standard_system) { 245 external_deps += [ 246 "c_utils:utils", 247 "json:nlohmann_json_static", 248 ] 249 } 250 sources = [ 251 "$dsoftbus_dfx_path/event/legacy/softbus_adapter_hisysevent.cpp", 252 "$dsoftbus_dfx_path/trace/legacy/softbus_adapter_hitrace.c", 253 "$softbus_adapter_common/json/nlohmann/softbus_adapter_json.cpp", 254 "$softbus_adapter_common/kernel/posix/lnn_ip_utils_adapter.c", 255 "$softbus_adapter_common/kernel/posix/softbus_adapter_file.c", 256 "$softbus_adapter_common/kernel/posix/softbus_adapter_mem.c", 257 "$softbus_adapter_common/kernel/posix/softbus_adapter_socket.c", 258 "$softbus_adapter_common/kernel/posix/softbus_adapter_thread.c", 259 "$softbus_adapter_common/kernel/posix/softbus_adapter_timer.c", 260 "$softbus_adapter_common/perf/softbus_adapter_perf.c", 261 ] 262 263 if (dsoftbus_access_token_feature) { 264 sources += [ "$softbus_adapter_common/security/access_token/common/softbus_access_token_adapter.cpp" ] 265 external_deps += [ 266 "access_token:libaccesstoken_sdk", 267 "access_token:libprivacy_sdk", 268 "access_token:libtokenid_sdk", 269 ] 270 if (dsoftbus_ipc_feature) { 271 external_deps += [ "ipc:ipc_single" ] 272 } 273 } else { 274 sources += [ "$softbus_adapter_common/security/access_token/common/softbus_access_token_adapter_virtual.c" ] 275 } 276 277 sources += [ "$softbus_adapter_config/spec_config/softbus_config_adapter.c" ] 278 279 deps = [ "$dsoftbus_dfx_path:softbus_dfx" ] 280 public_external_deps = [ 281 "bounds_checking_function:libsec_shared", 282 "json:nlohmann_json_static", 283 ] 284 285 sources += [ "$softbus_adapter_common/range/softbus_adapter_range.c" ] 286 287 if (dsoftbus_feature_encrypt == 0) { 288 sources += [ 289 "$softbus_adapter_common/mbedtls/softbus_adapter_crypto.c", 290 "$softbus_adapter_common/mbedtls/softbus_aes_encrypt_virtual.c", 291 ] 292 external_deps += [ "//third_party/mbedtls" ] 293 } else if (dsoftbus_feature_encrypt == 1) { 294 sources += [ 295 "$softbus_adapter_common/openssl/softbus_adapter_crypto.c", 296 "$softbus_adapter_common/openssl/softbus_aes_encrypt.c", 297 ] 298 public_external_deps += [ "openssl:libcrypto_shared" ] 299 } 300 public_configs = [ ":config_adapter_common" ] 301 public_external_deps += [ "hitrace:libhitracechain" ] 302 if (is_standard_system) { 303 external_deps += [ 304 "ffrt:libffrt", 305 "hilog:libhilog", 306 "hisysevent:libhisysevent", 307 "hitrace:libhitracechain", 308 "init:libbegetutil", 309 ] 310 } 311 innerapi_tags = [ "platformsdk_indirect" ] 312 part_name = "dsoftbus" 313 subsystem_name = "communication" 314 } 315} 316