# Copyright (c) 2021-2024 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # http://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. import("//arkcompiler/runtime_core/static_core/ark_config.gni") import("//arkcompiler/runtime_core/static_vm_config.gni") import("$ark_root/plugins/plugins.gni") if (ark_standalone_build) { import("$build_root/ark.gni") } else { import("//build/ohos.gni") } ohos_static_library("libarktsassembler_package") { deps = [] if (enable_static_vm) { deps += [ ":libarktsassembler_frontend_static" ] } part_name = ark_part_name subsystem_name = "$ark_subsystem_name" } config("arkassembler_public_config") { include_dirs = [ "$ark_root/assembler", "$target_gen_dir", "$target_gen_dir/include", "$ark_root_gen_dir", "$ark_root", ] configs = [ "$ark_root/runtime:profiling_gen_public_config" ] } if (!ark_static_standalone_build) { ohos_shared_headers("assembler_headers") { include_dirs = [ "$ark_root/assembler", "$target_gen_dir", "$target_gen_dir/include", "$ark_root_gen_dir", "$ark_root", ] part_name = ark_part_name subsystem_name = "$ark_subsystem_name" } } libarkassembler_sources = [ "$target_gen_dir/ins_to_string.cpp", "annotation.cpp", "assembly-emitter.cpp", "assembly-ins.cpp", "assembly-parser.cpp", "assembly-program.cpp", "assembly-type.cpp", "context.cpp", "extensions/extensions.cpp", "lexer.cpp", "meta.cpp", "utils/number-utils.cpp", ] libarkassembler_sources += plugin_libarkassembler_sources libarkassembler_configs = [ "$ark_root:ark_config", ":arkassembler_public_config", "$ark_root/runtime:arkruntime_public_config", "$ark_root/libpandabase:arkbase_public_config", "$ark_root/libpandafile:arkfile_public_config", "$ark_root/compiler:arkcompiler_public_config", ] libarkassembler_configs += plugin_libarkassembler_configs group("arktsassembler_header_deps") { deps = [ ":ark_asm_meta_gen_h", ":ark_asm_register_extensions_h", ":isa_gen_libarkassembler_ins_create_api_h", ":isa_gen_libarkassembler_ins_emit_h", ":isa_gen_libarkassembler_isa_h", ":isa_gen_libarkassembler_opcode_parsing_h", ":isa_gen_libarkassembler_operand_types_print_h", ] } ohos_source_set("libarktsassembler_static") { sources = libarkassembler_sources public_configs = libarkassembler_configs deps = [ ":arktsassembler_header_deps", ":isa_gen_libarkassembler_ins_to_string_cpp", "$ark_root/compiler:libarktscompiler", "$ark_root/libpandabase:libarktsbase", "$ark_root/libpandafile:libarktsfile", "$ark_root/runtime:profiling_gen_profiling_gen_h", ] deps += plugin_assembler_deps external_deps = [ sdk_libc_secshared_dep ] part_name = ark_part_name subsystem_name = "$ark_subsystem_name" } ohos_shared_library("libarktsassembler") { deps = [ ":libarktsassembler_static" ] if (is_mingw || is_win) { output_extension = "dll" } else { output_extension = "so" } part_name = ark_part_name subsystem_name = "$ark_subsystem_name" } ohos_source_set("libarktsassembler_frontend_set_static") { sources = libarkassembler_sources public_configs = libarkassembler_configs deps = [ ":arktsassembler_header_deps", ":isa_gen_libarkassembler_ins_to_string_cpp", "$ark_root/libpandafile:libarktsfile_frontend_static", "$ark_root/runtime:profiling_gen_profiling_gen_h", ] deps += plugin_assembler_deps external_deps = [ sdk_libc_secshared_dep ] part_name = ark_part_name subsystem_name = "$ark_subsystem_name" } ohos_static_library("libarktsassembler_frontend_static") { deps = [ ":libarktsassembler_frontend_set_static" ] part_name = ark_part_name subsystem_name = "$ark_subsystem_name" } ohos_source_set("arkts_asm_static") { sources = [ "pandasm.cpp" ] include_dirs = [ "$target_gen_dir" ] public_configs = [ ":arkassembler_public_config", "$ark_root:ark_config", "$ark_root/libpandabase:arkbase_public_config", "$ark_root/libpandafile:arkfile_public_config", "$ark_root/compiler:arkcompiler_public_config", "$ark_root/runtime:arkruntime_public_config", ] deps = [ ":libarktsassembler_frontend_static", "$ark_root/bytecode_optimizer:libarktsbytecodeopt_frontend_static", "$ark_root/libpandabase:libarktsbase_frontend_static", "$ark_root/libpandafile:libarktsfile_frontend_static", ] part_name = ark_part_name subsystem_name = "$ark_subsystem_name" } ohos_executable("arkts_asm") { deps = [ ":arkts_asm_static" ] libs = platform_libs ldflags = platform_ldflags install_enable = true part_name = ark_part_name subsystem_name = "$ark_subsystem_name" } ark_isa_gen("isa_gen_libarkassembler") { template_files = [ "isa.h.erb", "ins_emit.h.erb", "ins_to_string.cpp.erb", "ins_create_api.h.erb", "opcode_parsing.h.erb", "operand_types_print.h.erb", ] sources = "templates" destination = "$target_gen_dir" requires = [ "asm_isapi.rb", "../libpandafile/pandafile_isapi.rb", ] } ark_gen_file("ark_asm_meta_gen_h") { template_file = "templates/meta_gen.cpp.erb" data = [ "metadata.yaml" ] api = [ "asm_metadata.rb" ] output_file = "$target_gen_dir/meta_gen.h" } ark_gen_file("ark_asm_register_extensions_h") { extra_dependencies = [ "$ark_root:concat_plugins_yamls" ] template_file = "extensions/register_extensions.h.erb" data = [ ark_plugin_options_yaml ] api = [ "$ark_root/templates/plugin_options.rb" ] output_file = "$target_gen_dir/register_extensions.h" }