# 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") if (ark_standalone_build) { import("$build_root/ark.gni") } else { import("//build/ohos.gni") } ohos_static_library("libarktsfile_package") { deps = [] if (enable_static_vm) { deps += [ ":libarktsfile_frontend_static" ] } part_name = ark_part_name subsystem_name = "$ark_subsystem_name" } config("arkfile_public_config") { include_dirs = [ "$ark_root/libpandafile", "$ark_root/libziparchive", "$target_gen_dir", "$target_gen_dir/include", ] if (ark_standalone_build) { include_dirs += [ "//third_party/zlib/contrib/minizip" ] } } if (!ark_static_standalone_build) { ohos_shared_headers("libpandafile_headers") { include_dirs = [ "$ark_root/libpandafile", "$ark_root/libziparchive", "$target_gen_dir", "$target_gen_dir/include", ] if (ark_standalone_build) { include_dirs += [ "//third_party/zlib/contrib/minizip" ] } part_name = ark_part_name subsystem_name = "$ark_subsystem_name" } } libarkfile_sources = [ "annotation_data_accessor.cpp", "bytecode_emitter.cpp", "class_data_accessor.cpp", "code_data_accessor.cpp", "debug_data_accessor.cpp", "debug_helpers.cpp", "debug_info_extractor.cpp", "field_data_accessor.cpp", "file.cpp", "file_format_version.cpp", "file_item_container.cpp", "file_items.cpp", "file_reader.cpp", "file_writer.cpp", "literal_data_accessor.cpp", "method_data_accessor.cpp", "method_handle_data_accessor.cpp", "pgo.cpp", ] libarkfile_configs = [ "$ark_root:ark_config", "$ark_root/libpandabase:arkbase_public_config", ":arkfile_public_config", ] if (ark_static_standalone_build) { libarkfile_configs += [ zlib_public_config ] } group("arktsfile_header_deps") { deps = [ ":isa_gen_libarkfile_bytecode_emitter_def_gen_h", ":isa_gen_libarkfile_bytecode_emitter_gen_h", ":isa_gen_libarkfile_bytecode_instruction-inl_gen_h", ":isa_gen_libarkfile_bytecode_instruction_enum_gen_h", ":isa_gen_libarkfile_file_format_version_h", ":isa_gen_libarkfile_tests_bytecode_emitter_tests_gen_h", ":libarkfile_file_items_gen_inc", ":libarkfile_type_gen_h", ":source_lang_enum_h", ] } ohos_source_set("libarktsfile_static") { sources = libarkfile_sources public_configs = libarkfile_configs deps = [ ":arktsfile_header_deps", "$ark_root/libpandabase:libarktsbase", "$ark_root/libziparchive:libarktsziparchive", ] external_deps = [ sdk_libc_secshared_dep ] if (!ark_standalone_build) { public_external_deps = [ "zlib:libz", "zlib:shared_libz", ] } else { external_deps += [ "zlib:libz", "zlib:shared_libz", ] } part_name = ark_part_name subsystem_name = "$ark_subsystem_name" } ohos_shared_library("libarktsfile") { deps = [ ":libarktsfile_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("libarktsfile_frontend_set_static") { sources = libarkfile_sources public_configs = libarkfile_configs deps = [ ":arktsfile_header_deps", ":source_lang_enum_h", "$ark_root/libziparchive:libarktsziparchive_frontend_static", ] external_deps = [ sdk_libc_secshared_dep ] if (!ark_standalone_build) { public_external_deps = [ "zlib:libz" ] if (!is_mac) { public_external_deps += [ "zlib:shared_libz" ] } } else { external_deps += [ "zlib:libz" ] if (!is_mac) { external_deps += [ "zlib:shared_libz" ] } } part_name = ark_part_name subsystem_name = "$ark_subsystem_name" } ohos_static_library("libarktsfile_frontend_static") { deps = [ ":libarktsfile_frontend_set_static" ] part_name = ark_part_name subsystem_name = ark_subsystem_name } ark_gen_file("libarkfile_type_gen_h") { template_file = "templates/type.h.erb" data = [ "types.yaml" ] api = [ "types.rb" ] output_file = "$target_gen_dir/type.h" } ark_isa_gen("isa_gen_libarkfile") { template_files = [ "bytecode_instruction_enum_gen.h.erb", "bytecode_instruction-inl_gen.h.erb", "bytecode_emitter_def_gen.h.erb", "bytecode_emitter_gen.h.erb", "file_format_version.h.erb", "tests/bytecode_emitter_tests_gen.h.erb", ] sources = "templates" ## ark_root/templates destination = "$target_gen_dir/include" ## target_gen_dir/include requires = [ "pandafile_isapi.rb" ] } ark_gen_file("libarkfile_file_items_gen_inc") { extra_dependencies = [ "$ark_root:concat_plugins_yamls" ] template_file = "templates/file_items_gen.inc.erb" data = [ ark_plugin_options_yaml ] api = [ "$ark_root/templates/plugin_options.rb" ] output_file = "$target_gen_dir/include/file_items_gen.inc" } ark_gen_file("source_lang_enum_h") { extra_dependencies = [ "$ark_root:concat_plugins_yamls" ] template_file = "templates/source_lang_enum.h.erb" data = [ ark_plugin_options_yaml ] api = [ "$ark_root/templates/plugin_options.rb" ] output_file = "$target_gen_dir/include/source_lang_enum.h" }