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("//arkcompiler/ets_runtime/js_runtime_config.gni") 15import("//build/ohos.gni") 16 17is_cross_platform_build = 18 defined(build_cross_platform_version) && build_cross_platform_version 19 20config("ark_ecma_debugger_config") { 21 configs = [ 22 "//arkcompiler/ets_runtime:ark_jsruntime_common_config", 23 "//arkcompiler/ets_runtime:ark_jsruntime_public_config", 24 ] 25 26 include_dirs = [ 27 ".", 28 "//third_party/cJSON", 29 ] 30} 31 32debugger_sources = [ 33 "agent/debugger_impl.cpp", 34 "agent/runtime_impl.cpp", 35 "agent/tracing_impl.cpp", 36 "backend/debugger_executor.cpp", 37 "backend/js_pt_hooks.cpp", 38 "backend/js_single_stepper.cpp", 39 "base/pt_base64.cpp", 40 "base/pt_events.cpp", 41 "base/pt_json.cpp", 42 "base/pt_params.cpp", 43 "base/pt_returns.cpp", 44 "base/pt_script.cpp", 45 "base/pt_types.cpp", 46 "debugger_service.cpp", 47 "dispatcher.cpp", 48 "protocol_handler.cpp", 49] 50if (!is_mingw && !is_mac && target_os != "ios") { 51 debugger_sources += [ 52 "agent/heapprofiler_impl.cpp", 53 "agent/profiler_impl.cpp", 54 ] 55} 56 57source_set("libark_ecma_debugger_set") { 58 sources = debugger_sources 59 60 public_configs = [ ":ark_ecma_debugger_config" ] 61 62 deps = [ 63 "$ark_root/libpandafile:arkfile_header_deps", 64 "//third_party/libuv:uv", 65 ] 66 67 if (is_cross_platform_build) { 68 deps += [ "//third_party/cJSON:cjson_static" ] 69 } else { 70 deps += [ "//third_party/cJSON:cjson" ] 71 } 72 73 if (is_mingw || is_mac) { 74 if (is_mingw) { 75 platform = "windows" 76 } else { 77 platform = "mac" 78 } 79 deps += [ 80 "$ark_root/libpandafile:libarkfile_static", 81 "//base/hiviewdfx/hilog/interfaces/native/innerkits:libhilog_$platform", 82 ] 83 defines = [ "ENABLE_HILOG" ] 84 } 85 86 if (is_ohos && is_standard_system) { 87 if (enable_hilog) { 88 defines = [ "ENABLE_HILOG" ] 89 include_dirs = 90 [ "//base/hiviewdfx/hilog/interfaces/native/innerkits/include" ] 91 } 92 if (enable_leak_check) { 93 sources += [ "$js_root/ecmascript/dfx/native_dfx/backtrace.cpp" ] 94 defines += [ 95 "ECMASCRIPT_ENABLE_HANDLE_LEAK_CHECK", 96 "ECMASCRIPT_ENABLE_GLOBAL_LEAK_CHECK", 97 ] 98 } 99 } 100 101 cflags_cc = [ "-fvisibility=hidden" ] 102} 103 104ohos_shared_library("libark_ecma_debugger") { 105 deps = [ 106 ":libark_ecma_debugger_set", 107 "//arkcompiler/ets_runtime:libark_jsruntime", 108 "//third_party/libuv:uv", 109 ] 110 111 install_enable = true 112 113 if (is_ohos && is_standard_system) { 114 if (enable_hilog) { 115 external_deps = [ "hiviewdfx_hilog_native:libhilog" ] 116 } 117 } 118 119 if (!is_mingw && !is_mac) { 120 output_extension = "so" 121 } 122 123 if (!is_standard_system) { 124 relative_install_dir = "ark" 125 } 126 part_name = "toolchain" 127 subsystem_name = "arkcompiler" 128} 129 130source_set("libark_ecma_debugger_test_set") { 131 sources = debugger_sources 132 133 public_configs = [ ":ark_ecma_debugger_config" ] 134 135 defines = [ "DEBUGGER_TEST" ] 136 137 if (is_ohos && is_standard_system) { 138 if (enable_hilog) { 139 defines += [ "ENABLE_HILOG" ] 140 include_dirs = 141 [ "//base/hiviewdfx/hilog/interfaces/native/innerkits/include" ] 142 } 143 } 144 145 deps = [ 146 "$ark_root/libpandafile:arkfile_header_deps", 147 "//third_party/libuv:uv", 148 ] 149 150 if (is_cross_platform_build) { 151 deps += [ "//third_party/cJSON:cjson_static" ] 152 } else { 153 deps += [ "//third_party/cJSON:cjson" ] 154 } 155} 156 157ohos_shared_library("libark_ecma_debugger_test") { 158 deps = [ 159 ":libark_ecma_debugger_test_set", 160 "//arkcompiler/ets_runtime:libark_jsruntime_test", 161 "//third_party/libuv:uv", 162 ] 163 164 if (is_ohos && is_standard_system) { 165 if (enable_hilog) { 166 external_deps = [ "hiviewdfx_hilog_native:libhilog" ] 167 } 168 } 169 170 public_configs = [ ":ark_ecma_debugger_config" ] 171 172 install_enable = false 173 174 output_extension = "so" 175 subsystem_name = "test" 176} 177