• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2023-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_ext/netmanager_ext_config.gni")
16
17NETMANAGER_EXT_NAPI_ROOT = "$NETMANAGER_EXT_ROOT/frameworks/js/napi/"
18
19ohos_shared_library("vpn") {
20  sanitize = {
21    cfi = true
22    cfi_cross_dso = true
23    debug = false
24  }
25
26  branch_protector_ret = "pac_ret"
27
28  sources = [
29    "src/context/destroy_context.cpp",
30    "src/context/prepare_context.cpp",
31    "src/context/protect_context.cpp",
32    "src/context/setup_context.cpp",
33    "src/vpn_async_work.cpp",
34    "src/vpn_connection.cpp",
35    "src/vpn_exec.cpp",
36    "src/vpn_module.cpp",
37    "src/vpn_monitor.cpp",
38  ]
39
40  include_dirs = [
41    "$EXT_INNERKITS_ROOT/include",
42    "$NETMANAGER_EXT_NAPI_ROOT/vpn/include",
43    "$NETMANAGER_EXT_NAPI_ROOT/vpn/include/context",
44  ]
45
46  cflags = [
47    "-fstack-protector-strong",
48    "-D_FORTIFY_SOURCE=2",
49    "-O2",
50  ]
51
52  cflags_cc = [
53    "-fstack-protector-strong",
54    "-D_FORTIFY_SOURCE=2",
55    "-O2",
56  ]
57
58  if (netmanager_ext_feature_sysvpn) {
59    cflags += sysvpn_flags
60    cflags_cc += sysvpn_flags
61    sources += [
62      "src/context/add_context.cpp",
63      "src/context/delete_context.cpp",
64      "src/context/get_app_info_context.cpp",
65      "src/context/get_connected_context.cpp",
66      "src/context/get_context.cpp",
67      "src/context/get_list_context.cpp",
68      "src/vpn_config_utils.cpp",
69    ]
70  }
71
72  deps = [
73    "$NETMANAGER_EXT_ROOT/interfaces/innerkits/netvpnclient:net_vpn_manager_if",
74  ]
75
76  external_deps = [
77    "c_utils:utils",
78    "hilog:libhilog",
79    "ipc:ipc_core",
80    "napi:ace_napi",
81    "netmanager_base:napi_utils",
82    "netmanager_base:net_conn_manager_if",
83    "netmanager_base:net_manager_common",
84  ]
85
86  relative_install_dir = "module/net"
87  part_name = "netmanager_ext"
88  subsystem_name = "communication"
89}
90