From f7d5f90c333610b3b292738110685a47971c0c29 Mon Sep 17 00:00:00 2001 From: Nico Weber Date: Sun, 22 Sep 2019 16:48:20 +0000 Subject: [PATCH] gn build: Friendlier error on invalid entries in llvm_targets_to_build llvm-svn: 372515 --- .../utils/gn/secondary/llvm/lib/Target/targets.gni | 47 +++++++++++++--------- 1 file changed, 27 insertions(+), 20 deletions(-) diff --git a/llvm/utils/gn/secondary/llvm/lib/Target/targets.gni b/llvm/utils/gn/secondary/llvm/lib/Target/targets.gni index c3d6fe5..e82dd77 100644 --- a/llvm/utils/gn/secondary/llvm/lib/Target/targets.gni +++ b/llvm/utils/gn/secondary/llvm/lib/Target/targets.gni @@ -5,6 +5,25 @@ declare_args() { llvm_targets_to_build = "host" } +# FIXME: Port the remaining targets. +llvm_all_targets = [ + "AArch64", + "AMDGPU", + "ARM", + "AVR", + "BPF", + "Hexagon", + "Lanai", + "Mips", + "NVPTX", + "PowerPC", + "RISCV", + "Sparc", + "SystemZ", + "WebAssembly", + "X86", +] + if (llvm_targets_to_build == "host") { if (host_cpu == "arm64") { llvm_targets_to_build = [ "AArch64" ] @@ -18,24 +37,7 @@ if (llvm_targets_to_build == "host") { assert(false, "add your host_cpu above") } } else if (llvm_targets_to_build == "all") { - # FIXME: Port the remaining targets. - llvm_targets_to_build = [ - "AArch64", - "AMDGPU", - "ARM", - "AVR", - "BPF", - "Hexagon", - "Lanai", - "Mips", - "NVPTX", - "PowerPC", - "RISCV", - "Sparc", - "SystemZ", - "WebAssembly", - "X86", - ] + llvm_targets_to_build = llvm_all_targets } # Validate that llvm_targets_to_build is set to a list of valid targets, @@ -65,8 +67,13 @@ foreach(target, llvm_targets_to_build) { target == "RISCV" || target == "Sparc" || target == "SystemZ") { # Nothing to do. } else { - # FIXME: Port the remaining targets. - assert(false, "Unknown target '$target'.") + all_targets_string = "" + foreach(target, llvm_all_targets) { + all_targets_string += "$0x0a " + target + } + assert(false, + "Unknown target '$target' in llvm_targets_to_build. " + + "Known targets:" + all_targets_string) } } -- 2.7.4