• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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/netstack/netstack_config.gni")
16
17group("common_utils") {
18  deps = [
19    ":stack_utils_common",
20    "napi_utils:napi_utils",
21  ]
22}
23
24config("stack_utils_common_public_config") {
25  include_dirs = [
26    "common_utils/include",
27    "log/include",
28  ]
29  if (product_name == "ohcore") {
30    defines = [ "OH_CORE_NETSTACK_PERMISSION_CHECK" ]
31  }
32  if (is_mingw) {
33    defines = [ "WINDOWS_PLATFORM" ]
34  }
35}
36
37ohos_shared_library("stack_utils_common") {
38  sanitize = {
39    cfi = true
40    cfi_cross_dso = true
41    debug = false
42  }
43
44  branch_protector_ret = "pac_ret"
45
46  cflags = [
47    "-fstack-protector-strong",
48    "-D_FORTIFY_SOURCE=2",
49    "-O2",
50  ]
51  cflags_cc = [
52    "-fstack-protector-strong",
53    "-D_FORTIFY_SOURCE=2",
54    "-O2",
55  ]
56
57  sources = [
58    "common_utils/src/netstack_apipolicy_utils.cpp",
59    "common_utils/src/netstack_bundle_utils.cpp",
60    "common_utils/src/netstack_common_utils.cpp",
61    "common_utils/src/netstack_hisysevent.cpp",
62    "common_utils/src/request_tracer.cpp",
63  ]
64
65  public_configs = [ ":stack_utils_common_public_config" ]
66
67  external_deps = [
68    "bounds_checking_function:libsec_shared",
69    "hilog:libhilog",
70    "hisysevent:libhisysevent",
71    "samgr:samgr_proxy",
72  ]
73
74  if (defined(global_parts_info) &&
75      defined(global_parts_info.communication_netmanager_base) &&
76      global_parts_info.communication_netmanager_base) {
77    external_deps += [
78      "hitrace:hitrace_meter",
79      "netmanager_base:net_conn_manager_if",
80      "netmanager_base:net_security_config_if",
81    ]
82    defines = [ "HAS_NETMANAGER_BASE=1" ]
83    external_deps += [ "openssl:libcrypto_shared" ]
84  } else {
85    defines = [ "HAS_NETMANAGER_BASE=0" ]
86  }
87
88  innerapi_tags = [ "platformsdk" ]
89  part_name = "netstack"
90  subsystem_name = "communication"
91}
92