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("hiviewdfx_config") { 17 defines = [] 18 if (enable_dump_in_faultlog) { 19 defines += [ "ENABLE_DUMP_IN_FAULTLOG" ] 20 } 21 if (enable_bytrace) { 22 defines += [ "ENABLE_BYTRACE" ] 23 cflags_cc = [ "-Wno-gnu-zero-variadic-macro-arguments" ] 24 } 25 if (enable_hitrace) { 26 defines += [ "ENABLE_HITRACE" ] 27 } 28 if (enable_hilog) { 29 defines += [ "ENABLE_HILOG" ] 30 } 31 32 include_dirs = [ "$hilog_root/include" ] 33} 34 35config("websocket_platform_config") { 36 configs = [ ":hiviewdfx_config" ] 37 defines = [] 38 if (is_ohos) { 39 defines += [ 40 "OHOS_PLATFORM", 41 "UNIX_PLATFORM", 42 ] 43 } else if (is_mingw) { 44 defines += [ "WINDOWS_PLATFORM" ] 45 } else if (is_mac) { 46 defines += [ 47 "MAC_PLATFORM", 48 "UNIX_PLATFORM", 49 ] 50 } else if (target_os == "android") { 51 if (!ark_standalone_build) { 52 defines += [ 53 "ANDROID_PLATFORM", 54 "UNIX_PLATFORM", 55 ] 56 } else { 57 defines += [ "UNIX_PLATFORM" ] 58 } 59 } else if (target_os == "ios") { 60 defines += [ 61 "UNIX_PLATFORM", 62 "IOS_PLATFORM", 63 ] 64 } else { 65 defines += [ "UNIX_PLATFORM" ] 66 } 67 68 if (current_cpu == "arm") { 69 defines += [ 70 "PANDA_TARGET_ARM32_ABI_SOFT=1", 71 "PANDA_TARGET_ARM32", 72 "PANDA_TARGET_32", 73 ] 74 } else if (current_cpu == "arm64") { 75 defines += [ 76 "PANDA_TARGET_ARM64", 77 "PANDA_TARGET_64", 78 "PANDA_ENABLE_GLOBAL_REGISTER_VARIABLES", 79 "PANDA_USE_32_BIT_POINTER", 80 ] 81 } else if (current_cpu == "x86") { 82 defines += [ "PANDA_TARGET_X86" ] 83 } else if (current_cpu == "amd64" || current_cpu == "x64" || 84 current_cpu == "x86_64") { 85 defines += [ 86 "PANDA_TARGET_64", 87 "PANDA_TARGET_AMD64", 88 "PANDA_USE_32_BIT_POINTER", 89 ] 90 } 91} 92 93ohos_source_set("websocket") { 94 stack_protector_ret = false 95 defines = [] 96 deps = [] 97 98 configs = [ sdk_libc_secshared_config ] 99 if (is_mingw || is_mac) { 100 cflags = [ "-std=c++17" ] 101 } 102 103 # hiviewdfx libraries 104 external_deps = hiviewdfx_ext_deps 105 deps += hiviewdfx_deps 106 107 if (target_os == "android" && !ark_standalone_build) { 108 libs = [ "log" ] 109 } 110 111 include_dirs = [] 112 113 include_dirs += [ 114 "$toolchain_root/inspector", 115 "//utils/native/base/include", 116 "//third_party/openssl/include", 117 ] 118 119 sources = [ "websocket.cpp" ] 120 121 deps += [ sdk_libc_secshared_dep ] 122 if (is_arkui_x && target_os == "ios") { 123 deps += [ "$ark_third_party_root/openssl:libcrypto_static" ] 124 } else if (is_mingw) { 125 deps += [ "$ark_third_party_root/openssl:libcrypto_restool" ] 126 } else { 127 deps += [ "$ark_third_party_root/openssl:libcrypto_shared" ] 128 } 129 130 configs += [ ":websocket_platform_config" ] 131 132 subsystem_name = "arkcompiler" 133 part_name = "toolchain" 134} 135