brintos

brintos / llvm-project-archived public Read only

0
0
Text · 4.2 KiB · 17072a8 Raw
132 lines · plain
1import("//llvm/lib/Target/targets_string.gni")2import("//llvm/triples.gni")3import("//llvm/utils/gn/build/write_cmake_config.gni")4import("bolt_lit_site_cfg_files.gni")5 6template("write_lit_config") {7  write_cmake_config(target_name) {8    input = invoker.input9    output = invoker.output10    values = [11      "BOLT_BINARY_DIR=" +12          rebase_path(get_label_info("//bolt", "target_out_dir")),13      "BOLT_SOURCE_DIR=" + rebase_path("//bolt"),14      "LIT_SITE_CFG_IN_HEADER=## Autogenerated from $input, do not edit",15      "LLVM_BINARY_DIR=" + get_label_info("//llvm", "target_out_dir"),16      "LLVM_LIBS_DIR=",  # needed only for shared builds17      "LLVM_LIT_TOOLS_DIR=",  # Intentionally empty, matches cmake build.18      "LLVM_SOURCE_DIR=" + rebase_path("//llvm"),19      "LLVM_TOOLS_DIR=" + rebase_path("$root_out_dir/bin"),20      "LLVM_TARGET_TRIPLE=$llvm_target_triple",21    ]22    values += invoker.extra_values23  }24}25 26write_lit_config("lit_site_cfg") {27  bolt_targets_to_build_string = ""28  if (llvm_build_AArch64) {29    bolt_targets_to_build_string += "AArch64"30  }31  if (llvm_build_X86) {32    if (bolt_targets_to_build_string != "") {33      bolt_targets_to_build_string += " "34    }35    bolt_targets_to_build_string += "X86"36  }37 38  # Fully-qualified instead of relative for LIT_SITE_CFG_IN_HEADER.39  input = "//bolt/test/lit.site.cfg.py.in"40  output = bolt_lit_site_cfg_file41  dir = get_path_info(output, "dir")42  extra_values = [43    "BOLT_CLANG_EXE=" + rebase_path("$root_build_dir/bin/clang"),44    "BOLT_LLD_EXE=" + rebase_path("$root_build_dir/bin/ld.lld"),45    "BOLT_ENABLE_RUNTIME=0",  # FIXME: enable runtime46    "BOLT_TARGETS_TO_BUILD=$bolt_targets_to_build_string",47    "GNU_LD_EXECUTABLE=",  # FIXME: set sometimes?48    "LIBBOLT_RT_HUGIFY=",49    "LIBBOLT_RT_INSTR=",50    "LLVM_HOST_TRIPLE=$llvm_current_triple",51    "LLVM_USE_SANITIZER=",52    "Python3_EXECUTABLE=$python_path",53  ]54 55  if (host_os == "win") {56    # See comment for Windows solink in llvm/utils/gn/build/toolchain/BUILD.gn57    extra_values += [ "SHLIBDIR=" + rebase_path("$root_out_dir/bin", dir) ]58  } else {59    extra_values += [ "SHLIBDIR=" + rebase_path("$root_out_dir/lib", dir) ]60  }61 62  if (host_cpu == "x64") {63    extra_values += [ "HOST_ARCH=x86_64" ]64  } else if (host_cpu == "arm64") {65    extra_values += [ "HOST_ARCH=arm64" ]66  } else if (host_cpu == "ppc64") {67    extra_values += [ "HOST_ARCH=powerpc64le" ]68  } else {69    assert(false, "unimplemented host_cpu " + host_cpu)70  }71}72 73write_lit_config("lit_unit_site_cfg") {74  # Fully-qualified instead of relative for LIT_SITE_CFG_IN_HEADER.75  input = "//bolt/test/Unit/lit.site.cfg.py.in"76  output = bolt_lit_unit_site_cfg_file77  extra_values = [ "LLVM_BUILD_MODE=." ]78}79 80# This target should contain all dependencies of check-bolt.81# //:default depends on it, so that ninja's default target builds all82# prerequisites for check-bolt but doesn't run check-bolt itself.83group("test") {84  deps = [85    ":lit_site_cfg",86    ":lit_unit_site_cfg",87    "//bolt/tools/bat-dump:llvm-bat-dump",88    "//bolt/tools/driver:symlinks",89    "//bolt/tools/heatmap:llvm-bolt-heatmap",90    "//bolt/tools/merge-fdata",91    "//bolt/unittests",92    "//clang/tools/driver:symlinks",93    "//lld/tools/lld:symlinks",94    "//llvm/tools/llc",95    "//llvm/tools/llvm-config",96    "//llvm/tools/llvm-dwarfdump",97    "//llvm/tools/llvm-dwp",98    "//llvm/tools/llvm-mc",99    "//llvm/tools/llvm-nm:symlinks",100    "//llvm/tools/llvm-objcopy:symlinks",101    "//llvm/tools/llvm-objdump:symlinks",102    "//llvm/tools/yaml2obj",103    "//llvm/utils/FileCheck",104    "//llvm/utils/count",105    "//llvm/utils/not",106  ]107 108  testonly = true109}110 111action("check-bolt") {112  script = "$root_out_dir/bin/llvm-lit"113  if (host_os == "win") {114    script += ".py"115  }116  args = [117    "-sv",118    rebase_path(".", root_out_dir),119  ]120  outputs = [ "$target_gen_dir/run-lit" ]  # Non-existing, so that ninja runs it121                                           # each time.122 123  # Since check-bolt is always dirty, //:default doesn't depend on it so that124  # it's not part of the default ninja target.  Hence, check-bolt shouldn't125  # have any deps except :test. so that the default target is sure to build126  # all the deps.127  deps = [ ":test" ]128  testonly = true129 130  pool = "//:console"131}132