2 # The target archs LLVM should support. Defaults to the host arch.
3 # Set to a list, e.g. `llvm_targets_to_build = [ "X86", "ARM" ]`,
4 # or to the string "all" to get all known targets.
5 llvm_targets_to_build = "host"
8 # FIXME: Port the remaining targets.
27 if (llvm_targets_to_build == "host") {
28 if (host_cpu == "arm64") {
29 llvm_targets_to_build = [ "AArch64" ]
30 } else if (host_cpu == "arm") {
31 llvm_targets_to_build = [ "ARM" ]
32 } else if (host_cpu == "ppc" || host_cpu == "ppc64") {
33 llvm_targets_to_build = [ "PowerPC" ]
34 } else if (host_cpu == "x86" || host_cpu == "x64") {
35 llvm_targets_to_build = [ "X86" ]
37 assert(false, "add your host_cpu above")
39 } else if (llvm_targets_to_build == "all") {
40 llvm_targets_to_build = llvm_all_targets
43 # Validate that llvm_targets_to_build is set to a list of valid targets,
44 # and remember which targets are built where needed (for conditionally-built
46 llvm_build_AArch64 = false
47 llvm_build_ARM = false
48 llvm_build_BPF = false
49 llvm_build_Mips = false
50 llvm_build_PowerPC = false
51 llvm_build_WebAssembly = false
52 llvm_build_X86 = false
53 foreach(target, llvm_targets_to_build) {
54 if (target == "AArch64") {
55 llvm_build_AArch64 = true
56 } else if (target == "ARM") {
58 } else if (target == "BPF") {
60 } else if (target == "Mips") {
61 llvm_build_Mips = true
62 } else if (target == "PowerPC") {
63 llvm_build_PowerPC = true
64 } else if (target == "WebAssembly") {
65 llvm_build_WebAssembly = true
66 } else if (target == "X86") {
68 } else if (target == "AMDGPU" || target == "AVR" || target == "Hexagon" ||
69 target == "Lanai" || target == "NVPTX" || target == "RISCV" ||
70 target == "Sparc" || target == "SystemZ") {
73 all_targets_string = ""
74 foreach(target, llvm_all_targets) {
75 all_targets_string += "$0x0a " + target
77 assert(false, "Unknown target '$target' in llvm_targets_to_build. " +
78 "Known targets:" + all_targets_string)
82 # FIXME: This should be based off target_cpu once cross compiles work.
83 if (host_cpu == "arm64") {
84 native_target = "AArch64"
85 } else if (host_cpu == "arm") {
87 } else if (host_cpu == "ppc" || host_cpu == "ppc64") {
88 native_target = "PowerPC"
89 } else if (host_cpu == "x86" || host_cpu == "x64") {
92 assert(false, "Unsuppored host_cpu '$host_cpu'.")