• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 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("$ark_root/plugins/plugins.gni")
17
18if (ark_standalone_build) {
19  import("$build_root/ark.gni")
20} else {
21  import("//build/ohos.gni")
22}
23
24abc2program_sources = [
25  "$target_gen_dir/abc_inst_convert.cpp",
26  "$target_gen_dir/abc_opcode_convert.cpp",
27  "$target_gen_dir/abc_type_convert.cpp",
28  "abc2program_compiler.cpp",
29  "abc2program_driver.cpp",
30  "abc2program_key_data.cpp",
31  "abc2program_log.cpp",
32  "abc2program_options.cpp",
33  "abc_class_processor.cpp",
34  "abc_code_processor.cpp",
35  "abc_field_processor.cpp",
36  "abc_file_entity_processor.cpp",
37  "abc_file_processor.cpp",
38  "abc_file_utils.cpp",
39  "abc_literal_array_processor.cpp",
40  "abc_method_processor.cpp",
41  "abc_string_table.cpp",
42  "common/abc_code_converter.cpp",
43  "program_dump.cpp",
44]
45abc2program_sources += plugin_abc2program_sources
46
47abc2program_configs = [
48  "$ark_root:ark_config",
49  "$ark_root/libpandabase:arkbase_public_config",
50  "$ark_root/assembler:arkassembler_public_config",
51  "$ark_root/libpandafile:arkfile_public_config",
52]
53
54ohos_shared_library("arkts_abc2program") {
55  stack_protector_ret = false
56  sources = abc2program_sources
57
58  include_dirs = [
59    "$ark_root/abc2program",
60    "$target_gen_dir",
61  ]
62
63  configs = abc2program_configs
64
65  deps = [
66    ":abc2program_plugins_inc",
67    ":abc_type_convert_cpp",
68    ":get_language_specific_metadata_inc",
69    ":isa_gen_abc2program_abc_inst_convert_cpp",
70    ":isa_gen_abc2program_abc_opcode_convert_cpp",
71    "$ark_root/assembler:libarktsassembler_frontend_static",
72    "$ark_root/libpandafile:libarktsfile_frontend_static",
73  ]
74
75  external_deps = [ sdk_libc_secshared_dep ]
76  if (is_mingw) {
77     deps += [ "$ark_root/libpandabase:libarktsbase" ]
78  } else {
79     deps += [ "$ark_root/libpandabase:libarktsbase_frontend_static" ]
80  }
81
82  if (!is_standard_system) {
83    relative_install_dir = "ark"
84  }
85  output_extension = "so"
86  if (is_mingw) {
87    output_extension = "dll"
88  }
89
90  part_name = "runtime_core"
91  subsystem_name = "arkcompiler"
92}
93
94ohos_static_library("arkts_abc2program_frontend_static") {
95  sources = abc2program_sources
96
97  include_dirs = [
98    "$ark_root/abc2program",
99    "$target_gen_dir",
100  ]
101
102  configs = abc2program_configs
103
104  external_deps = [ sdk_libc_secshared_dep ]
105  deps = [
106    ":abc2program_plugins_inc",
107    ":abc_type_convert_cpp",
108    ":get_language_specific_metadata_inc",
109    ":isa_gen_abc2program_abc_inst_convert_cpp",
110    ":isa_gen_abc2program_abc_opcode_convert_cpp",
111    "$ark_root/assembler:libarktsassembler_frontend_static",
112    "$ark_root/libpandabase:libarktsbase_frontend_static",
113    "$ark_root/libpandafile:libarktsfile_frontend_static",
114  ]
115
116  part_name = "runtime_core"
117  subsystem_name = "arkcompiler"
118}
119
120ohos_executable("arkts_abc2prog") {
121  sources = [ "abc2prog_main.cpp" ]
122
123  include_dirs = [
124    "$target_gen_dir",
125    "$root_gen_dir/libpandabase",
126  ]
127
128  configs = [
129    "$ark_root:ark_config",
130    "$ark_root/assembler:arkassembler_public_config",
131    "$ark_root/libpandabase:arkbase_public_config",
132    "$ark_root/libpandafile:arkfile_public_config",
133  ]
134
135  deps = [
136    ":arkts_abc2program_frontend_static",
137    "$ark_root/assembler:libarktsassembler_frontend_static",
138    "$ark_root/libpandabase:libarktsbase_frontend_static",
139    "$ark_root/libpandafile:libarktsfile_frontend_static",
140  ]
141
142  libs = platform_libs
143  if (!is_mac && !is_mingw) {
144    ldflags = platform_ldflags
145  }
146
147  install_enable = false
148  part_name = "runtime_core"
149  subsystem_name = "arkcompiler"
150}
151
152ark_isa_gen("isa_gen_abc2program") {
153  template_files = [
154    "abc_opcode_convert.cpp.erb",
155    "abc_inst_convert.cpp.erb",
156  ]
157  sources = "templates"
158  destination = "$target_gen_dir"
159  requires = [
160    "$ark_root//assembler/asm_isapi.rb",
161    "$ark_root//libpandafile/pandafile_isapi.rb",
162  ]
163}
164
165ark_gen_file("abc_type_convert_cpp") {
166  template_file = "$ark_root/abc2program/templates/abc_type_convert.cpp.erb"
167  data = [ "$ark_root/libpandafile/types.yaml" ]
168  api = [ "$ark_root/libpandafile/types.rb" ]
169  output_file = "$target_gen_dir/abc_type_convert.cpp"
170}
171
172ark_gen_file("abc2program_plugins_inc") {
173  extra_dependencies = [ "$ark_root:concat_plugins_yamls" ]
174  template_file = "templates/abc2program_plugins.inc.erb"
175  data = [ ark_plugin_options_yaml ]
176  api = [ "$ark_root/templates/plugin_options.rb" ]
177  output_file = "$target_gen_dir/abc2program_plugins.inc"
178}
179
180ark_gen_file("get_language_specific_metadata_inc") {
181  extra_dependencies = [ "$ark_root:concat_plugins_yamls" ]
182  template_file = "templates/get_language_specific_metadata.inc.erb"
183  data = [ ark_plugin_options_yaml ]
184  api = [ "$ark_root/templates/plugin_options.rb" ]
185  output_file = "$target_gen_dir/get_language_specific_metadata.inc"
186}
187