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("//build/ohos.gni")
15import("//foundation/communication/netmanager_base/netmanager_base_config.gni")
16
17group("common_target") {
18  deps = [
19    ":net_bundle_utils",
20    ":net_data_share",
21    ":net_manager_common",
22    "napi_utils:napi_utils",
23  ]
24}
25
26config("netmgr_common_config") {
27  include_dirs = [
28    "common_utils/include",
29    "log/include",
30    "errorcode_utils/include",
31    "$INNERKITS_ROOT/include",
32    "$INNERKITS_ROOT/netconnclient/include",
33    "$INNERKITS_ROOT/netpolicyclient/include",
34    "$INNERKITS_ROOT/netstatsclient/include",
35  ]
36
37  cflags = [
38    "-fstack-protector-strong",
39    "-D_FORTIFY_SOURCE=2",
40    "-O2",
41  ]
42
43  cflags_cc = [
44    "-fstack-protector-strong",
45    "-D_FORTIFY_SOURCE=2",
46    "-O2",
47  ]
48}
49
50ohos_shared_library("net_manager_common") {
51  sanitize = {
52    cfi = true
53    cfi_cross_dso = true
54    debug = false
55  }
56
57  branch_protector_ret = "pac_ret"
58
59  sources = [
60    "common_utils/src/base64_utils.cpp",
61    "common_utils/src/event_report.cpp",
62    "common_utils/src/netmanager_base_common_utils.cpp",
63    "common_utils/src/netmanager_base_permission.cpp",
64    "common_utils/src/netmanager_hitrace.cpp",
65    "common_utils/src/tiny_count_down_latch.cpp",
66    "errorcode_utils/src/errorcode_convertor.cpp",
67    "log/src/net_mgr_log_wrapper.cpp",
68  ]
69
70  defines = [
71    "NETMGR_LOG_TAG = \"NetMgrCommon\"",
72    "LOG_DOMAIN = 0xD0015B0",
73  ]
74
75  if (enable_netmgr_debug) {
76    defines += [ "NETMGR_DEBUG" ]
77  }
78
79  if (netmanager_base_enable_feature_wearable_distributed_net) {
80    defines += [ "FEATURE_WEARABLE_DISTRIBUTED_NET_ENABLE" ]
81  }
82
83  if (is_standard_system) {
84    defines += [ "STANDARD_SYSTEM_ENABLE" ]
85  }
86
87  public_configs = [ ":netmgr_common_config" ]
88
89  external_deps = [
90    "hicollie:libhicollie",
91    "hilog:libhilog",
92    "init:libbegetutil",
93  ]
94
95  external_deps += [
96    "access_token:libaccesstoken_sdk",
97    "access_token:libtokenid_sdk",
98    "c_utils:utils",
99    "hisysevent:libhisysevent",
100    "hitrace:hitrace_meter",
101    "ipc:ipc_single",
102  ]
103
104  innerapi_tags = [ "platformsdk" ]
105  part_name = "netmanager_base"
106  subsystem_name = "communication"
107}
108
109config("netmgr_datashare_config") {
110  include_dirs = [
111    "data_share/include",
112    "log/include",
113    "$INNERKITS_ROOT/include",
114  ]
115
116  cflags = [
117    "-fstack-protector-strong",
118    "-D_FORTIFY_SOURCE=2",
119    "-O2",
120  ]
121
122  cflags_cc = [
123    "-fstack-protector-strong",
124    "-D_FORTIFY_SOURCE=2",
125    "-O2",
126  ]
127}
128
129ohos_shared_library("net_data_share") {
130  sanitize = {
131    cfi = true
132    cfi_cross_dso = true
133    debug = false
134  }
135
136  sources = [
137    "data_share/src/net_datashare_utils.cpp",
138    "data_share/src/net_datashare_utils_iface.cpp",
139  ]
140
141  defines = [
142    "NETMGR_LOG_TAG = \"NetMgrDataShare\"",
143    "LOG_DOMAIN = 0xD0015B0",
144  ]
145
146  if (enable_netmgr_debug) {
147    defines += [ "NETMGR_DEBUG" ]
148  }
149
150  if (is_standard_system) {
151    defines += [ "STANDARD_SYSTEM_ENABLE" ]
152  }
153
154  public_configs = [ ":netmgr_datashare_config" ]
155
156  external_deps = [
157    "ability_base:zuri",
158    "ability_runtime:dataobs_manager",
159    "c_utils:utils",
160    "data_share:datashare_common",
161    "data_share:datashare_consumer",
162    "hilog:libhilog",
163    "ipc:ipc_core",
164    "samgr:samgr_proxy",
165  ]
166
167  innerapi_tags = [ "platformsdk" ]
168  part_name = "netmanager_base"
169  subsystem_name = "communication"
170}
171
172ohos_shared_library("net_bundle_utils") {
173  sanitize = {
174    cfi = true
175    cfi_cross_dso = true
176    debug = false
177    blocklist = "./bundle_utils/net_bundle_utils_blocklist.txt"
178  }
179
180  include_dirs = [
181    "bundle_utils/include",
182    "log/include",
183    "$INNERKITS_ROOT/include",
184  ]
185
186  sources = [ "bundle_utils/src/net_bundle_impl.cpp" ]
187
188  defines = [
189    "NETMGR_LOG_TAG = \"NetMgrBundleUtils\"",
190    "LOG_DOMAIN = 0xD0015B0",
191  ]
192
193  cflags = [
194    "-fstack-protector-strong",
195    "-D_FORTIFY_SOURCE=2",
196    "-O2",
197  ]
198
199  cflags_cc = [
200    "-fstack-protector-strong",
201    "-D_FORTIFY_SOURCE=2",
202    "-O2",
203  ]
204
205  if (enable_netmgr_debug) {
206    defines += [ "NETMGR_DEBUG" ]
207  }
208
209  if (is_standard_system) {
210    defines += [ "STANDARD_SYSTEM_ENABLE" ]
211  }
212
213  external_deps = [
214    "bundle_framework:appexecfwk_base",
215    "bundle_framework:appexecfwk_core",
216    "c_utils:utils",
217    "hilog:libhilog",
218    "ipc:ipc_core",
219    "samgr:samgr_proxy",
220  ]
221
222  innerapi_tags = [ "platformsdk" ]
223  part_name = "netmanager_base"
224  subsystem_name = "communication"
225}
226