1# Copyright (c) 2021-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("../toolchain.gni") 15 16config("ark_ecma_debugger_config") { 17 configs = [ "..:ark_toolchain_common_config" ] 18 19 include_dirs = [ "." ] 20} 21 22debugger_sources = [ 23 "../common/log_wrapper.cpp", 24 "agent/animation_impl.cpp", 25 "agent/css_impl.cpp", 26 "agent/debugger_impl.cpp", 27 "agent/dom_impl.cpp", 28 "agent/overlay_impl.cpp", 29 "agent/page_impl.cpp", 30 "agent/runtime_impl.cpp", 31 "agent/target_impl.cpp", 32 "agent/tracing_impl.cpp", 33 "backend/debugger_executor.cpp", 34 "backend/js_pt_hooks.cpp", 35 "backend/js_single_stepper.cpp", 36 "base/pt_base64.cpp", 37 "base/pt_events.cpp", 38 "base/pt_json.cpp", 39 "base/pt_params.cpp", 40 "base/pt_returns.cpp", 41 "base/pt_script.cpp", 42 "base/pt_types.cpp", 43 "debugger_service.cpp", 44 "dispatcher.cpp", 45 "protocol_handler.cpp", 46 "utils/utils.cpp", 47] 48if (!is_mingw && !is_mac && target_os != "ios") { 49 debugger_sources += [ 50 "agent/heapprofiler_impl.cpp", 51 "agent/profiler_impl.cpp", 52 ] 53} 54 55ohos_source_set("libark_ecma_debugger_set") { 56 stack_protector_ret = true 57 sources = debugger_sources 58 59 public_configs = [ ":ark_ecma_debugger_config" ] 60 61 defines = [] 62 deps = [] 63 external_deps = [ "ets_runtime:libark_jsruntime" ] 64 if (is_arkui_x && target_os == "ios") { 65 sources -= [ "../common/log_wrapper.cpp" ] 66 external_deps += [ "cJSON:cjson_static" ] 67 } else { 68 external_deps += [ "cJSON:cjson" ] 69 } 70 external_deps += [ 71 "icu:shared_icuuc", 72 "libuv:uv", 73 ] 74 75 if (is_ohos && is_standard_system && !is_arkui_x) { 76 defines += [ "ENABLE_FFRT_INTERFACES" ] 77 external_deps += [ "ffrt:libffrt" ] 78 } 79 80 # hiviewdfx libraries 81 external_deps += hiviewdfx_ext_deps 82 83 external_deps += [ "runtime_core:libarkfile_static" ] 84 deps += hiviewdfx_deps 85 86 if (enable_leak_check) { 87 sources += [ "$js_root/ecmascript/dfx/native_dfx/backtrace.cpp" ] 88 defines += [ 89 "ECMASCRIPT_ENABLE_HANDLE_LEAK_CHECK", 90 "ECMASCRIPT_ENABLE_GLOBAL_LEAK_CHECK", 91 ] 92 } 93 94 cflags_cc = [ "-fvisibility=hidden" ] 95 subsystem_name = "arkcompiler" 96 part_name = "toolchain" 97} 98 99ohos_shared_library("libark_ecma_debugger") { 100 stack_protector_ret = true 101 deps = [ ":libark_ecma_debugger_set" ] 102 external_deps = [ "libuv:uv" ] 103 if (is_mac) { 104 external_deps += [ "cJSON:cjson_static" ] 105 } 106 107 install_enable = true 108 109 # hiviewdfx libraries 110 external_deps += hiviewdfx_ext_deps 111 if (enable_hilog) { 112 external_deps += [ "hilog:libhilog" ] 113 } 114 if (!is_arkui_x) { 115 external_deps += [ "ets_runtime:libark_jsruntime" ] 116 } else { 117 deps += [ "../../ets_runtime:libark_jsruntime" ] 118 } 119 deps += hiviewdfx_deps 120 121 if (!is_mingw && !is_mac) { 122 output_extension = "so" 123 } 124 125 if (!is_standard_system) { 126 relative_install_dir = "ark" 127 } 128 subsystem_name = "arkcompiler" 129 part_name = "toolchain" 130 output_name = "libark_tooling" 131} 132 133ohos_static_library("libark_ecma_debugger_test") { 134 testonly = true 135 stack_protector_ret = true 136 sources = debugger_sources 137 138 public_configs = [ ":ark_ecma_debugger_config" ] 139 140 defines = [ "OHOS_UNIT_TEST" ] 141 deps = [] 142 external_deps = [ 143 "ets_runtime:libark_jsruntime", 144 "icu:shared_icuuc", 145 "libuv:uv", 146 ] 147 if ((is_arkui_x && target_os == "ios") || target_os == "mac") { 148 external_deps += [ "cJSON:cjson_static" ] 149 } else { 150 external_deps += [ "cJSON:cjson" ] 151 } 152 153 # hiviewdfx libraries 154 external_deps += hiviewdfx_ext_deps 155 deps += hiviewdfx_deps 156 if (enable_hilog) { 157 external_deps += [ "hilog:libhilog" ] 158 } 159 160 if (!is_mingw && !is_mac) { 161 output_extension = "so" 162 } 163 subsystem_name = "test" 164} 165