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