xref: /arkcompiler/toolchain/websocket/BUILD.gn (revision e509ee18)
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
46ohos_source_set("websocket_base") {
47  stack_protector_ret = false
48
49  configs = websocket_configs
50
51  external_deps = websocket_ext_deps
52  deps = websocket_deps
53
54  if (target_os == "android" && !ark_standalone_build) {
55    libs = [ "log" ]
56  }
57
58  sources = [
59    "frame_builder.cpp",
60    "handshake_helper.cpp",
61    "http.cpp",
62    "network.cpp",
63    "websocket_base.cpp",
64  ]
65
66  subsystem_name = "arkcompiler"
67  part_name = "toolchain"
68}
69
70config("websocket_public_config") {
71  visibility = [ ":*" ]
72  include_dirs = [ "$toolchain_root/websocket" ]
73}
74
75ohos_source_set("websocket_server") {
76  stack_protector_ret = false
77
78  configs = websocket_configs
79  public_configs = [ ":websocket_public_config" ]
80
81  external_deps = websocket_ext_deps
82  deps = websocket_deps
83  deps += [ ":websocket_base" ]
84
85  if (target_os == "android" && !ark_standalone_build) {
86    libs = [ "log" ]
87  }
88
89  sources = [ "server/websocket_server.cpp" ]
90
91  subsystem_name = "arkcompiler"
92  part_name = "toolchain"
93}
94
95# required for runtime_core ArkTS inspector
96ohos_static_library("libwebsocket_server") {
97  stack_protector_ret = false
98
99  public_configs = [ ":websocket_public_config" ]
100
101  deps = [ ":websocket_server" ]
102  external_deps = [
103    "bounds_checking_function:libsec_shared",
104    "openssl:libcrypto_shared",
105  ]
106  subsystem_name = "arkcompiler"
107  part_name = "toolchain"
108}
109
110ohos_source_set("websocket_client") {
111  stack_protector_ret = false
112
113  configs = websocket_configs
114  public_configs = [ ":websocket_public_config" ]
115
116  external_deps = websocket_ext_deps
117  deps = websocket_deps
118  deps += [ ":websocket_base" ]
119
120  if (target_os == "android" && !ark_standalone_build) {
121    libs = [ "log" ]
122  }
123
124  sources = [ "client/websocket_client.cpp" ]
125
126  subsystem_name = "arkcompiler"
127  part_name = "toolchain"
128}
129