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 14DSOFTBUS_ROOT_PATH = "./../../.." 15import("$DSOFTBUS_ROOT_PATH/dsoftbus.gni") 16 17NSTACKX_ROOT = "$DSOFTBUS_ROOT_PATH/components/nstackx" 18 19if (defined(ohos_lite)) { 20 import("//build/lite/config/component/lite_component.gni") 21 22 shared_library("nstackx_congestion.open") { 23 if (ohos_kernel_type == "liteos_a") { 24 cflags = [ 25 "-Wall", 26 "-D_GNU_SOURCE", 27 "-DNSTACKX_WITH_LITEOS", 28 "-DLWIP_DONT_PROVIDE_BYTEORDER_FUNCTIONS", 29 "-DLWIP_LITEOS_A_COMPAT", 30 "-DMBEDTLS_INCLUDED", 31 "-DENABLE_USER_LOG", 32 ] 33 cflags_cc = cflags 34 include_dirs = [ 35 "$NSTACKX_ROOT/nstackx_util/interface", 36 "$NSTACKX_ROOT/nstackx_util/platform/liteos", 37 "//third_party/bounds_checking_function/include/", 38 "interface", 39 "platform/liteos", 40 ] 41 sources = [ 42 "core/nstackx_congestion.c", 43 "platform/liteos/sys_congestion.c", 44 ] 45 deps = [ "$NSTACKX_ROOT/nstackx_util:nstackx_util.open" ] 46 } else if (ohos_kernel_type == "linux") { 47 cflags = [ 48 "-Wall", 49 "-DNSTACKX_WITH_HMOS_LINUX", 50 "-DMBEDTLS_INCLUDED", 51 "-DENABLE_USER_LOG", 52 ] 53 cflags_cc = cflags 54 include_dirs = [ 55 "$NSTACKX_ROOT/nstackx_util/interface", 56 "$NSTACKX_ROOT/nstackx_util/platform/unix", 57 "//third_party/bounds_checking_function/include/", 58 "interface", 59 "platform/unix", 60 ] 61 sources = [ 62 "core/nstackx_congestion.c", 63 "platform/unix/sys_congestion.c", 64 ] 65 66 deps = [ "$NSTACKX_ROOT/nstackx_util:nstackx_util.open" ] 67 } 68 } 69} else { 70 import("//build/ohos.gni") 71 72 ohos_shared_library("nstackx_congestion.open") { 73 sanitize = { 74 cfi = true 75 cfi_cross_dso = true 76 debug = false 77 } 78 branch_protector_ret = "pac_ret" 79 80 cflags = [ 81 "-Wall", 82 "-DMBEDTLS_INCLUDED", 83 "-DNSTACKX_WITH_HMOS_LINUX", 84 "-DENABLE_USER_LOG", 85 ] 86 cflags_cc = cflags 87 include_dirs = [ 88 "$NSTACKX_ROOT/nstackx_util/interface", 89 "$NSTACKX_ROOT/nstackx_util/platform/unix", 90 "//commonlibrary/c_utils/base/include/", 91 "//third_party/bounds_checking_function/include", 92 "interface", 93 "platform/unix", 94 ] 95 sources = [ 96 "core/nstackx_congestion.c", 97 "platform/unix/sys_congestion.c", 98 ] 99 100 deps = [ 101 "$NSTACKX_ROOT/nstackx_util:nstackx_util.open", 102 "//third_party/bounds_checking_function:libsec_shared", 103 ] 104 innerapi_tags = [ "platformsdk_indirect" ] 105 part_name = "dsoftbus" 106 subsystem_name = "communication" 107 } 108} 109