1# Copyright (c) 2021-2024 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("../../../transmission/common/trans_common.gni")
15import("../dsoftbus_dfx.gni")
16
17dsoftbus_root_path = "../../../.."
18softbus_adapter_common = "${dsoftbus_root_path}/adapter/common"
19
20if (defined(ohos_lite)) {
21  if (ohos_kernel_type == "liteos_m") {
22    build_type = "static_library"
23    libsec_external_deps = [ "bounds_checking_function:libsec_static" ]
24  } else {
25    build_type = "shared_library"
26    libsec_external_deps = [ "bounds_checking_function:libsec_shared" ]
27  }
28  config("dsoftbus_dump_interface_lite") {
29    include_dirs = [
30      "$dsoftbus_dfx_path/hidumper_adapter/include",
31      "$dsoftbus_root_path/interfaces/kits/common",
32      "$dsoftbus_root_path/core/common/include",
33      "$softbus_adapter_common/include",
34    ]
35    cflags = ohos_lite_cflags
36    cflags_cc = ohos_lite_cflags
37  }
38
39  target(build_type, "softbus_dfx_dump") {
40    include_dirs = [
41      "$dsoftbus_dfx_path/event/src",
42      "$dsoftbus_root_path/core/common/dfx/interface/include",
43      "$dsoftbus_root_path/core/transmission/common/include",
44      "$dsoftbus_root_path/interfaces/kits/transport",
45      "$hilog_lite_include_path",
46    ]
47    sources = [
48      "softbus_hidumper.c",
49      "softbus_hidumper_alarm_virtual.c",
50      "softbus_hidumper_bc_mgr_virtual.c",
51      "softbus_hidumper_broadcast_virtual.c",
52      "softbus_hidumper_buscenter_virtual.c",
53      "softbus_hidumper_conn_virtual.c",
54      "softbus_hidumper_disc_virtual.c",
55      "softbus_hidumper_interface_virtual.c",
56      "softbus_hidumper_nstack_virtual.c",
57      "softbus_hidumper_stats_virtual.c",
58      "softbus_hidumper_trans_virtual.c",
59      "softbus_hidumper_util_virtual.c",
60    ]
61    external_deps = libsec_external_deps
62    public_configs = [ ":dsoftbus_dump_interface_lite" ]
63  }
64} else {
65  cflags = [ "-DFILLP_LINUX" ]
66  config("dsoftbus_dump_interface_std") {
67    include_dirs = [
68      "$dsoftbus_dfx_path/hidumper_adapter/include",
69      "$dsoftbus_root_path/core/common/include",
70      "$dsoftbus_root_path/components/nstackx/nstackx_core/dfile/interface",
71      "$softbus_adapter_common/include",
72    ]
73  }
74  ohos_shared_library("softbus_dfx_dump") {
75    sanitize = {
76      cfi = true
77      cfi_cross_dso = true
78      debug = false
79    }
80    branch_protector_ret = "pac_ret"
81    include_dirs = [
82      "$dsoftbus_dfx_path/interface/include",
83      "$dsoftbus_dfx_path/event/src",
84      "$dsoftbus_root_path/interfaces/kits/common",
85      "$dsoftbus_root_path/components/nstackx/fillp/include",
86      "$dsoftbus_root_path/components/nstackx/nstackx_core/dfile/interface",
87      "$dsoftbus_root_path/components/nstackx/nstackx_util/interface",
88      "$dsoftbus_root_path/components/nstackx/nstackx_ctrl/interface",
89      "$dsoftbus_root_path/core/bus_center/utils/include",
90      "$dsoftbus_root_path/core/authentication/interface",
91      "$dsoftbus_root_path/core/bus_center/interface",
92      "$dsoftbus_root_path/core/bus_center/lnn/net_ledger/common/include",
93      "$dsoftbus_root_path/core/connection/interface",
94      "$dsoftbus_root_path/core/connection/wifi_direct_cpp",
95    ]
96    include_dirs += trans_common_inc
97    sources = [
98      "$dsoftbus_root_path/core/bus_center/utils/src/lnn_map.c",
99      "$dsoftbus_root_path/core/common/message_handler/message_handler.c",
100      "$dsoftbus_root_path/core/common/softbus_property/softbus_feature_config.c",
101      "$dsoftbus_root_path/core/common/utils/softbus_utils.c",
102      "softbus_hidumper.c",
103
104      # "$softbus_adapter_common/kernel/liteos_m/softbus_adapter_timer.c",
105      "softbus_hidumper_alarm.c",
106      "softbus_hidumper_bc_mgr.c",
107      "softbus_hidumper_broadcast.c",
108      "softbus_hidumper_buscenter.c",
109      "softbus_hidumper_conn.c",
110      "softbus_hidumper_disc.c",
111      "softbus_hidumper_interface.c",
112      "softbus_hidumper_nstack.c",
113      "softbus_hidumper_stats.c",
114      "softbus_hidumper_trans.c",
115      "softbus_hidumper_util.c",
116    ]
117    defines += [ "__STDC_FORMAT_MACROS" ]
118    if (is_asan) {
119      defines += [ "ASAN_BUILD" ]
120    }
121
122    public_configs = [ ":dsoftbus_dump_interface_std" ]
123    public_deps = [
124      "$dsoftbus_dfx_path/anonymize:softbus_dfx_anonymizer",
125      "$dsoftbus_dfx_path/event:softbus_dfx_event",
126      "$dsoftbus_dfx_path/log:softbus_dfx_log",
127      "$dsoftbus_root_path/adapter:softbus_adapter",
128    ]
129    public_external_deps = [
130      "bounds_checking_function:libsec_shared",
131      "cJSON:cjson",
132      "sqlite:sqlite",
133    ]
134    external_deps = [
135      "bounds_checking_function:libsec_shared",
136      "cJSON:cjson",
137      "hilog:libhilog",
138      "hisysevent:libhisysevent",
139      "hisysevent:libhisyseventmanager",
140    ]
141
142    innerapi_tags = [ "platformsdk_indirect" ]
143    part_name = "dsoftbus"
144    subsystem_name = "communication"
145  }
146}
147