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("ark_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 (target_os == "android") { 46 if (!ark_standalone_build) { 47 defines += [ 48 "ANDROID_PLATFORM", 49 "UNIX_PLATFORM", 50 ] 51 } else { 52 defines += [ "UNIX_PLATFORM" ] 53 } 54 } else if (target_os == "ios") { 55 defines += [ 56 "UNIX_PLATFORM", 57 "IOS_PLATFORM", 58 ] 59 } else if (is_mac) { 60 defines += [ 61 "MAC_PLATFORM", 62 "UNIX_PLATFORM", 63 ] 64 } else { 65 defines += [ "UNIX_PLATFORM" ] 66 } 67} 68 69ohos_source_set("ark_debugger_static") { 70 stack_protector_ret = false 71 deps = [ sdk_libc_secshared_dep ] 72 configs = [ sdk_libc_secshared_config ] 73 defines = [] 74 75 if (is_mingw || is_mac) { 76 cflags = [ "-std=c++17" ] 77 } 78 79 include_dirs = [ 80 "$toolchain_root", 81 "$toolchain_root/websocket", 82 ] 83 84 if (target_os == "android" && !ark_standalone_build) { 85 libs = [ "log" ] 86 } 87 88 deps += [ "../websocket:websocket" ] 89 sources = [ 90 "inspector.cpp", 91 "library_loader.cpp", 92 "log_wrapper.cpp", 93 "ws_server.cpp", 94 ] 95 96 # hiviewdfx libraries 97 external_deps = hiviewdfx_ext_deps 98 deps += hiviewdfx_deps 99 100 configs += [ ":ark_platform_config" ] 101 subsystem_name = "arkcompiler" 102 part_name = "toolchain" 103} 104 105ohos_shared_library("ark_debugger") { 106 stack_protector_ret = false 107 deps = [ ":ark_debugger_static" ] 108 109 if (is_mingw) { 110 ldflags = [ 111 "-lwsock32", 112 "-lws2_32", 113 ] 114 } 115 116 subsystem_name = "arkcompiler" 117 part_name = "toolchain" 118} 119 120ohos_source_set("connectserver_debugger_static") { 121 stack_protector_ret = false 122 deps = [ sdk_libc_secshared_dep ] 123 configs = [ sdk_libc_secshared_config ] 124 defines = [] 125 126 if (is_mingw || is_mac) { 127 if (is_mingw) { 128 lib_dirs = [ "//prebuilts/mingw-w64/ohos/linux-x86_64/clang-mingw/x86_64-w64-mingw32/lib" ] 129 libs = [ "wsock32" ] 130 } 131 132 cflags = [ "-std=c++17" ] 133 } 134 135 include_dirs = [ "$toolchain_root" ] 136 137 deps += [ "../websocket:websocket" ] 138 sources = [ 139 "connect_inspector.cpp", 140 "connect_server.cpp", 141 "log_wrapper.cpp", 142 ] 143 144 if (target_os == "ios") { 145 sources -= [ "log_wrapper.cpp" ] 146 } 147 148 # hiviewdfx libraries 149 external_deps = hiviewdfx_ext_deps 150 deps += hiviewdfx_deps 151 152 configs += [ ":ark_platform_config" ] 153 subsystem_name = "arkcompiler" 154 part_name = "toolchain" 155} 156 157ohos_shared_library("connectserver_debugger") { 158 deps = [ ":connectserver_debugger_static" ] 159 160 subsystem_name = "arkcompiler" 161 part_name = "toolchain" 162} 163