1# Copyright (c) 2025 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 17ohos_shared_library("cj_net_websocket_ffi") { 18 sanitize = { 19 cfi = true 20 cfi_cross_dso = true 21 debug = false 22 } 23 24 branch_protector_ret = "pac_ret" 25 26 include_dirs = [ 27 "include", 28 "$NETSTACK_DIR/utils/common_utils/include", 29 ] 30 31 sources = [ 32 "src/net_websocket_base_context.cpp", 33 "src/net_websocket_close_context.cpp", 34 "src/net_websocket_connect_context.cpp", 35 "src/net_websocket_exec.cpp", 36 "src/net_websocket_ffi.cpp", 37 "src/net_websocket_impl.cpp", 38 "src/net_websocket_send_context.cpp", 39 "src/net_websocket_utils.cpp", 40 ] 41 42 defines = [ "OHOS_LIBWEBSOCKETS=1" ] 43 44 cflags = [ 45 "-fstack-protector-strong", 46 "-D_FORTIFY_SOURCE=2", 47 "-O2", 48 ] 49 50 cflags_cc = [ 51 "-fstack-protector-strong", 52 "-D_FORTIFY_SOURCE=2", 53 "-O2", 54 ] 55 56 deps = [ "$NETSTACK_DIR/utils/napi_utils:napi_utils" ] 57 58 external_deps = [ 59 "hilog:libhilog", 60 "libwebsockets:websockets", 61 "napi:ace_napi", 62 "napi:cj_bind_ffi", 63 "napi:cj_bind_native", 64 "openssl:libcrypto_shared", 65 "openssl:libssl_shared", 66 "samgr:samgr_proxy", 67 ] 68 69 if (defined(global_parts_info) && 70 defined(global_parts_info.communication_netmanager_base) && 71 global_parts_info.communication_netmanager_base) { 72 external_deps += [ 73 "netmanager_base:net_conn_manager_if", 74 "netmanager_base:net_security_config_if", 75 ] 76 defines += [ "HAS_NETMANAGER_BASE=1" ] 77 } else { 78 defines += [ "HAS_NETMANAGER_BASE=0" ] 79 } 80 81 innerapi_tags = [ "platformsdk" ] 82 part_name = "netstack" 83 subsystem_name = "communication" 84} 85