1# Copyright (c) 2021-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("../../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 += [ "ets_runtime:libark_jsruntime" ] 71 external_deps += [ 72 "icu:shared_icuuc", 73 "libuv:uv", 74 sdk_libc_secshared_dep 75 ] 76 77 if (is_ohos && is_standard_system && !is_arkui_x) { 78 defines += [ "ENABLE_FFRT_INTERFACES" ] 79 external_deps += [ "ffrt:libffrt" ] 80 } 81 82 # hiviewdfx libraries 83 external_deps += hiviewdfx_ext_deps 84 85 external_deps += [ "runtime_core:libarkfile_static" ] 86 deps += hiviewdfx_deps 87 deps += [ "../hybrid_step:arkhybridstep" ] 88 89 if (enable_leak_check) { 90 sources += [ "$js_root/ecmascript/dfx/native_dfx/backtrace.cpp" ] 91 defines += [ 92 "ECMASCRIPT_ENABLE_HANDLE_LEAK_CHECK", 93 "ECMASCRIPT_ENABLE_GLOBAL_LEAK_CHECK", 94 ] 95 } 96 97 cflags_cc = [ "-fvisibility=hidden" ] 98 subsystem_name = "arkcompiler" 99 part_name = "toolchain" 100} 101 102ohos_static_library("libark_ecma_debugger_static") { 103 deps = [ ":libark_ecma_debugger_set" ] 104 external_deps = [ "libuv:uv" ] 105 if (is_mac) { 106 external_deps += [ "cJSON:cjson_static" ] 107 } 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 && !ark_standalone_build) { 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 "icu:shared_icuuc", 144 "libuv:uv", 145 ] 146 external_deps += [ "ets_runtime:libark_jsruntime" ] 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 += [ "../hybrid_step:arkhybridstep" ] 156 deps += hiviewdfx_deps 157 if (enable_hilog) { 158 external_deps += [ "hilog:libhilog" ] 159 } 160 161 if (!is_mingw && !is_mac) { 162 output_extension = "so" 163 } 164 subsystem_name = "test" 165} 166