• 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("websocket_client_config") {
18  # header file path
19  include_dirs =
20      [ "$NETSTACK_DIR/interfaces/innerkits/websocket_client/include" ]
21
22  cflags = []
23  if (is_double_framework) {
24    cflags += [ "-DCONFIG_DUAL_FRAMEWORK" ]
25  }
26  if (target_cpu == "arm") {
27    cflags += [ "-DBINDER_IPC_32BIT" ]
28  }
29  if (is_standard_system) {
30    cflags += [ "-DCONFIG_STANDARD_SYSTEM" ]
31  }
32  if (defined(build_public_version) && build_public_version) {
33    cflags += [ "-DBUILD_PUBLIC_VERSION" ]
34  }
35
36  if (is_mingw) {
37    defines = [ "WINDOWS_PLATFORM" ]
38  } else if (is_mac) {
39    defines = [ "MAC_PLATFORM" ]
40  }
41}
42
43ohos_shared_library("websocket_client") {
44  sanitize = {
45    cfi = true
46    cfi_cross_dso = true
47    debug = false
48  }
49
50  branch_protector_ret = "pac_ret"
51
52  sources = [ "$NETSTACK_NATIVE_ROOT/websocket_client/websocket_client.cpp" ]
53
54  include_dirs = [
55    "$NETSTACK_DIR/utils/common_utils/include",
56    "$NETSTACK_DIR/utils/log/include",
57    "$NETSTACK_NATIVE_ROOT/websocket_client/include",
58  ]
59
60  cflags = [
61    "-fstack-protector-strong",
62    "-D_FORTIFY_SOURCE=2",
63    "-O2",
64  ]
65  cflags_cc = [
66    "-fstack-protector-strong",
67    "-D_FORTIFY_SOURCE=2",
68    "-O2",
69  ]
70
71  version_script = "libwebsocket_client.map"
72
73  public_configs = [ ":websocket_client_config" ]
74
75  defines = [ "OHOS_LIBWEBSOCKETS=1" ]
76
77  deps = [
78    "$NETSTACK_DIR/utils:stack_utils_common",
79    "$NETSTACK_DIR/utils/napi_utils:napi_utils",
80  ]
81
82  external_deps = [ "openssl:libssl_shared" ]
83
84  public_external_deps = [ "libwebsockets:websockets" ]
85
86  if (is_mingw || is_mac) {
87    sources +=
88        [ "$NETSTACK_DIR/utils/common_utils/src/netstack_common_utils.cpp" ]
89  } else {
90    deps += [ "$NETSTACK_DIR/utils:stack_utils_common" ]
91    external_deps += [ "hilog:libhilog" ]
92    if (product_name != "ohos-sdk") {
93      external_deps += [ "init:libbegetutil" ]
94    }
95  }
96
97  innerapi_tags = [ "platformsdk" ]
98  part_name = "netstack"
99  subsystem_name = "communication"
100}
101