• 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/static_core/ark_config.gni")
15
16action("cross_values_generate") {
17  arch = ""
18  if (current_cpu == "arm") {
19    arch = "AARCH32"
20  } else if (current_cpu == "arm64") {
21    arch = "AARCH64"
22  } else if (current_cpu == "amd64" || current_cpu == "x64" ||
23             current_cpu == "x86_64") {
24    arch = "X86_64"
25  }
26
27  script = "$ark_root/cross_values/cross_values_generator.rb"
28  outputs = [ "$target_gen_dir/generated_values/${arch}_values_gen.h" ]
29
30  args = [
31    rebase_path(
32        "$target_gen_dir/../runtime/asm_defines/generated/libasm_defines.S",
33        root_build_dir),
34    rebase_path(outputs[0], root_build_dir),
35    "$arch",
36  ]
37
38  deps = [ "$ark_root/runtime/asm_defines:asm_defines" ]
39}
40
41asm_defines_def_cpp_content =
42    read_file("$ark_root/runtime/asm_defines/asm_defines.def", "list lines")
43write_file("$target_gen_dir/asm_defines_def.cpp", asm_defines_def_cpp_content)
44
45source_set("asm_defines_def_cpp_gen") {
46  sources = [ "$target_gen_dir/asm_defines_def.cpp" ]
47
48  configs += [
49    "$ark_root:ark_config",
50    "$ark_root/libpandabase:arkbase_public_config",
51    "$ark_root/libpandafile:arkfile_public_config",
52    "$ark_root/runtime:arkruntime_public_config",
53  ]
54
55  include_dirs = [
56    "$ark_root/compiler",
57    "$ark_root/compiler/code_info",
58    "$ark_root/compiler/optimizer/ir",
59    get_label_info(
60        "$ark_root/cross_values:cross_values_getters_generate(${default_toolchain})",
61        "target_gen_dir"),
62    get_label_info("$ark_root/runtime:plugins_defines_h(${default_toolchain})",
63                   "target_gen_dir") + "/asm_defines/generated",
64  ]
65
66  deps = [ "$ark_root/runtime:arkruntime_header_deps" ]
67
68  cflags_cc = [
69    "-E",
70    "-P",
71  ]
72}
73
74action("cross_values_getters_generate") {
75  script = "$ark_root/cross_values/cross_values_getters_generator.rb"
76  outputs = [ "$target_gen_dir/cross_values.h" ]
77
78  preprocessed_defines =
79      get_path_info("$target_gen_dir/asm_defines_def.cpp", "out_dir") +
80      "/asm_defines_def_cpp_gen/asm_defines_def.o"
81  args = [
82    rebase_path(preprocessed_defines, root_build_dir),
83    rebase_path("$target_gen_dir/generated_values", root_build_dir),
84    rebase_path(outputs[0], root_build_dir),
85  ]
86
87  deps = [
88    ":asm_defines_def_cpp_gen",
89    ":cross_values_generate",
90  ]
91}
92