llvm/llvm/utils/gn/secondary/llvm/tools/llvm-symbolizer/BUILD.gn

import("//llvm/tools/binutils_symlinks.gni")
import("//llvm/utils/TableGen/tablegen.gni")
import("//llvm/utils/gn/build/driver_executable.gni")
import("//llvm/utils/gn/build/symlink_or_copy.gni")

tablegen("Opts") {
  visibility = [ ":llvm-symbolizer" ]
  args = [ "-gen-opt-parser-defs" ]
}

symlinks = [ "llvm-addr2line" ]
if (llvm_install_binutils_symlinks) {
  symlinks += [ "addr2line" ]
}
foreach(target, symlinks) {
  symlink_or_copy(target) {
    deps = [ ":llvm-symbolizer" ]
    source = "llvm-symbolizer"
    output = "$root_out_dir/bin/$target"
  }
}

# //:llvm-symbolizer depends on this symlink target, see comment in //BUILD.gn.
group("symlinks") {
  deps = [ ":llvm-symbolizer" ]
  foreach(target, symlinks) {
    deps += [ ":$target" ]
  }
}

driver_executable("llvm-symbolizer") {
  deps = [
    ":Opts",
    "//llvm/lib/DebugInfo/DWARF",
    "//llvm/lib/DebugInfo/PDB",
    "//llvm/lib/DebugInfo/Symbolize",
    "//llvm/lib/Debuginfod",
    "//llvm/lib/Demangle",
    "//llvm/lib/Object",
    "//llvm/lib/Option",
    "//llvm/lib/Support",
  ]
  sources = [ "llvm-symbolizer.cpp" ]
}