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/static_core/ark_config.gni") 15import("//arkcompiler/runtime_core/static_vm_config.gni") 16import("$ark_root/plugins/plugins.gni") 17 18if (ark_standalone_build) { 19 import("$build_root/ark.gni") 20} else { 21 import("//build/ohos.gni") 22} 23 24abc2program_sources = [ 25 "$target_gen_dir/abc_inst_convert.cpp", 26 "$target_gen_dir/abc_opcode_convert.cpp", 27 "$target_gen_dir/abc_type_convert.cpp", 28 "abc2program_compiler.cpp", 29 "abc2program_driver.cpp", 30 "abc2program_key_data.cpp", 31 "abc2program_log.cpp", 32 "abc2program_options.cpp", 33 "abc_class_processor.cpp", 34 "abc_code_processor.cpp", 35 "abc_field_processor.cpp", 36 "abc_file_entity_processor.cpp", 37 "abc_file_processor.cpp", 38 "abc_file_utils.cpp", 39 "abc_literal_array_processor.cpp", 40 "abc_method_processor.cpp", 41 "abc_string_table.cpp", 42 "common/abc_code_converter.cpp", 43 "program_dump.cpp", 44] 45abc2program_sources += plugin_abc2program_sources 46 47abc2program_configs = [ 48 "$ark_root:ark_config", 49 "$ark_root/libpandabase:arkbase_public_config", 50 "$ark_root/assembler:arkassembler_public_config", 51 "$ark_root/libpandafile:arkfile_public_config", 52] 53 54ohos_shared_library("arkts_abc2program") { 55 deps = [ ":arkts_abc2program_frontend_static" ] 56 57 if (!is_standard_system) { 58 relative_install_dir = "ark" 59 } 60 output_extension = "so" 61 if (is_mingw) { 62 output_extension = "dll" 63 } 64 65 part_name = "runtime_core" 66 subsystem_name = "arkcompiler" 67} 68 69ohos_static_library("arkts_abc2program_frontend_static") { 70 stack_protector_ret = false 71 sources = abc2program_sources 72 73 include_dirs = [ 74 "$ark_root/abc2program", 75 "$target_gen_dir", 76 ] 77 78 configs = abc2program_configs 79 80 deps = [ 81 ":abc2program_plugins_inc", 82 ":abc_type_convert_cpp", 83 ":get_language_specific_metadata_inc", 84 ":isa_gen_abc2program_abc_inst_convert_cpp", 85 ":isa_gen_abc2program_abc_opcode_convert_cpp", 86 "$ark_root/assembler:libarktsassembler_frontend_static", 87 "$ark_root/libpandabase:libarktsbase_frontend_static", 88 "$ark_root/libpandafile:libarktsfile_frontend_static", 89 ] 90 91 part_name = "runtime_core" 92 subsystem_name = "arkcompiler" 93} 94 95ohos_executable("arkts_abc2prog") { 96 sources = [ "abc2prog_main.cpp" ] 97 98 include_dirs = [ 99 "$target_gen_dir", 100 "$root_gen_dir/libpandabase", 101 ] 102 103 configs = [ 104 "$ark_root:ark_config", 105 "$ark_root/assembler:arkassembler_public_config", 106 "$ark_root/libpandabase:arkbase_public_config", 107 "$ark_root/libpandafile:arkfile_public_config", 108 ] 109 110 deps = [ 111 ":arkts_abc2program_frontend_static", 112 "$ark_root/assembler:libarktsassembler_frontend_static", 113 "$ark_root/libpandabase:libarktsbase_frontend_static", 114 "$ark_root/libpandafile:libarktsfile_frontend_static", 115 ] 116 117 libs = platform_libs 118 if (!is_mac && !is_mingw) { 119 ldflags = platform_ldflags 120 } 121 122 install_enable = false 123 part_name = "runtime_core" 124 subsystem_name = "arkcompiler" 125} 126 127ark_isa_gen("isa_gen_abc2program") { 128 template_files = [ 129 "abc_opcode_convert.cpp.erb", 130 "abc_inst_convert.cpp.erb", 131 ] 132 sources = "templates" 133 destination = "$target_gen_dir" 134 requires = [ 135 "$ark_root//assembler/asm_isapi.rb", 136 "$ark_root//libpandafile/pandafile_isapi.rb", 137 ] 138} 139 140ark_gen_file("abc_type_convert_cpp") { 141 template_file = "$ark_root/abc2program/templates/abc_type_convert.cpp.erb" 142 data = [ "$ark_root/libpandafile/types.yaml" ] 143 api = [ "$ark_root/libpandafile/types.rb" ] 144 output_file = "$target_gen_dir/abc_type_convert.cpp" 145} 146 147ark_gen_file("abc2program_plugins_inc") { 148 extra_dependencies = [ "$ark_root:concat_plugins_yamls" ] 149 template_file = "templates/abc2program_plugins.inc.erb" 150 data = [ ark_plugin_options_yaml ] 151 api = [ "$ark_root/templates/plugin_options.rb" ] 152 output_file = "$target_gen_dir/abc2program_plugins.inc" 153} 154 155ark_gen_file("get_language_specific_metadata_inc") { 156 extra_dependencies = [ "$ark_root:concat_plugins_yamls" ] 157 template_file = "templates/get_language_specific_metadata.inc.erb" 158 data = [ ark_plugin_options_yaml ] 159 api = [ "$ark_root/templates/plugin_options.rb" ] 160 output_file = "$target_gen_dir/get_language_specific_metadata.inc" 161} 162