• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2021-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("//build/ohos.gni")
17
18ohos_static_library("libarktsfile_package") {
19  deps = []
20  if (enable_static_vm) {
21    deps += [ ":libarktsfile_frontend_static" ]
22  }
23
24  part_name = ark_part_name
25  subsystem_name = "$ark_subsystem_name"
26}
27
28config("arkfile_public_config") {
29  include_dirs = [
30    "$ark_root/libpandafile",
31    "$ark_root/libziparchive",
32    "$target_gen_dir",
33    "$target_gen_dir/include",
34  ]
35}
36
37libarkfile_sources = [
38  "annotation_data_accessor.cpp",
39  "bytecode_emitter.cpp",
40  "class_data_accessor.cpp",
41  "code_data_accessor.cpp",
42  "debug_data_accessor.cpp",
43  "debug_helpers.cpp",
44  "debug_info_extractor.cpp",
45  "field_data_accessor.cpp",
46  "file.cpp",
47  "file_format_version.cpp",
48  "file_item_container.cpp",
49  "file_items.cpp",
50  "file_reader.cpp",
51  "file_writer.cpp",
52  "literal_data_accessor.cpp",
53  "method_data_accessor.cpp",
54  "method_handle_data_accessor.cpp",
55  "pgo.cpp",
56]
57
58libarkfile_configs = [
59  "$ark_root:ark_config",
60  "$ark_root/libpandabase:arkbase_public_config",
61  ":arkfile_public_config",
62]
63
64if (ark_standalone_build) {
65  libarkfile_configs += [ zlib_public_config ]
66}
67
68ohos_source_set("libarktsfile_static") {
69  sources = libarkfile_sources
70
71  public_configs = libarkfile_configs
72
73  deps = [
74    ":isa_gen_libarkfile_bytecode_emitter_def_gen_h",
75    ":isa_gen_libarkfile_bytecode_emitter_gen_h",
76    ":isa_gen_libarkfile_bytecode_instruction-inl_gen_h",
77    ":isa_gen_libarkfile_bytecode_instruction_enum_gen_h",
78    ":isa_gen_libarkfile_file_format_version_h",
79    ":isa_gen_libarkfile_tests_bytecode_emitter_tests_gen_h",
80    ":libarkfile_file_items_gen_inc",
81    ":libarkfile_type_gen_h",
82    ":source_lang_enum_h",
83    "$ark_root/libpandabase:libarktsbase",
84    "$ark_root/libziparchive:libarktsziparchive",
85  ]
86
87  external_deps = [ sdk_libc_secshared_dep ]
88
89  public_external_deps = [
90    "zlib:libz",
91    "zlib:shared_libz",
92  ]
93
94  part_name = ark_part_name
95  subsystem_name = "$ark_subsystem_name"
96}
97
98ohos_shared_library("libarktsfile") {
99  deps = [ ":libarktsfile_static" ]
100
101  if (!is_mingw && !is_mac) {
102    output_extension = "so"
103  }
104  part_name = ark_part_name
105  subsystem_name = "$ark_subsystem_name"
106}
107
108ohos_source_set("libarktsfile_frontend_set_static") {
109  sources = libarkfile_sources
110
111  public_configs = libarkfile_configs
112
113  deps = [
114    ":isa_gen_libarkfile_bytecode_emitter_def_gen_h",
115    ":isa_gen_libarkfile_bytecode_emitter_gen_h",
116    ":isa_gen_libarkfile_bytecode_instruction-inl_gen_h",
117    ":isa_gen_libarkfile_bytecode_instruction_enum_gen_h",
118    ":isa_gen_libarkfile_file_format_version_h",
119    ":isa_gen_libarkfile_tests_bytecode_emitter_tests_gen_h",
120    ":libarkfile_file_items_gen_inc",
121    ":libarkfile_type_gen_h",
122    ":source_lang_enum_h",
123    "$ark_root/libziparchive:libarktsziparchive_frontend_static",
124  ]
125
126  external_deps = [ sdk_libc_secshared_dep ]
127
128  public_external_deps = [
129    "zlib:libz",
130    "zlib:shared_libz",
131  ]
132
133  part_name = ark_part_name
134  subsystem_name = "$ark_subsystem_name"
135}
136
137ohos_static_library("libarktsfile_frontend_static") {
138  deps = [ ":libarktsfile_frontend_set_static" ]
139  part_name = ark_part_name
140  subsystem_name = ark_subsystem_name
141}
142
143ark_gen_file("libarkfile_type_gen_h") {
144  template_file = "templates/type.h.erb"
145  data = [ "types.yaml" ]
146  api = [ "types.rb" ]
147  output_file = "$target_gen_dir/type.h"
148}
149
150ark_isa_gen("isa_gen_libarkfile") {
151  template_files = [
152    "bytecode_instruction_enum_gen.h.erb",
153    "bytecode_instruction-inl_gen.h.erb",
154    "bytecode_emitter_def_gen.h.erb",
155    "bytecode_emitter_gen.h.erb",
156    "file_format_version.h.erb",
157    "tests/bytecode_emitter_tests_gen.h.erb",
158  ]
159  sources = "templates"  ## ark_root/templates
160  destination = "$target_gen_dir/include"  ## target_gen_dir/include
161  requires = [ "pandafile_isapi.rb" ]
162}
163
164ark_gen_file("libarkfile_file_items_gen_inc") {
165  extra_dependencies = [ "$ark_root:concat_plugins_yamls" ]
166  template_file = "templates/file_items_gen.inc.erb"
167  data = [ ark_plugin_options_yaml ]
168  api = [ "$ark_root/templates/plugin_options.rb" ]
169  output_file = "$target_gen_dir/include/file_items_gen.inc"
170}
171
172ark_gen_file("source_lang_enum_h") {
173  extra_dependencies = [ "$ark_root:concat_plugins_yamls" ]
174  template_file = "templates/source_lang_enum.h.erb"
175  data = [ ark_plugin_options_yaml ]
176  api = [ "$ark_root/templates/plugin_options.rb" ]
177  output_file = "$target_gen_dir/include/source_lang_enum.h"
178}
179