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")
16config("netsys_controller_include") {
17  include_dirs = [
18    "include",
19    "$NETSYSNATIVE_SOURCE_DIR/include/netsys",
20    "$INNERKITS_ROOT/netstatsclient/include",
21  ]
22
23  cflags = [
24    "-fstack-protector-strong",
25    "-D_FORTIFY_SOURCE=2",
26    "-O2",
27  ]
28
29  cflags_cc = [
30    "-fstack-protector-strong",
31    "-D_FORTIFY_SOURCE=2",
32    "-O2",
33  ]
34
35  if (netmanager_base_enable_feature_sysvpn) {
36    cflags += [ "-DSUPPORT_SYSVPN" ]
37    cflags_cc += [ "-DSUPPORT_SYSVPN" ]
38  }
39}
40
41ohos_shared_library("netsys_controller") {
42  sanitize = {
43    cfi = true
44    cfi_cross_dso = true
45    boundary_sanitize = true
46    ubsan = true
47    debug = false
48  }
49
50  branch_protector_ret = "pac_ret"
51
52  public_configs = [ ":netsys_controller_include" ]
53  sources = [
54    "src/mock_netsys_native_client.cpp",
55    "src/netsys_controller.cpp",
56    "src/netsys_controller_service_impl.cpp",
57    "src/netsys_native_client.cpp",
58  ]
59
60  include_dirs = [
61    "include",
62    "$NETCONNMANAGER_SOURCE_DIR/include",
63    "$NETCONNMANAGER_COMMON_DIR/include",
64    "$NETMANAGER_BASE_ROOT/utils/log/include",
65    "$NETSYSNATIVE_INNERKITS_SOURCE_DIR",
66    "$INNERKITS_ROOT/netmanagernative/include",
67    "$INNERKITS_ROOT/netconnclient/include",
68    "$NETMANAGER_BASE_ROOT/utils/common_utils/include",
69    "$NETSYSNATIVE_SOURCE_DIR/include/netsys",
70    "$NETSYSNATIVE_SOURCE_DIR/include/manager",
71  ]
72
73  deps = [
74    "$NETMANAGER_BASE_ROOT/services/netmanagernative:netsys_native_manager",
75    "$NETMANAGER_BASE_ROOT/utils:net_manager_common",
76  ]
77
78  external_deps = [
79    "c_utils:utils",
80    "ipc:ipc_core",
81    "samgr:samgr_proxy",
82  ]
83
84  defines = [
85    "NETMGR_LOG_TAG = \"NetConnManager\"",
86    "LOG_DOMAIN = 0xD0015B0",
87  ]
88
89  if (enable_netmgr_debug) {
90    defines += [ "NETMGR_DEBUG" ]
91  }
92
93  if (enable_sys_func) {
94    defines += [ "SYS_FUNC" ]
95  }
96
97  if (netmanager_base_enable_feature_wearable_distributed_net) {
98    defines += [ "FEATURE_WEARABLE_DISTRIBUTED_NET_ENABLE" ]
99  }
100
101  if (netmanager_base_enable_feature_net_firewall) {
102    defines += [ "FEATURE_NET_FIREWALL_ENABLE" ]
103  }
104
105  external_deps += [ "hilog:libhilog" ]
106
107  innerapi_tags = [ "platformsdk_indirect" ]
108  part_name = "netmanager_base"
109  subsystem_name = "communication"
110}
111