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 ] 70 71 external_deps = [ sdk_libc_secshared_dep ] 72 if (enable_hilog && defined(ohos_indep_compiler_enable) && 73 ohos_indep_compiler_enable) { 74 external_deps += [ "hilog:libhilog" ] 75 } 76 77 if (!is_standard_system) { 78 relative_install_dir = "ark" 79 } 80 output_extension = "so" 81 if (is_mingw) { 82 output_extension = "dll" 83 } 84 cflags = [ "-Wno-c++20-designator" ] 85 86 part_name = "runtime_core" 87 subsystem_name = "arkcompiler" 88} 89 90ohos_static_library("abc2program_frontend_static") { 91 stack_protector_ret = false 92 sources = abc2program_sources 93 94 include_dirs = [ 95 "$ark_root/abc2program", 96 "$target_gen_dir", 97 ] 98 99 configs = abc2program_configs 100 101 deps = [ 102 ":abc_type_convert_cpp", 103 ":isa_gen_abc2program_abc_inst_convert_cpp", 104 ":isa_gen_abc2program_abc_opcode_convert_cpp", 105 ":isa_gen_abc2program_program_dump_utils_cpp", 106 "$ark_root/assembler:libarkassembler_frontend_static", 107 "$ark_root/libpandabase:libarkbase_frontend_static", 108 "$ark_root/libpandafile:libarkfile_frontend_static", 109 ] 110 if (is_arkui_x) { 111 deps += [ "$ark_third_party_root/bounds_checking_function:libsec_static" ] 112 } else { 113 external_deps = [ "bounds_checking_function:libsec_static" ] 114 if (enable_hilog && defined(ohos_indep_compiler_enable) && 115 ohos_indep_compiler_enable) { 116 external_deps += [ "hilog:libhilog" ] 117 } 118 } 119 cflags = [ "-Wno-c++20-designator" ] 120 121 part_name = "runtime_core" 122 subsystem_name = "arkcompiler" 123} 124 125ohos_executable("abc2prog") { 126 sources = [ "abc2prog_main.cpp" ] 127 128 include_dirs = [ 129 "$target_gen_dir", 130 "$root_gen_dir/libpandabase", 131 ] 132 133 configs = [ 134 "$ark_root:ark_config", 135 "$ark_root/assembler:arkassembler_public_config", 136 "$ark_root/libpandabase:arkbase_public_config", 137 "$ark_root/libpandafile:arkfile_public_config", 138 ] 139 140 deps = [ 141 ":abc2program_frontend_static", 142 "$ark_root/assembler:libarkassembler_frontend_static", 143 "$ark_root/libpandabase:libarkbase_frontend_static", 144 "$ark_root/libpandafile:libarkfile_frontend_static", 145 ] 146 147 external_deps = [ sdk_libc_secshared_dep ] 148 149 libs = platform_libs 150 if (!is_mac && !is_mingw) { 151 ldflags = platform_ldflags 152 } 153 154 install_enable = false 155 part_name = "runtime_core" 156 subsystem_name = "arkcompiler" 157} 158 159ark_isa_gen("isa_gen_abc2program") { 160 template_files = [ 161 "abc_opcode_convert.cpp.erb", 162 "abc_inst_convert.cpp.erb", 163 "program_dump_utils.cpp.erb", 164 ] 165 sources = "common" 166 destination = "$target_gen_dir" 167 requires = [ 168 "$ark_root//assembler/asm_isapi.rb", 169 "$ark_root//libpandafile/pandafile_isapi.rb", 170 ] 171} 172 173ark_gen_file("abc_type_convert_cpp") { 174 template_file = "$ark_root/abc2program/common/abc_type_convert.cpp.erb" 175 data_file = "$ark_root/libpandafile/types.yaml" 176 requires = [ "$ark_root/libpandafile/types.rb" ] 177 output_file = "$target_gen_dir/abc_type_convert.cpp" 178} 179