• 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/ark_config.gni")
15
16config("abc2program_public_config") {
17  defines = [ "PANDA_WITH_ECMASCRIPT" ]
18}
19
20abc2program_sources = [
21  "$target_gen_dir/abc_inst_convert.cpp",
22  "$target_gen_dir/abc_opcode_convert.cpp",
23  "$target_gen_dir/abc_type_convert.cpp",
24  "$target_gen_dir/program_dump_utils.cpp",
25  "abc2program_compiler.cpp",
26  "abc2program_driver.cpp",
27  "abc2program_log.cpp",
28  "abc2program_options.cpp",
29  "abc_annotation_processor.cpp",
30  "abc_class_processor.cpp",
31  "abc_code_processor.cpp",
32  "abc_field_processor.cpp",
33  "abc_file_entity_processor.cpp",
34  "abc_literal_array_processor.cpp",
35  "abc_method_processor.cpp",
36  "abc_module_array_processor.cpp",
37  "common/abc2program_entity_container.cpp",
38  "common/abc_code_converter.cpp",
39  "common/abc_file_utils.cpp",
40  "dump_utils.cpp",
41  "program_dump.cpp",
42]
43
44abc2program_configs = [
45  ":abc2program_public_config",
46  "$ark_root:ark_config",
47  "$ark_root/libpandabase:arkbase_public_config",
48  "$ark_root/assembler:arkassembler_public_config",
49  "$ark_root/libpandafile:arkfile_public_config",
50]
51
52ohos_shared_library("abc2program") {
53  stack_protector_ret = false
54  sources = abc2program_sources
55
56  include_dirs = [
57    "$ark_root/abc2program",
58    "$target_gen_dir",
59  ]
60
61  configs = abc2program_configs
62
63  deps = [
64    ":abc_type_convert_cpp",
65    ":isa_gen_abc2program_abc_inst_convert_cpp",
66    ":isa_gen_abc2program_abc_opcode_convert_cpp",
67    ":isa_gen_abc2program_program_dump_utils_cpp",
68    "$ark_root/assembler:libarkassembler",
69  ]
70
71  external_deps = [ sdk_libc_secshared_dep ]
72
73  if (!is_standard_system) {
74    relative_install_dir = "ark"
75  }
76  output_extension = "so"
77  if (is_mingw) {
78    output_extension = "dll"
79  }
80  cflags = [ "-Wno-c++20-designator" ]
81
82  part_name = "runtime_core"
83  subsystem_name = "arkcompiler"
84}
85
86ohos_static_library("abc2program_frontend_static") {
87  stack_protector_ret = false
88  sources = abc2program_sources
89
90  include_dirs = [
91    "$ark_root/abc2program",
92    "$target_gen_dir",
93  ]
94
95  configs = abc2program_configs
96
97  deps = [
98    ":abc_type_convert_cpp",
99    ":isa_gen_abc2program_abc_inst_convert_cpp",
100    ":isa_gen_abc2program_abc_opcode_convert_cpp",
101    ":isa_gen_abc2program_program_dump_utils_cpp",
102    "$ark_root/assembler:libarkassembler_frontend_static",
103    "$ark_root/libpandabase:libarkbase_frontend_static",
104    "$ark_root/libpandafile:libarkfile_frontend_static",
105  ]
106  if (is_arkui_x) {
107    deps += [ "$ark_third_party_root/bounds_checking_function:libsec_static" ]
108  } else {
109    external_deps = [ "bounds_checking_function:libsec_static" ]
110  }
111  cflags = [ "-Wno-c++20-designator" ]
112
113  part_name = "runtime_core"
114  subsystem_name = "arkcompiler"
115}
116
117ohos_executable("abc2prog") {
118  sources = [ "abc2prog_main.cpp" ]
119
120  include_dirs = [
121    "$target_gen_dir",
122    "$root_gen_dir/libpandabase",
123  ]
124
125  configs = [
126    "$ark_root:ark_config",
127    "$ark_root/assembler:arkassembler_public_config",
128    "$ark_root/libpandabase:arkbase_public_config",
129    "$ark_root/libpandafile:arkfile_public_config",
130  ]
131
132  deps = [
133    ":abc2program_frontend_static",
134    "$ark_root/assembler:libarkassembler_frontend_static",
135    "$ark_root/libpandabase:libarkbase_frontend_static",
136    "$ark_root/libpandafile:libarkfile_frontend_static",
137  ]
138
139  external_deps = [ sdk_libc_secshared_dep ]
140
141  libs = platform_libs
142  if (!is_mac && !is_mingw) {
143    ldflags = platform_ldflags
144  }
145
146  install_enable = false
147  part_name = "runtime_core"
148  subsystem_name = "arkcompiler"
149}
150
151ark_isa_gen("isa_gen_abc2program") {
152  template_files = [
153    "abc_opcode_convert.cpp.erb",
154    "abc_inst_convert.cpp.erb",
155    "program_dump_utils.cpp.erb",
156  ]
157  sources = "common"
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/common/abc_type_convert.cpp.erb"
167  data_file = "$ark_root/libpandafile/types.yaml"
168  requires = [ "$ark_root/libpandafile/types.rb" ]
169  output_file = "$target_gen_dir/abc_type_convert.cpp"
170}
171