• 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"
18if (defined(ohos_lite)) {
19  import("//build/lite/config/component/lite_component.gni")
20  config("dfile_lite_config") {
21    cflags = [
22      "-Wall",
23      "-fno-lto",
24      "-D_GNU_SOURCE",
25      "-DNSTACKX_WITH_LITEOS",
26      "-DLWIP_DONT_PROVIDE_BYTEORDER_FUNCTIONS",
27      "-DLWIP_LITEOS_A_COMPAT",
28      "-DMBEDTLS_INCLUDED",
29      "-DDFILE_ENABLE_HIDUMP",
30      "-Os",
31    ]
32    cflags_cc = cflags
33  }
34
35  config("dfile_linux_config") {
36    cflags = [
37      "-Wall",
38      "-fno-lto",
39      "-DNSTACKX_WITH_LINUX",
40      "-DMBEDTLS_INCLUDED",
41      "-DENABLE_USER_LOG",
42      "-Os",
43    ]
44    cflags_cc = cflags
45  }
46  shared_library("nstackx_dfile.open") {
47    if (ohos_kernel_type == "liteos_a") {
48      configs += [ ":dfile_lite_config" ]
49      include_dirs = [
50        "include",
51        "interface",
52        "$NSTACKX_ROOT/nstackx_congestion/interface/",
53        "$NSTACKX_ROOT/nstackx_core",
54        "$NSTACKX_ROOT/nstackx_util/interface",
55        "$NSTACKX_ROOT/nstackx_util/platform/liteos",
56      ]
57      sources = []
58      deps = []
59      external_deps = []
60      if (dsoftbus_feature_dfile) {
61        sources += [
62          "$NSTACKX_ROOT/nstackx_core/platform/liteos/dfile/sys_dfile.c",
63          "$NSTACKX_ROOT/nstackx_core/platform/liteos/dfile/sys_dfile_session.c",
64          "$NSTACKX_ROOT/nstackx_core/platform/liteos/dfile/sys_file_manager.c",
65          "core/nstackx_dfile.c",
66          "core/nstackx_dfile_config.c",
67          "core/nstackx_dfile_control.c",
68          "core/nstackx_dfile_dfx.c",
69          "core/nstackx_dfile_frame.c",
70          "core/nstackx_dfile_log.c",
71          "core/nstackx_dfile_mp.c",
72          "core/nstackx_dfile_retransmission.c",
73          "core/nstackx_dfile_send.c",
74          "core/nstackx_dfile_session.c",
75          "core/nstackx_dfile_transfer.c",
76          "core/nstackx_file_list.c",
77          "core/nstackx_file_manager.c",
78          "core/nstackx_file_manager_client.c",
79        ]
80        deps += [
81          "$NSTACKX_ROOT/nstackx_congestion:nstackx_congestion.open",
82          "$NSTACKX_ROOT/nstackx_util:nstackx_util.open",
83        ]
84        external_deps += [
85          "bounds_checking_function:libsec_shared",
86          "mbedtls:mbedtls_shared",
87        ]
88      }
89    } else if (ohos_kernel_type == "linux") {
90      configs += [ ":dfile_linux_config" ]
91      include_dirs = [
92        "include",
93        "interface",
94        "$NSTACKX_ROOT/nstackx_congestion/interface/",
95        "$NSTACKX_ROOT/nstackx_core",
96        "$NSTACKX_ROOT/nstackx_util/interface",
97        "$NSTACKX_ROOT/nstackx_util/platform/unix",
98      ]
99      sources = []
100      deps = []
101      external_deps = []
102      if (dsoftbus_feature_dfile) {
103        sources += [
104          "$NSTACKX_ROOT/nstackx_core/platform/unix/dfile/sys_dfile.c",
105          "$NSTACKX_ROOT/nstackx_core/platform/unix/dfile/sys_dfile_session.c",
106          "$NSTACKX_ROOT/nstackx_core/platform/unix/dfile/sys_file_manager.c",
107          "core/nstackx_dfile.c",
108          "core/nstackx_dfile_config.c",
109          "core/nstackx_dfile_control.c",
110          "core/nstackx_dfile_dfx.c",
111          "core/nstackx_dfile_frame.c",
112          "core/nstackx_dfile_log.c",
113          "core/nstackx_dfile_mp.c",
114          "core/nstackx_dfile_retransmission.c",
115          "core/nstackx_dfile_send.c",
116          "core/nstackx_dfile_session.c",
117          "core/nstackx_dfile_transfer.c",
118          "core/nstackx_file_list.c",
119          "core/nstackx_file_manager.c",
120          "core/nstackx_file_manager_client.c",
121        ]
122        deps += [
123          "$NSTACKX_ROOT/nstackx_congestion:nstackx_congestion.open",
124          "$NSTACKX_ROOT/nstackx_util:nstackx_util.open",
125        ]
126        external_deps += [
127          "bounds_checking_function:libsec_shared",
128          "mbedtls:mbedtls_shared",
129        ]
130      }
131    }
132  }
133} else {
134  import("//build/ohos.gni")
135
136  ohos_shared_library("nstackx_dfile.open") {
137    sanitize = {
138      ubsan = true
139      integer_overflow = true
140      boundary_sanitize = true
141      cfi = true
142      cfi_cross_dso = true
143      debug = false
144    }
145    branch_protector_ret = "pac_ret"
146
147    cflags = [
148      "-Wall",
149      "-DNSTACKX_WITH_LINUX",
150      "-DDFILE_ENABLE_HIDUMP",
151      "-DENABLE_USER_LOG",
152      "-DSSL_AND_CRYPTO_INCLUDED",
153      "-Os",
154    ]
155    cflags_cc = cflags
156    include_dirs = [
157      "include",
158      "interface",
159      "$NSTACKX_ROOT/nstackx_congestion/interface/",
160      "$NSTACKX_ROOT/nstackx_core",
161      "$NSTACKX_ROOT/nstackx_util/interface",
162      "$NSTACKX_ROOT/nstackx_util/platform/unix",
163    ]
164    sources = []
165    deps = []
166    external_deps = []
167    if (dsoftbus_feature_dfile) {
168      sources += [
169        "$NSTACKX_ROOT/nstackx_core/platform/unix/dfile/sys_dfile.c",
170        "$NSTACKX_ROOT/nstackx_core/platform/unix/dfile/sys_dfile_session.c",
171        "$NSTACKX_ROOT/nstackx_core/platform/unix/dfile/sys_file_manager.c",
172        "core/nstackx_dfile.c",
173        "core/nstackx_dfile_config.c",
174        "core/nstackx_dfile_control.c",
175        "core/nstackx_dfile_dfx.c",
176        "core/nstackx_dfile_frame.c",
177        "core/nstackx_dfile_log.c",
178        "core/nstackx_dfile_mp.c",
179        "core/nstackx_dfile_retransmission.c",
180        "core/nstackx_dfile_send.c",
181        "core/nstackx_dfile_session.c",
182        "core/nstackx_dfile_transfer.c",
183        "core/nstackx_file_list.c",
184        "core/nstackx_file_manager.c",
185        "core/nstackx_file_manager_client.c",
186      ]
187      deps += [
188        "$NSTACKX_ROOT/nstackx_congestion:nstackx_congestion.open",
189        "$NSTACKX_ROOT/nstackx_util:nstackx_util.open",
190      ]
191      external_deps += [
192        "bounds_checking_function:libsec_shared",
193        "openssl:libcrypto_shared",
194      ]
195    }
196    if (is_standard_system) {
197      external_deps += [ "c_utils:utils" ]
198    }
199    innerapi_tags = [ "platformsdk_indirect" ]
200    part_name = "dsoftbus"
201    subsystem_name = "communication"
202  }
203}
204