• 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("//build/ohos.gni")
16import("$ark_root/plugins/plugins.gni")
17
18ark_gen_file("type_to_pandasm_type_cpp") {
19  template_file =
20      "$ark_root/disassembler/templates/type_to_pandasm_type.cpp.erb"
21  data = [ "$ark_root/libpandafile/types.yaml" ]
22  api = [ "$ark_root/libpandafile/types.rb" ]
23  output_file = "$target_gen_dir/type_to_pandasm_type.cpp"
24}
25
26ark_gen_file("disasm_plugins_inc") {
27  extra_dependencies = [ "$ark_root:concat_plugins_yamls" ]
28  template_file = "templates/disasm_plugins.inc.erb"
29  data = [ ark_plugin_options_yaml ]
30  api = [ "$ark_root/templates/plugin_options.rb" ]
31  output_file = "$target_gen_dir/disasm_plugins.inc"
32}
33
34ark_gen_file("get_language_specific_metadata_inc") {
35  extra_dependencies = [ "$ark_root:concat_plugins_yamls" ]
36  template_file = "templates/get_language_specific_metadata.inc.erb"
37  data = [ ark_plugin_options_yaml ]
38  api = [ "$ark_root/templates/plugin_options.rb" ]
39  output_file = "$target_gen_dir/get_language_specific_metadata.inc"
40}
41
42config("arkdisassembler_public_config") {
43  include_dirs = [
44    "$ark_root/assembler",
45    "$ark_root_gen_dir/assembler",
46    "$ark_root_gen_dir/disassembler",
47  ]
48  include_dirs +=
49      get_path_info(get_target_outputs(":disasm_plugins_inc"), "dir")
50}
51
52arkdisassembler_sources = [
53  "$target_gen_dir/bc_ins_to_pandasm_ins.cpp",
54  "$target_gen_dir/opcode_translator.cpp",
55  "$target_gen_dir/type_to_pandasm_type.cpp",
56  "disasm_backed_debug_info_extractor.cpp",
57  "disassembler.cpp",
58]
59arkdisassembler_sources += plugin_arkdisassembler_sources
60
61arkdisassembler_configs = [
62  ":arkdisassembler_public_config",
63  "$ark_root:ark_config",
64  "$ark_root/libpandabase:arkbase_public_config",
65  "$ark_root/assembler:arkassembler_public_config",
66  "$ark_root/libpandafile:arkfile_public_config",
67]
68
69ohos_shared_library("arktsdisassembler") {
70  sources = arkdisassembler_sources
71
72  include_dirs = [
73    "$ark_root/disassembler",
74    "$target_gen_dir",
75  ]
76
77  configs = arkdisassembler_configs
78
79  deps = [
80    ":disasm_plugins_inc",
81    ":get_language_specific_metadata_inc",
82    ":isa_gen_ark_disam_bc_ins_to_pandasm_ins_cpp",
83    ":isa_gen_ark_disam_opcode_translator_cpp",
84    ":type_to_pandasm_type_cpp",
85    "$ark_root/assembler:libarktsassembler",
86    "$ark_root/libpandabase:libarktsbase",
87    "$ark_root/libpandafile:libarktsfile",
88  ]
89
90  external_deps = [ sdk_libc_secshared_ext_dep ]
91
92  output_extension = "so"
93  if (is_mingw) {
94    output_extension = "dll"
95  }
96  part_name = ark_part_name
97  subsystem_name = "$ark_subsystem_name"
98}
99
100ohos_static_library("arktsdisassembler_frontend_static") {
101  sources = arkdisassembler_sources
102
103  include_dirs = [
104    "$ark_root/disassembler",
105    "$target_gen_dir",
106  ]
107
108  configs = arkdisassembler_configs
109
110  deps = [
111    ":disasm_plugins_inc",
112    ":get_language_specific_metadata_inc",
113    ":isa_gen_ark_disam_bc_ins_to_pandasm_ins_cpp",
114    ":isa_gen_ark_disam_opcode_translator_cpp",
115    ":type_to_pandasm_type_cpp",
116    "$ark_root/assembler:libarktsassembler_frontend_static",
117    "$ark_root/libpandabase:libarktsbase_frontend_static",
118    "$ark_root/libpandafile:libarktsfile_frontend_static",
119  ]
120
121  external_deps = [ sdk_libc_secshared_ext_dep ]
122
123  part_name = ark_part_name
124  subsystem_name = ark_subsystem_name
125}
126
127ohos_executable("arkts_disasm") {
128  sources = [ "disasm.cpp" ]
129
130  include_dirs = [
131    "$target_gen_dir",
132    "$ark_root_gen_dir/libpandabase",
133  ]
134
135  configs = [
136    "$ark_root:ark_config",
137    "$ark_root/assembler:arkassembler_public_config",
138    "$ark_root/libpandabase:arkbase_public_config",
139    "$ark_root/libpandafile:arkfile_public_config",
140  ]
141
142  deps = [
143    ":arktsdisassembler_frontend_static",
144    "$ark_root/assembler:libarktsassembler_frontend_static",
145    "$ark_root/libpandabase:libarktsbase_frontend_static",
146    "$ark_root/libpandafile:libarktsfile_frontend_static",
147  ]
148
149  libs = platform_libs
150  ldflags = platform_ldflags
151
152  install_enable = true
153  part_name = ark_part_name
154  subsystem_name = "$ark_subsystem_name"
155}
156
157ark_isa_gen("isa_gen_ark_disam") {
158  template_files = [
159    "opcode_translator.cpp.erb",
160    "bc_ins_to_pandasm_ins.cpp.erb",
161  ]
162  sources = "templates"
163  destination = "$target_gen_dir"
164  requires = [
165    "$ark_root//assembler/asm_isapi.rb",
166    "$ark_root//libpandafile/pandafile_isapi.rb",
167  ]
168}
169