1# Copyright (c) 2024 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/runtime_core/ark_config.gni") 15 16config("abc2program_public_config") { 17 defines = [ "PANDA_WITH_ECMASCRIPT" ] 18} 19 20abc2program_sources = [ 21 "$target_gen_dir/abc_inst_convert.cpp", 22 "$target_gen_dir/abc_opcode_convert.cpp", 23 "$target_gen_dir/abc_type_convert.cpp", 24 "$target_gen_dir/program_dump_utils.cpp", 25 "abc2program_compiler.cpp", 26 "abc2program_driver.cpp", 27 "abc2program_log.cpp", 28 "abc2program_options.cpp", 29 "abc_annotation_processor.cpp", 30 "abc_class_processor.cpp", 31 "abc_code_processor.cpp", 32 "abc_field_processor.cpp", 33 "abc_file_entity_processor.cpp", 34 "abc_literal_array_processor.cpp", 35 "abc_method_processor.cpp", 36 "abc_module_array_processor.cpp", 37 "common/abc2program_entity_container.cpp", 38 "common/abc_code_converter.cpp", 39 "common/abc_file_utils.cpp", 40 "dump_utils.cpp", 41 "program_dump.cpp", 42] 43 44abc2program_configs = [ 45 ":abc2program_public_config", 46 "$ark_root:ark_config", 47 "$ark_root/libpandabase:arkbase_public_config", 48 "$ark_root/assembler:arkassembler_public_config", 49 "$ark_root/libpandafile:arkfile_public_config", 50] 51 52ohos_shared_library("abc2program") { 53 stack_protector_ret = false 54 sources = abc2program_sources 55 56 include_dirs = [ 57 "$ark_root/abc2program", 58 "$target_gen_dir", 59 ] 60 61 configs = abc2program_configs 62 63 deps = [ 64 ":abc_type_convert_cpp", 65 ":isa_gen_abc2program_abc_inst_convert_cpp", 66 ":isa_gen_abc2program_abc_opcode_convert_cpp", 67 ":isa_gen_abc2program_program_dump_utils_cpp", 68 "$ark_root/assembler:libarkassembler", 69 "$ark_root/libpandabase:libarkbase", 70 "$ark_root/libpandafile:libarkfile", 71 ] 72 73 external_deps = [ sdk_libc_secshared_dep ] 74 75 if (!is_standard_system) { 76 relative_install_dir = "ark" 77 } 78 output_extension = "so" 79 if (is_mingw) { 80 output_extension = "dll" 81 } 82 83 part_name = "runtime_core" 84 subsystem_name = "arkcompiler" 85} 86 87ohos_static_library("abc2program_frontend_static") { 88 stack_protector_ret = false 89 sources = abc2program_sources 90 91 include_dirs = [ 92 "$ark_root/abc2program", 93 "$target_gen_dir", 94 ] 95 96 configs = abc2program_configs 97 98 deps = [ 99 ":abc_type_convert_cpp", 100 ":isa_gen_abc2program_abc_inst_convert_cpp", 101 ":isa_gen_abc2program_abc_opcode_convert_cpp", 102 ":isa_gen_abc2program_program_dump_utils_cpp", 103 "$ark_root/assembler:libarkassembler_frontend_static", 104 "$ark_root/libpandabase:libarkbase_frontend_static", 105 "$ark_root/libpandafile:libarkfile_frontend_static", 106 ] 107 if (is_arkui_x) { 108 deps += [ "$ark_third_party_root/bounds_checking_function:libsec_static" ] 109 } else { 110 external_deps = [ "bounds_checking_function:libsec_static" ] 111 } 112 part_name = "runtime_core" 113 subsystem_name = "arkcompiler" 114} 115 116ohos_executable("abc2prog") { 117 sources = [ "abc2prog_main.cpp" ] 118 119 include_dirs = [ 120 "$target_gen_dir", 121 "$root_gen_dir/libpandabase", 122 ] 123 124 configs = [ 125 "$ark_root:ark_config", 126 "$ark_root/assembler:arkassembler_public_config", 127 "$ark_root/libpandabase:arkbase_public_config", 128 "$ark_root/libpandafile:arkfile_public_config", 129 ] 130 131 deps = [ 132 ":abc2program_frontend_static", 133 "$ark_root/assembler:libarkassembler_frontend_static", 134 "$ark_root/libpandabase:libarkbase_frontend_static", 135 "$ark_root/libpandafile:libarkfile_frontend_static", 136 ] 137 138 external_deps = [ sdk_libc_secshared_dep ] 139 140 libs = platform_libs 141 if (!is_mac && !is_mingw) { 142 ldflags = platform_ldflags 143 } 144 145 install_enable = false 146 part_name = "runtime_core" 147 subsystem_name = "arkcompiler" 148} 149 150ark_isa_gen("isa_gen_abc2program") { 151 template_files = [ 152 "abc_opcode_convert.cpp.erb", 153 "abc_inst_convert.cpp.erb", 154 "program_dump_utils.cpp.erb", 155 ] 156 sources = "common" 157 destination = "$target_gen_dir" 158 requires = [ 159 "$ark_root//assembler/asm_isapi.rb", 160 "$ark_root//libpandafile/pandafile_isapi.rb", 161 ] 162} 163 164ark_gen_file("abc_type_convert_cpp") { 165 template_file = "$ark_root/abc2program/common/abc_type_convert.cpp.erb" 166 data_file = "$ark_root/libpandafile/types.yaml" 167 requires = [ "$ark_root/libpandafile/types.rb" ] 168 output_file = "$target_gen_dir/abc_type_convert.cpp" 169} 170