• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2021-2022 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("arkfile_public_config") {
17  include_dirs = [
18    "$ark_root/libpandafile",
19    "$ark_root/libziparchive",
20    "$target_gen_dir",
21    "$target_gen_dir/include",
22  ]
23
24  include_dirs += [
25    "//third_party/zlib",
26    "//third_party/zlib/contrib/minizip",
27  ]
28
29  if (is_ohos && !is_standard_system) {
30    defines = [ "ENABLE_FULL_FILE_FIELDS" ]
31  }
32}
33
34config("arkfile_fuzz_config") {
35  configs = [ "//build/config/compiler:exceptions" ]
36  defines = [ "SUPPORT_KNOWN_EXCEPTION" ]
37}
38
39libarkfile_sources = [
40  "annotation_data_accessor.cpp",
41  "bytecode_emitter.cpp",
42  "class_data_accessor.cpp",
43  "code_data_accessor.cpp",
44  "debug_data_accessor.cpp",
45  "debug_info_extractor.cpp",
46  "field_data_accessor.cpp",
47  "file.cpp",
48  "file_format_version.cpp",
49  "file_item_container.cpp",
50  "file_items.cpp",
51  "file_writer.cpp",
52  "literal_data_accessor.cpp",
53  "method_data_accessor.cpp",
54  "method_handle_data_accessor.cpp",
55  "module_data_accessor.cpp",
56  "pgo.cpp",
57]
58
59libarkfile_configs = [
60  sdk_libc_secshared_config,
61  "$ark_root:ark_config",
62  "$ark_root/libpandabase:arkbase_public_config",
63  ":arkfile_public_config",
64]
65
66group("arkfile_header_deps") {
67  deps = [
68    ":isa_gen_libarkfile_bytecode_emitter_def_gen_h",
69    ":isa_gen_libarkfile_bytecode_emitter_gen_h",
70    ":isa_gen_libarkfile_bytecode_instruction-inl_gen_h",
71    ":isa_gen_libarkfile_bytecode_instruction_enum_gen_h",
72    ":isa_gen_libarkfile_file_format_version_h",
73    ":isa_gen_libarkfile_tests_bytecode_emitter_tests_gen_h",
74    ":libarkfile_type_gen_h",
75    ":source_lang_enum_h",
76    "$ark_root/libpandabase:arkbase_header_deps",
77  ]
78}
79
80source_set("libarkfile_static") {
81  sources = libarkfile_sources
82
83  public_configs = libarkfile_configs
84
85  deps = [
86    ":arkfile_header_deps",
87    "$ark_root/libpandabase:libarkbase_static",
88    "$ark_root/libziparchive:libarkziparchive_static",
89    sdk_libc_secshared_dep,
90  ]
91}
92
93source_set("libarkfile_static_fuzz") {
94  sources = libarkfile_sources
95
96  public_configs = libarkfile_configs
97  public_configs += [ ":arkfile_fuzz_config" ]
98
99  deps = [
100    ":arkfile_header_deps",
101    "$ark_root/libpandabase:libarkbase_static",
102    "$ark_root/libziparchive:libarkziparchive_static",
103    sdk_libc_secshared_dep,
104  ]
105}
106
107ohos_shared_library("libarkfile") {
108  deps = [ ":libarkfile_static" ]
109
110  if (!is_standard_system) {
111    relative_install_dir = "ark"
112  }
113  if (!is_mingw && !is_mac) {
114    output_extension = "so"
115  }
116
117  part_name = "runtime_core"
118  subsystem_name = "arkcompiler"
119}
120
121source_set("libarkfile_frontend_set_static") {
122  sources = libarkfile_sources
123
124  public_configs = libarkfile_configs
125
126  deps = [
127    ":arkfile_header_deps",
128    "$ark_root/libpandabase:libarkbase_frontend_static",
129    "$ark_root/libziparchive:libarkziparchive_frontend_static",
130    sdk_libc_secshared_dep,
131  ]
132}
133
134ohos_static_library("libarkfile_frontend_static") {
135  deps = [ ":libarkfile_frontend_set_static" ]
136
137  part_name = "runtime_core"
138  subsystem_name = "arkcompiler"
139}
140
141ark_gen_file("libarkfile_type_gen_h") {
142  template_file = "templates/type.h.erb"
143  data_file = "types.yaml"
144  requires = [ "types.rb" ]
145  output_file = "$target_gen_dir/type.h"
146}
147
148ark_isa_gen("isa_gen_libarkfile") {
149  template_files = [
150    "arkcompiler.para.erb",
151    "bytecode_instruction_enum_gen.h.erb",
152    "bytecode_instruction-inl_gen.h.erb",
153    "bytecode_emitter_def_gen.h.erb",
154    "bytecode_emitter_gen.h.erb",
155    "file_format_version.h.erb",
156    "tests/bytecode_emitter_tests_gen.h.erb",
157  ]
158  sources = "templates"  ## ark_root/templates
159  destination = "$target_gen_dir/include"  ## target_gen_dir/include
160  requires = [ "pandafile_isapi.rb" ]
161}
162
163ark_gen_file("source_lang_enum_h") {
164  extra_dependencies = [ "$ark_root:concat_plugins_yamls" ]
165  template_file = "templates/source_lang_enum.h.erb"
166  data_file = "$target_gen_dir/../plugin_options.yaml"
167  requires = [ "$ark_root/templates/plugin_options.rb" ]
168  output_file = "$target_gen_dir/include/source_lang_enum.h"
169}
170
171group("arkcompiler_params") {
172  deps = []
173
174  if (!ark_standalone_build) {
175    deps += [ ":arkcompiler.para" ]
176  }
177}
178
179if (!ark_standalone_build) {
180  ohos_prebuilt_etc("arkcompiler.para") {
181    deps = [ ":isa_gen_libarkfile_arkcompiler_para" ]
182    source = "$target_gen_dir/include/arkcompiler.para"
183    relative_install_dir = "param"
184    part_name = "runtime_core"
185    subsystem_name = "arkcompiler"
186  }
187}
188