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_config") { 17 defines = [] 18 19 include_dirs = [ 20 "$toolchain_root/inspector", 21 "//third_party/openssl/include", 22 ] 23 24 if (is_mingw || is_mac) { 25 cflags = [ "-std=c++17" ] 26 } 27 28 cflags_cc = [ "-Wno-vla-extension" ] 29} 30 31websocket_configs = [ 32 sdk_libc_secshared_config, 33 "..:ark_toolchain_common_config", 34 ":websocket_config", 35] 36 37websocket_deps = [ sdk_libc_secshared_dep ] 38if (is_arkui_x && target_os == "ios") { 39 websocket_deps += [ "$ark_third_party_root/openssl:libcrypto_static" ] 40} else if (is_mingw) { 41 websocket_deps += [ "$ark_third_party_root/openssl:libcrypto_restool" ] 42} else { 43 websocket_deps += [ "$ark_third_party_root/openssl:libcrypto_shared" ] 44} 45 46# hiviewdfx libraries 47websocket_ext_deps = hiviewdfx_ext_deps 48 49ohos_source_set("websocket_base") { 50 stack_protector_ret = false 51 52 configs = websocket_configs 53 54 external_deps = websocket_ext_deps 55 deps = websocket_deps 56 57 if (target_os == "android" && !ark_standalone_build) { 58 libs = [ "log" ] 59 } 60 61 sources = [ 62 "frame_builder.cpp", 63 "handshake_helper.cpp", 64 "http.cpp", 65 "network.cpp", 66 "websocket_base.cpp", 67 ] 68 69 subsystem_name = "arkcompiler" 70 part_name = "toolchain" 71} 72 73ohos_source_set("websocket_server") { 74 stack_protector_ret = false 75 76 configs = websocket_configs 77 78 external_deps = websocket_ext_deps 79 deps = websocket_deps 80 deps += [ ":websocket_base" ] 81 82 if (target_os == "android" && !ark_standalone_build) { 83 libs = [ "log" ] 84 } 85 86 sources = [ "server/websocket_server.cpp" ] 87 88 subsystem_name = "arkcompiler" 89 part_name = "toolchain" 90} 91 92ohos_source_set("websocket_client") { 93 stack_protector_ret = false 94 95 configs = websocket_configs 96 97 external_deps = websocket_ext_deps 98 deps = websocket_deps 99 deps += [ ":websocket_base" ] 100 101 if (target_os == "android" && !ark_standalone_build) { 102 libs = [ "log" ] 103 } 104 105 sources = [ "client/websocket_client.cpp" ] 106 107 subsystem_name = "arkcompiler" 108 part_name = "toolchain" 109} 110