• 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
14import(
15    "//foundation/communication/dsoftbus/core/connection/common/conn_common.gni")
16import(
17    "//foundation/communication/dsoftbus/core/transmission/common/trans_common.gni")
18import("//foundation/communication/dsoftbus/dsoftbus.gni")
19
20common_utils_src = [
21  "bitmap/softbus_bitmap.c",
22  "network/softbus_network_utils.c",
23  "json_utils/softbus_json_utils.c",
24  "log/softbus_log.c",
25  "message_handler/message_handler.c",
26  "queue/softbus_queue.c",
27  "security/sequence_verification/softbus_sequence_verification.c",
28  "softbus_property/softbus_feature_config.c",
29  "utils/softbus_utils.c",
30  "dfx/hisysevent_adapter/softbus_hisysevt_bus_center.c",
31  "dfx/hisysevent_adapter/softbus_hisysevt_common.c",
32  "dfx/hisysevent_adapter/softbus_hisysevt_connreporter.c",
33  "dfx/hisysevent_adapter/softbus_hisysevt_discreporter.c",
34  "dfx/hisysevent_adapter/softbus_hisysevt_transreporter.c",
35]
36
37if (defined(ohos_lite)) {
38  if (ohos_kernel_type == "liteos_m") {
39    hilog_lite_include_path =
40        "//base/hiviewdfx/hilog_lite/interfaces/native/kits/hilog_lite"
41    diff_deps = [
42      "//base/hiviewdfx/hilog_lite/frameworks/mini:hilog_lite",
43      "//build/lite/config/component/cJSON:cjson_static",
44    ]
45    build_type = "static_library"
46  } else {
47    hilog_lite_include_path =
48        "//base/hiviewdfx/hilog_lite/interfaces/native/innerkits"
49    diff_deps = [
50      "//base/hiviewdfx/hilog_lite/frameworks/featured:hilog_shared",
51      "//build/lite/config/component/cJSON:cjson_shared",
52    ]
53    build_type = "shared_library"
54  }
55  config("dsoftbus_utils_interface") {
56    include_dirs = [
57      "$dsoftbus_root_path/core/common/include",
58      "$dsoftbus_root_path/interfaces/kits/common",
59      "$dsoftbus_root_path/core/common/dfx/hidumper_adapter/include",
60      "$dsoftbus_root_path/core/common/dfx/hisysevent_adapter/include",
61      "$softbus_adapter_common/include",
62      "$hilog_lite_include_path",
63    ]
64    include_dirs += conn_common_inc + trans_common_inc
65    if (board_toolchain_type != "iccarm") {
66      cflags = [
67        "-ffunction-sections",
68        "-fdata-sections",
69        "-Os",
70      ]
71    } else {
72      cflags = [
73        "--diag_suppress",
74        "Pe186",
75      ]
76    }
77    cflags_cc = cflags
78  }
79
80  target(build_type, "softbus_utils") {
81    include_dirs = [
82      "$dsoftbus_root_path/interfaces/kits/common",
83      "$dsoftbus_root_path/components/nstackx/nstackx_core/dfile/interface",
84    ]
85    include_dirs += conn_common_inc + trans_common_inc
86    dfx_src = [
87      "dfx/hidumper_adapter/softbus_hidumper_trans_virtual.c",
88      "dfx/hidumper_adapter/softbus_hidumper_buscenter_virtual.c",
89      "dfx/hidumper_adapter/softbus_hidumper_disc_virtual.c",
90      "dfx/hidumper_adapter/softbus_hidumper_conn_virtual.c",
91      "dfx/hidumper_adapter/softbus_hidumper_interface_virtual.c",
92      "dfx/hisysevent_adapter/softbus_hisysevt_nstack_virtual.c",
93    ]
94    sources = common_utils_src
95    sources += conn_common_src + trans_common_src + dfx_src
96    if (board_toolchain_type != "iccarm") {
97      cflags = [
98        "-Wall",
99        "-fPIC",
100        "-std=c99",
101      ]
102    }
103    if (ohos_kernel_type == "liteos_m") {
104      defines = [ "SOFTBUS_MINI_SYSTEM" ]
105      defines += [ "__STDC_FORMAT_MACROS" ]
106    } else {
107      defines = [ "DEFAULT_STORAGE_PATH=\"/storage/data\"" ]
108      defines += [ "__STDC_FORMAT_MACROS" ]
109      defines += [ "SOFTBUS_SMALL_SYSTEM" ]
110    }
111    deps = [ "$dsoftbus_root_path/adapter:softbus_adapter" ]
112    deps += diff_deps
113    public_configs = [ ":dsoftbus_utils_interface" ]
114  }
115} else {
116  dstream_native_source_path = rebase_path("$dsoftbus_root_path")
117  dstream_dep_file = "components/nstackx_enhanced/fillp/BUILD.gn"
118  enhanced = exec_script("$dsoftbus_root_path/check_sub_module.py",
119                         [
120                           "$dstream_native_source_path",
121                           "$dstream_dep_file",
122                         ],
123                         "value")
124
125  cflags = [ "-DFILLP_LINUX" ]
126  config("dsoftbus_utils_interface_L2") {
127    include_dirs = [
128      "$dsoftbus_root_path/core/common/include",
129      "$dsoftbus_root_path/core/common/dfx/hidumper_adapter/include",
130      "$dsoftbus_root_path/core/common/dfx/hisysevent_adapter/include",
131      "$dsoftbus_root_path/interfaces/kits/common",
132      "$softbus_adapter_common/include",
133      "$dsoftbus_root_path/components/nstackx/nstackx_core/dfile/interface",
134    ]
135    include_dirs += conn_common_inc + trans_common_inc
136  }
137  ohos_shared_library("softbus_utils") {
138    include_dirs = [
139      "$dsoftbus_root_path/interfaces/kits/common",
140      "$dsoftbus_root_path/core/bus_center/utils/include",
141      "$dsoftbus_root_path/core/common/include",
142      "$dsoftbus_root_path/components/nstackx/fillp/include",
143      "$dsoftbus_root_path/components/nstackx/nstackx_core/dfile/interface",
144      "$dsoftbus_root_path/components/nstackx/nstackx_util/interface",
145      "$dsoftbus_root_path/components/nstackx/nstackx_ctrl/interface",
146      "//third_party/cJSON",
147      "//third_party/bounds_checking_function/include",
148    ]
149    include_dirs += conn_common_inc + trans_common_inc
150    dfx_source = [
151      "dfx/hidumper_adapter/softbus_hidumper.c",
152      "dfx/hidumper_adapter/softbus_hidumper_interface.c",
153      "dfx/hidumper_adapter/softbus_hidumper_disc.c",
154      "dfx/hidumper_adapter/softbus_hidumper_conn.c",
155      "dfx/hidumper_adapter/softbus_hidumper_nstack.c",
156      "dfx/hidumper_adapter/softbus_hidumper_trans.c",
157      "dfx/hidumper_adapter/softbus_hidumper_buscenter.c",
158      "dfx/hisysevent_adapter/softbus_hisysevt_nstack.c",
159    ]
160    sources = common_utils_src + conn_common_src + trans_common_src + dfx_source
161    sources += [ "$dsoftbus_root_path/core/common/utils/sqlite3_utils.c" ]
162    defines = [ "DEFAULT_STORAGE_PATH=\"/data/service/el1/public\"" ]
163    defines += [ "SOFTBUS_STANDARD_SYSTEM" ]
164    defines += [ "__STDC_FORMAT_MACROS" ]
165    if (is_asan) {
166      defines += [ "ASAN_BUILD" ]
167    }
168
169    public_configs = [ ":dsoftbus_utils_interface_L2" ]
170    public_deps = [
171      "$dsoftbus_root_path/adapter:softbus_adapter",
172      "//third_party/cJSON:cjson",
173      "//third_party/sqlite:sqlite",
174    ]
175    if (!enhanced) {
176      cflags += [ "-DFILLP_ENHANCED" ]
177      public_deps += [
178        "$dsoftbus_root_path/components/nstackx/fillp:FillpSo.open",
179        "$dsoftbus_root_path/components/nstackx/nstackx_core/dfile:nstackx_dfile.open",
180        "$dsoftbus_root_path/components/nstackx/nstackx_ctrl:nstackx_ctrl",
181        "$dsoftbus_root_path/components/nstackx/nstackx_util:nstackx_util.open",
182      ]
183    }
184    if (is_standard_system) {
185      external_deps = [ "hiviewdfx_hilog_native:libhilog" ]
186    }
187    part_name = "dsoftbus"
188    subsystem_name = "communication"
189  }
190}
191