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/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 == "x64" || current_cpu == "x86_64") { 23 arch = "X86_64" 24 } 25 26 script = "$ark_root/cross_values/cross_values_generator.rb" 27 outputs = [ "$target_gen_dir/generated_values/${arch}_values_gen.h" ] 28 29 args = [ 30 rebase_path( 31 "$target_gen_dir/../runtime/asm_defines/generated/libasm_defines.S", 32 root_build_dir), 33 rebase_path(outputs[0], root_build_dir), 34 "$arch", 35 ] 36 37 deps = [ "$ark_root/runtime/asm_defines:asm_defines" ] 38} 39 40asm_defines_def_cpp_content = 41 read_file("$ark_root/runtime/asm_defines/asm_defines.def", "list lines") 42write_file("$target_gen_dir/asm_defines_def.cpp", asm_defines_def_cpp_content) 43 44source_set("asm_defines_def_cpp_gen") { 45 sources = [ "$target_gen_dir/asm_defines_def.cpp" ] 46 47 configs += [ 48 "$ark_root:ark_config", 49 "$ark_root/libpandabase:arkbase_public_config", 50 "$ark_root/libpandafile:arkfile_public_config", 51 "$ark_root/runtime:arkruntime_public_config", 52 ] 53 54 output_name = "asm_defines_def_cpp_gen.asm_defines_def" 55 56 include_dirs = [ 57 "$ark_root/compiler", 58 "$ark_root/compiler/code_info", 59 "$ark_root/compiler/optimizer/ir", 60 get_label_info( 61 "$ark_root/cross_values:cross_values_getters_generate(${default_toolchain})", 62 "target_gen_dir"), 63 get_label_info("$ark_root/runtime:plugins_defines_h(${default_toolchain})", 64 "target_gen_dir") + "/asm_defines/generated", 65 ] 66 67 deps = [ "$ark_root/runtime:arkruntime_header_deps" ] 68 69 cflags_cc = [ 70 "-E", 71 "-P", 72 ] 73} 74 75action("cross_values_getters_generate") { 76 script = "$ark_root/cross_values/wrap_cross_values_getters_generator.sh" 77 outputs = [ "$target_gen_dir/cross_values.h" ] 78 79 args = [ 80 rebase_path( 81 "$target_out_dir/../../../$target_gen_dir/asm_defines_def_cpp_gen/asm_defines_def.o", 82 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