diff options
author | Ross Burton <ross.burton@arm.com> | 2025-07-21 14:24:24 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2025-07-21 23:00:18 +0100 |
commit | cdc1a949c072c4ceaa3f94c1cdd84acea8ca7f5c (patch) | |
tree | f934f97a3045e8acb706280ca881655c270e5d54 | |
parent | 56e1ae0ccf8b5e206e0721c4dc22bd1e701966a9 (diff) | |
download | poky-cdc1a949c072c4ceaa3f94c1cdd84acea8ca7f5c.tar.gz |
clang: improve LLVM target selection logic
The GPU targets are incredibly slow to build, so if the DISTRO_FEATURES
doesn't include opengl or vulkan assume that the user will not be using
a GPU and disable them.
Alternatively, a distribution could state that they'll only be using
one of the backends, and set LLVM_TARGETS_GPU explicitly.
On my build machine, disabling the GPU targets reduces the build time of
clang-native from 21m to 16m.
(From OE-Core rev: 2273a0685757421f39541a352d77b67e5ba604d3)
Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | meta/recipes-devtools/clang/clang_git.bb | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/meta/recipes-devtools/clang/clang_git.bb b/meta/recipes-devtools/clang/clang_git.bb index a85626c45a..484f065a55 100644 --- a/meta/recipes-devtools/clang/clang_git.bb +++ b/meta/recipes-devtools/clang/clang_git.bb | |||
@@ -112,16 +112,18 @@ CLANG_DEFAULT_CXX_STDLIB;CLANG_DEFAULT_RTLIB;CLANG_DEFAULT_UNWINDLIB;\ | |||
112 | CLANG_DEFAULT_OPENMP_RUNTIME;LLVM_ENABLE_PER_TARGET_RUNTIME_DIR;\ | 112 | CLANG_DEFAULT_OPENMP_RUNTIME;LLVM_ENABLE_PER_TARGET_RUNTIME_DIR;\ |
113 | LLVM_BUILD_TOOLS;LLVM_USE_HOST_TOOLS;LLVM_CONFIG_PATH;LLVM_EXTERNAL_SPIRV_HEADERS_SOURCE_DIR;\ | 113 | LLVM_BUILD_TOOLS;LLVM_USE_HOST_TOOLS;LLVM_CONFIG_PATH;LLVM_EXTERNAL_SPIRV_HEADERS_SOURCE_DIR;\ |
114 | " | 114 | " |
115 | |||
116 | # By default we build all the supported CPU architectures, and the GPU targets | ||
117 | # if the opengl or vulkan DISTRO_FEATURES are enabled. | ||
118 | # | ||
119 | # For target builds we default to building that specific architecture, BPF, and the GPU targets if required. | ||
115 | # | 120 | # |
116 | # Default to build all OE-Core supported target arches (user overridable). | 121 | # The available target list can be seen in the source code |
117 | # Gennerally setting LLVM_TARGETS_TO_BUILD = "" in local.conf is ok in most simple situations | 122 | # in the LLVM_ALL_TARGETS assignment: |
118 | # where only one target architecture is needed along with just one build arch (usually X86) | 123 | # https://github.com/llvm/llvm-project/blob/main/llvm/CMakeLists.txt |
119 | # Core tier targets: | 124 | LLVM_TARGETS_GPU ?= "${@bb.utils.contains_any('DISTRO_FEATURES', 'opengl vulkan', 'AMDGPU;NVPTX;SPIRV', '', d)}" |
120 | # AArch64;AMDGPU;ARM;AVR;BPF;Hexagon;Lanai;LoongArch;Mips;MSP430;NVPTX;PowerPC;RISCV;Sparc;SPIRV;SystemZ;VE;WebAssembly;X86;XCore | 125 | LLVM_TARGETS_TO_BUILD ?= "AArch64;ARM;BPF;Mips;PowerPC;RISCV;X86;LoongArch;${LLVM_TARGETS_GPU}" |
121 | # Known experimental targets: ARC;CSKY;DirectX;M68k;Xtensa | 126 | LLVM_TARGETS_TO_BUILD:class-target ?= "${@get_clang_host_arch(bb, d)};BPF;${LLVM_TARGETS_GPU}" |
122 | |||
123 | LLVM_TARGETS_TO_BUILD ?= "AMDGPU;AArch64;ARM;BPF;Mips;PowerPC;RISCV;X86;LoongArch;NVPTX;SPIRV" | ||
124 | LLVM_TARGETS_TO_BUILD:class-target ?= "${@get_clang_host_arch(bb, d)};AMDGPU;BPF;NVPTX;SPIRV" | ||
125 | 127 | ||
126 | LLVM_EXPERIMENTAL_TARGETS_TO_BUILD ?= "" | 128 | LLVM_EXPERIMENTAL_TARGETS_TO_BUILD ?= "" |
127 | 129 | ||