• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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        "-Os",
33      ]
34      cflags_cc = cflags
35      include_dirs = [
36        "$NSTACKX_ROOT/nstackx_util/interface",
37        "$NSTACKX_ROOT/nstackx_util/platform/liteos",
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      external_deps = [ "bounds_checking_function:libsec_shared" ]
47    } else if (ohos_kernel_type == "linux") {
48      cflags = [
49        "-Wall",
50        "-DNSTACKX_WITH_HMOS_LINUX",
51        "-DMBEDTLS_INCLUDED",
52        "-DENABLE_USER_LOG",
53        "-Os",
54      ]
55      cflags_cc = cflags
56      include_dirs = [
57        "$NSTACKX_ROOT/nstackx_util/interface",
58        "$NSTACKX_ROOT/nstackx_util/platform/unix",
59        "interface",
60        "platform/unix",
61      ]
62      sources = [
63        "core/nstackx_congestion.c",
64        "platform/unix/sys_congestion.c",
65      ]
66      deps = [ "$NSTACKX_ROOT/nstackx_util:nstackx_util.open" ]
67      external_deps = [ "bounds_checking_function:libsec_shared" ]
68    }
69  }
70} else {
71  import("//build/ohos.gni")
72
73  ohos_shared_library("nstackx_congestion.open") {
74    sanitize = {
75      ubsan = true
76      integer_overflow = true
77      boundary_sanitize = true
78      cfi = true
79      cfi_cross_dso = true
80      debug = false
81    }
82    branch_protector_ret = "pac_ret"
83
84    cflags = [
85      "-Wall",
86      "-DMBEDTLS_INCLUDED",
87      "-DNSTACKX_WITH_HMOS_LINUX",
88      "-DENABLE_USER_LOG",
89    ]
90    cflags_cc = cflags
91    include_dirs = [
92      "$NSTACKX_ROOT/nstackx_util/interface",
93      "$NSTACKX_ROOT/nstackx_util/platform/unix",
94      "interface",
95      "platform/unix",
96      "-Os",
97    ]
98    sources = [
99      "core/nstackx_congestion.c",
100      "platform/unix/sys_congestion.c",
101    ]
102
103    deps = [ "$NSTACKX_ROOT/nstackx_util:nstackx_util.open" ]
104    external_deps = [ "bounds_checking_function:libsec_shared" ]
105    if (is_standard_system) {
106      external_deps += [ "c_utils:utils" ]
107    }
108    innerapi_tags = [ "platformsdk_indirect" ]
109    part_name = "dsoftbus"
110    subsystem_name = "communication"
111  }
112}
113