• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2022 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("//arkcompiler/toolchain/toolchain.gni")
15
16config("websocket_private_config") {
17  defines = []
18
19  if (is_mingw || is_mac) {
20    cflags = [ "-std=c++17" ]
21  }
22
23  cflags_cc = [ "-Wno-vla-extension" ]
24}
25
26websocket_configs = [
27  "..:ark_toolchain_common_config",
28  ":websocket_private_config",
29]
30
31websocket_deps = []
32
33# hiviewdfx libraries
34websocket_ext_deps = hiviewdfx_ext_deps
35
36if (is_arkui_x && target_os == "ios") {
37  websocket_ext_deps += [ "openssl:libcrypto_static" ]
38} else if (is_mingw) {
39  websocket_ext_deps += [ "openssl:libcrypto_restool" ]
40} else {
41  websocket_ext_deps += [ "openssl:libcrypto_shared" ]
42}
43
44websocket_ext_deps += [ "bounds_checking_function:libsec_shared" ]
45
46websocket_base_source = toolchain_platform_source + [
47                          "frame_builder.cpp",
48                          "handshake_helper.cpp",
49                          "http.cpp",
50                          "network.cpp",
51                          "websocket_base.cpp",
52                        ]
53
54ohos_source_set("websocket_base") {
55  stack_protector_ret = true
56
57  configs = websocket_configs
58
59  external_deps = websocket_ext_deps
60  deps = websocket_deps
61
62  if (target_os == "android" && !ark_standalone_build) {
63    libs = [ "log" ]
64  }
65
66  sources = websocket_base_source
67
68  subsystem_name = "arkcompiler"
69  part_name = "toolchain"
70}
71
72config("websocket_public_config") {
73  visibility = [ ":*" ]
74  include_dirs = [ "$toolchain_root/websocket" ]
75}
76
77websocket_server_source =
78    websocket_base_source + [ "server/websocket_server.cpp" ]
79
80ohos_static_library("libwebsocket_server") {
81  stack_protector_ret = true
82
83  configs = websocket_configs
84  public_configs = [ ":websocket_public_config" ]
85
86  external_deps = websocket_ext_deps
87  deps = websocket_deps
88
89  if (target_os == "android" && !ark_standalone_build) {
90    libs = [ "log" ]
91  }
92
93  sources = websocket_server_source
94  subsystem_name = "arkcompiler"
95  part_name = "toolchain"
96}
97
98ohos_source_set("websocket_client") {
99  stack_protector_ret = true
100
101  configs = websocket_configs
102  public_configs = [ ":websocket_public_config" ]
103
104  external_deps = websocket_ext_deps
105  deps = websocket_deps
106  deps += [ ":websocket_base" ]
107
108  if (target_os == "android" && !ark_standalone_build) {
109    libs = [ "log" ]
110  }
111
112  sources = [ "client/websocket_client.cpp" ]
113
114  subsystem_name = "arkcompiler"
115  part_name = "toolchain"
116}
117