• 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# http://www.apache.org/licenses/LICENSE-2.0
6# Unless required by applicable law or agreed to in writing, software
7# distributed under the License is distributed on an "AS IS" BASIS,
8# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9# See the License for the specific language governing permissions and
10# limitations under the License.
11
12import("//arkcompiler/runtime_core/static_core/ark_config.gni")
13import("//arkcompiler/runtime_core/static_vm_config.gni")
14import("//build/ohos.gni")
15import("$ark_root/plugins/plugins.gni")
16
17ohos_static_library("libarktsassembler_package") {
18  deps = []
19  if (enable_static_vm) {
20    deps += [ ":libarktsassembler_frontend_static" ]
21  }
22
23  part_name = ark_part_name
24  subsystem_name = "$ark_subsystem_name"
25}
26
27config("arkassembler_public_config") {
28  include_dirs = [
29    "$ark_root/assembler",
30    "$target_gen_dir",
31    "$target_gen_dir/include",
32    "$ark_root_gen_dir",
33    "$ark_root",
34  ]
35
36  configs = [ "$ark_root/runtime:profiling_gen_public_config" ]
37}
38
39libarkassembler_sources = [
40  "$target_gen_dir/ins_to_string.cpp",
41  "annotation.cpp",
42  "assembly-emitter.cpp",
43  "assembly-ins.cpp",
44  "assembly-parser.cpp",
45  "assembly-program.cpp",
46  "assembly-type.cpp",
47  "context.cpp",
48  "extensions/extensions.cpp",
49  "lexer.cpp",
50  "meta.cpp",
51]
52libarkassembler_sources += plugin_libarkassembler_sources
53
54libarkassembler_configs = [
55  "$ark_root:ark_config",
56  ":arkassembler_public_config",
57  "$ark_root/runtime:arkruntime_public_config",
58  "$ark_root/libpandabase:arkbase_public_config",
59  "$ark_root/libpandafile:arkfile_public_config",
60  "$ark_root/compiler:arkcompiler_public_config",
61]
62libarkassembler_configs += plugin_libarkassembler_configs
63
64ohos_source_set("libarktsassembler_static") {
65  sources = libarkassembler_sources
66
67  public_configs = libarkassembler_configs
68
69  deps = [
70    ":ark_asm_meta_gen_h",
71    ":ark_asm_register_extensions_h",
72    ":isa_gen_libarkassembler_ins_create_api_h",
73    ":isa_gen_libarkassembler_ins_emit_h",
74    ":isa_gen_libarkassembler_ins_to_string_cpp",
75    ":isa_gen_libarkassembler_isa_h",
76    ":isa_gen_libarkassembler_opcode_parsing_h",
77    ":isa_gen_libarkassembler_operand_types_print_h",
78    "$ark_root/compiler:libarktscompiler",
79    "$ark_root/libpandabase:libarktsbase",
80    "$ark_root/libpandafile:libarktsfile",
81    "$ark_root/runtime:profiling_gen_profiling_gen_h",
82  ]
83
84  deps += plugin_assembler_deps
85
86  external_deps = [ sdk_libc_secshared_dep ]
87
88  part_name = ark_part_name
89  subsystem_name = "$ark_subsystem_name"
90}
91
92ohos_shared_library("libarktsassembler") {
93  deps = [ ":libarktsassembler_static" ]
94
95  output_extension = "so"
96  if (is_mingw) {
97    output_extension = "dll"
98  }
99  part_name = ark_part_name
100  subsystem_name = "$ark_subsystem_name"
101}
102
103ohos_source_set("libarktsassembler_frontend_set_static") {
104  sources = libarkassembler_sources
105
106  public_configs = libarkassembler_configs
107
108  deps = [
109    ":ark_asm_meta_gen_h",
110    ":ark_asm_register_extensions_h",
111    ":isa_gen_libarkassembler_ins_create_api_h",
112    ":isa_gen_libarkassembler_ins_emit_h",
113    ":isa_gen_libarkassembler_ins_to_string_cpp",
114    ":isa_gen_libarkassembler_isa_h",
115    ":isa_gen_libarkassembler_opcode_parsing_h",
116    ":isa_gen_libarkassembler_operand_types_print_h",
117    "$ark_root/libpandafile:libarktsfile_frontend_static",
118    "$ark_root/runtime:profiling_gen_profiling_gen_h",
119  ]
120
121  deps += plugin_assembler_deps
122
123  external_deps = [ sdk_libc_secshared_dep ]
124
125  part_name = ark_part_name
126  subsystem_name = "$ark_subsystem_name"
127}
128
129ohos_static_library("libarktsassembler_frontend_static") {
130  deps = [ ":libarktsassembler_frontend_set_static" ]
131  part_name = ark_part_name
132  subsystem_name = "$ark_subsystem_name"
133}
134
135ohos_source_set("arkts_asm_static") {
136  sources = [ "pandasm.cpp" ]
137
138  include_dirs = [ "$target_gen_dir" ]
139
140  public_configs = [
141    ":arkassembler_public_config",
142    "$ark_root:ark_config",
143    "$ark_root/libpandabase:arkbase_public_config",
144    "$ark_root/libpandafile:arkfile_public_config",
145    "$ark_root/compiler:arkcompiler_public_config",
146    "$ark_root/runtime:arkruntime_public_config",
147  ]
148
149  deps = [
150    ":libarktsassembler_frontend_static",
151    "$ark_root/bytecode_optimizer:libarktsbytecodeopt_frontend_static",
152    "$ark_root/libpandabase:libarktsbase_frontend_static",
153    "$ark_root/libpandafile:libarktsfile_frontend_static",
154  ]
155
156  part_name = ark_part_name
157  subsystem_name = "$ark_subsystem_name"
158}
159
160ohos_executable("arkts_asm") {
161  deps = [ ":arkts_asm_static" ]
162
163  libs = platform_libs
164  ldflags = platform_ldflags
165
166  install_enable = true
167  part_name = ark_part_name
168  subsystem_name = "$ark_subsystem_name"
169}
170
171ark_isa_gen("isa_gen_libarkassembler") {
172  template_files = [
173    "isa.h.erb",
174    "ins_emit.h.erb",
175    "ins_to_string.cpp.erb",
176    "ins_create_api.h.erb",
177    "opcode_parsing.h.erb",
178    "operand_types_print.h.erb",
179  ]
180  sources = "templates"
181  destination = "$target_gen_dir"
182  requires = [
183    "asm_isapi.rb",
184    "../libpandafile/pandafile_isapi.rb",
185  ]
186}
187
188ark_gen_file("ark_asm_meta_gen_h") {
189  template_file = "templates/meta_gen.cpp.erb"
190  data = [ "metadata.yaml" ]
191  api = [ "asm_metadata.rb" ]
192  output_file = "$target_gen_dir/meta_gen.h"
193}
194
195ark_gen_file("ark_asm_register_extensions_h") {
196  extra_dependencies = [ "$ark_root:concat_plugins_yamls" ]
197  template_file = "extensions/register_extensions.h.erb"
198  data = [ ark_plugin_options_yaml ]
199  api = [ "$ark_root/templates/plugin_options.rb" ]
200  output_file = "$target_gen_dir/register_extensions.h"
201}
202