Author: Fraser Cormack Date: 2025-06-05T17:56:21+01:00 New Revision: 6306f0fa21739d426b5ce394b356a482a4f43e98
URL: https://github.com/llvm/llvm-project/commit/6306f0fa21739d426b5ce394b356a482a4f43e98 DIFF: https://github.com/llvm/llvm-project/commit/6306f0fa21739d426b5ce394b356a482a4f43e98.diff LOG: [libclc] Support LLVM_ENABLE_RUNTIMES when building (#141574) This commit deprecates the use of LLVM_ENABLE_PROJECTS in favour of LLVM_ENABLE_RUNTIMES when building libclc. Alternatively, using -DLLVM_RUNTIME_TARGETS=<triple> combined with -DRUNTIMES_<triple>_LLVM_ENABLE_RUNTIMES=libclc also gets pretty far but fails due to zlib problems building the LLVM utility 'prepare_builtins'. I'm not sure what's going on there but I don't think it's required at this stage. More work would be required to support that option. This does nothing to change how the host tools are found in order to be used to actually build the libclc libraries. Note that under such a configuration the final libclc builtin libraries are placed in `<build>/runtimes/runtimes-bins/libclc/`, which differs from a non-runtimes build. The installation location remains the same. Fixes #124013. Added: Modified: libclc/CMakeLists.txt llvm/CMakeLists.txt llvm/runtimes/CMakeLists.txt runtimes/CMakeLists.txt Removed: ################################################################################ diff --git a/libclc/CMakeLists.txt b/libclc/CMakeLists.txt index 2611818ff902f..c98e2043464d9 100644 --- a/libclc/CMakeLists.txt +++ b/libclc/CMakeLists.txt @@ -72,7 +72,7 @@ else() # Note that we check this later (for both build types) but we can provide a # more useful error message when built in-tree. We assume that LLVM tools are # always available so don't warn here. - if( NOT clang IN_LIST LLVM_ENABLE_PROJECTS ) + if( NOT LLVM_RUNTIMES_BUILD AND NOT clang IN_LIST LLVM_ENABLE_PROJECTS ) message(FATAL_ERROR "Clang is not enabled, but is required to build libclc in-tree") endif() diff --git a/llvm/CMakeLists.txt b/llvm/CMakeLists.txt index 1440646762f62..206f009b45f59 100644 --- a/llvm/CMakeLists.txt +++ b/llvm/CMakeLists.txt @@ -141,7 +141,7 @@ endforeach() # As we migrate runtimes to using the bootstrapping build, the set of default runtimes # should grow as we remove those runtimes from LLVM_ENABLE_PROJECTS above. set(LLVM_DEFAULT_RUNTIMES "libcxx;libcxxabi;libunwind") -set(LLVM_SUPPORTED_RUNTIMES "libc;libunwind;libcxxabi;pstl;libcxx;compiler-rt;openmp;llvm-libgcc;offload;flang-rt") +set(LLVM_SUPPORTED_RUNTIMES "libc;libunwind;libcxxabi;pstl;libcxx;compiler-rt;openmp;llvm-libgcc;offload;flang-rt;libclc") set(LLVM_ENABLE_RUNTIMES "" CACHE STRING "Semicolon-separated list of runtimes to build, or \"all\" (${LLVM_DEFAULT_RUNTIMES}). Supported runtimes are ${LLVM_SUPPORTED_RUNTIMES}.") if(LLVM_ENABLE_RUNTIMES STREQUAL "all") @@ -204,6 +204,13 @@ if ("flang-rt" IN_LIST LLVM_ENABLE_RUNTIMES) endif () endif () +if ("libclc" IN_LIST LLVM_ENABLE_PROJECTS) + message(WARNING "Using LLVM_ENABLE_PROJECTS=libclc is deprecated now, and will " + "become a fatal error in the LLVM 21 release. Please use " + "-DLLVM_ENABLE_RUNTIMES=libclc or see the instructions at " + "https://libclc.llvm.org/ for building the runtimes.") +endif() + # Set a shorthand option to enable the GPU build of the 'libc' project. option(LIBC_GPU_BUILD "Enable the 'libc' project targeting the GPU" OFF) if(LIBC_GPU_BUILD) diff --git a/llvm/runtimes/CMakeLists.txt b/llvm/runtimes/CMakeLists.txt index cabadfc9184f8..9f86650ec58d1 100644 --- a/llvm/runtimes/CMakeLists.txt +++ b/llvm/runtimes/CMakeLists.txt @@ -193,7 +193,7 @@ endif() function(_get_runtime_name name out_var) string(FIND ${name} "lib" idx) - if(idx EQUAL 0 AND NOT ${name} STREQUAL "libc") + if(idx EQUAL 0 AND NOT (${name} STREQUAL "libc" OR ${name} STREQUAL "libclc")) string(SUBSTRING ${name} 3 -1 name) endif() set(${out_var} ${name} PARENT_SCOPE) diff --git a/runtimes/CMakeLists.txt b/runtimes/CMakeLists.txt index 7f1e2ae065d6c..878b2eee38618 100644 --- a/runtimes/CMakeLists.txt +++ b/runtimes/CMakeLists.txt @@ -35,7 +35,7 @@ list(INSERT CMAKE_MODULE_PATH 0 # We order libraries to mirror roughly how they are layered, except that compiler-rt can depend # on libc++, so we put it after. -set(LLVM_DEFAULT_RUNTIMES "libc;libunwind;libcxxabi;pstl;libcxx;compiler-rt;openmp;offload") +set(LLVM_DEFAULT_RUNTIMES "libc;libunwind;libcxxabi;pstl;libcxx;compiler-rt;libclc;openmp;offload") set(LLVM_SUPPORTED_RUNTIMES "${LLVM_DEFAULT_RUNTIMES};llvm-libgcc;flang-rt") set(LLVM_ENABLE_RUNTIMES "" CACHE STRING "Semicolon-separated list of runtimes to build, or \"all\" (${LLVM_DEFAULT_RUNTIMES}). Supported runtimes are ${LLVM_SUPPORTED_RUNTIMES}.") _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits