# Copyright (c) 2021-2022 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/ark_config.gni") config("arkfile_public_config") { include_dirs = [ "$ark_root/libpandafile", "$ark_root/libziparchive", "$target_gen_dir", "$target_gen_dir/include", ] include_dirs += [ "//third_party/zlib", "//third_party/zlib/contrib/minizip", ] defines = [] if (is_ohos && !is_standard_system) { defines += [ "ENABLE_FULL_FILE_FIELDS" ] } if (use_libfuzzer) { defines += [ "FUZZ_TEST" ] } } config("arkfile_fuzz_config") { configs = [ "$build_root/config/compiler:exceptions" ] defines = [ "SUPPORT_KNOWN_EXCEPTION" ] } libarkfile_sources = [ "annotation_data_accessor.cpp", "bytecode_emitter.cpp", "class_data_accessor.cpp", "code_data_accessor.cpp", "debug_data_accessor.cpp", "debug_info_extractor.cpp", "field_data_accessor.cpp", "file.cpp", "file_format_version.cpp", "file_item_container.cpp", "file_items.cpp", "file_writer.cpp", "literal_data_accessor.cpp", "method_data_accessor.cpp", "method_handle_data_accessor.cpp", "module_data_accessor.cpp", "pgo.cpp", ] libarkfile_configs = [ sdk_libc_secshared_config, "$ark_root:ark_config", "$ark_root/libpandabase:arkbase_public_config", ":arkfile_public_config", ] group("arkfile_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_type_gen_h", ":source_lang_enum_h", "$ark_root/libpandabase:arkbase_header_deps", ] } source_set("libarkfile_static") { sources = libarkfile_sources public_configs = libarkfile_configs deps = [ ":arkfile_header_deps", "$ark_root/libpandabase:libarkbase_static", "$ark_root/libziparchive:libarkziparchive_static", sdk_libc_secshared_dep, ] } source_set("libarkfile_static_fuzz") { sources = libarkfile_sources public_configs = libarkfile_configs public_configs += [ ":arkfile_fuzz_config" ] deps = [ ":arkfile_header_deps", "$ark_root/libpandabase:libarkbase_static", "$ark_root/libziparchive:libarkziparchive_static", sdk_libc_secshared_dep, ] } ohos_shared_library("libarkfile") { stack_protector_ret = false deps = [ ":libarkfile_static" ] if (!is_standard_system) { relative_install_dir = "ark" } if (!is_mingw && !is_mac) { output_extension = "so" } part_name = "runtime_core" subsystem_name = "arkcompiler" } source_set("libarkfile_frontend_set_static") { sources = libarkfile_sources public_configs = libarkfile_configs deps = [ ":arkfile_header_deps", "$ark_root/libpandabase:libarkbase_frontend_static", "$ark_root/libziparchive:libarkziparchive_frontend_static", sdk_libc_secshared_dep, ] } ohos_static_library("libarkfile_frontend_static") { stack_protector_ret = false deps = [ ":libarkfile_frontend_set_static" ] part_name = "runtime_core" subsystem_name = "arkcompiler" } ark_gen_file("libarkfile_type_gen_h") { template_file = "templates/type.h.erb" data_file = "types.yaml" requires = [ "types.rb" ] output_file = "$target_gen_dir/type.h" } ark_isa_gen("isa_gen_libarkfile") { template_files = [ "arkcompiler.para.erb", "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("source_lang_enum_h") { extra_dependencies = [ "$ark_root:concat_plugins_yamls" ] template_file = "templates/source_lang_enum.h.erb" data_file = "$target_gen_dir/../plugin_options.yaml" requires = [ "$ark_root/templates/plugin_options.rb" ] output_file = "$target_gen_dir/include/source_lang_enum.h" } group("arkcompiler_params") { deps = [] if (!ark_standalone_build) { deps += [ ":arkcompiler.para" ] } } if (!ark_standalone_build) { ohos_prebuilt_etc("arkcompiler.para") { deps = [ ":isa_gen_libarkfile_arkcompiler_para" ] source = "$target_gen_dir/include/arkcompiler.para" relative_install_dir = "param" part_name = "runtime_core" subsystem_name = "arkcompiler" } }