• 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/netstack/netstack_config.gni")
16
17config("networksecurity_napi_config") {
18  include_dirs = [
19    "async_context/include",
20    "async_work/include",
21    "net_ssl_exec/include",
22    "net_ssl_module/include",
23    "$THIRD_PARTY_ROOT/openssl/include",
24    "$NETSTACK_DIR/frameworks/native/net_ssl/include",
25    "$NETSTACK_DIR/interfaces/innerkits/net_ssl/include",
26    "$NETSTACK_DIR/utils/common_utils/include",
27  ]
28
29  if (is_mingw || is_mac) {
30    cflags = [
31      "-std=c++17",
32      "-stdlib=libc++",
33    ]
34  }
35  if (is_mingw) {
36    defines = [ "WINDOWS_PLATFORM" ]
37  } else if (is_mac) {
38    defines = [ "MAC_PLATFORM" ]
39  }
40}
41
42ohos_shared_library("networksecurity_napi") {
43  sanitize = {
44    cfi = true
45    cfi_cross_dso = true
46    debug = false
47  }
48
49  branch_protector_ret = "pac_ret"
50
51  sources = [
52    "async_context/src/cert_context.cpp",
53    "async_context/src/cleartext_context.cpp",
54    "async_work/src/net_ssl_async_work.cpp",
55    "net_ssl_exec/src/net_ssl_exec.cpp",
56    "net_ssl_module/src/net_ssl_module.cpp",
57  ]
58  cflags = [
59    "-fstack-protector-strong",
60    "-D_FORTIFY_SOURCE=2",
61    "-O2",
62  ]
63  cflags_cc = [
64    "-fstack-protector-strong",
65    "-D_FORTIFY_SOURCE=2",
66    "-O2",
67  ]
68
69  configs = [ ":networksecurity_napi_config" ]
70
71  deps = []
72  if (is_mingw || is_mac) {
73    sources +=
74        [ "$NETSTACK_DIR/utils/common_utils/src/netstack_common_utils.cpp" ]
75    deps += [
76      "$ARKUI_ROOT/napi:ace_napi",
77      "$NETSTACK_DIR/utils/napi_utils:napi_utils_static",
78    ]
79  } else {
80    deps += [
81      "$NETSTACK_DIR/interfaces/innerkits/net_ssl:net_ssl",
82      "$NETSTACK_DIR/utils:stack_utils_common",
83      "$NETSTACK_DIR/utils/napi_utils:napi_utils",
84    ]
85    external_deps = [
86      "hilog:libhilog",
87      "napi:ace_napi",
88      "openssl:libcrypto_shared",
89      "openssl:libssl_shared",
90    ]
91  }
92  defines = []
93  if (defined(global_parts_info) &&
94      defined(global_parts_info.communication_netmanager_base) &&
95      global_parts_info.communication_netmanager_base) {
96    external_deps += [ "netmanager_base:net_conn_manager_if" ]
97    defines += [ "HAS_NETMANAGER_BASE=1" ]
98  } else {
99    defines += [ "HAS_NETMANAGER_BASE=0" ]
100  }
101
102  relative_install_dir = "module/net"
103  part_name = "netstack"
104  subsystem_name = "communication"
105}
106