[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.
This commit is contained in:
@@ -72,7 +72,7 @@ else()
|
|||||||
# Note that we check this later (for both build types) but we can provide a
|
# 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
|
# more useful error message when built in-tree. We assume that LLVM tools are
|
||||||
# always available so don't warn here.
|
# 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")
|
message(FATAL_ERROR "Clang is not enabled, but is required to build libclc in-tree")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|||||||
@@ -141,7 +141,7 @@ endforeach()
|
|||||||
# As we migrate runtimes to using the bootstrapping build, the set of default runtimes
|
# 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.
|
# should grow as we remove those runtimes from LLVM_ENABLE_PROJECTS above.
|
||||||
set(LLVM_DEFAULT_RUNTIMES "libcxx;libcxxabi;libunwind")
|
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
|
set(LLVM_ENABLE_RUNTIMES "" CACHE STRING
|
||||||
"Semicolon-separated list of runtimes to build, or \"all\" (${LLVM_DEFAULT_RUNTIMES}). Supported runtimes are ${LLVM_SUPPORTED_RUNTIMES}.")
|
"Semicolon-separated list of runtimes to build, or \"all\" (${LLVM_DEFAULT_RUNTIMES}). Supported runtimes are ${LLVM_SUPPORTED_RUNTIMES}.")
|
||||||
if(LLVM_ENABLE_RUNTIMES STREQUAL "all")
|
if(LLVM_ENABLE_RUNTIMES STREQUAL "all")
|
||||||
@@ -204,6 +204,13 @@ if ("flang-rt" IN_LIST LLVM_ENABLE_RUNTIMES)
|
|||||||
endif ()
|
endif ()
|
||||||
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.
|
# 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)
|
option(LIBC_GPU_BUILD "Enable the 'libc' project targeting the GPU" OFF)
|
||||||
if(LIBC_GPU_BUILD)
|
if(LIBC_GPU_BUILD)
|
||||||
|
|||||||
@@ -193,7 +193,7 @@ endif()
|
|||||||
|
|
||||||
function(_get_runtime_name name out_var)
|
function(_get_runtime_name name out_var)
|
||||||
string(FIND ${name} "lib" idx)
|
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)
|
string(SUBSTRING ${name} 3 -1 name)
|
||||||
endif()
|
endif()
|
||||||
set(${out_var} ${name} PARENT_SCOPE)
|
set(${out_var} ${name} PARENT_SCOPE)
|
||||||
|
|||||||
@@ -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
|
# We order libraries to mirror roughly how they are layered, except that compiler-rt can depend
|
||||||
# on libc++, so we put it after.
|
# 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_SUPPORTED_RUNTIMES "${LLVM_DEFAULT_RUNTIMES};llvm-libgcc;flang-rt")
|
||||||
set(LLVM_ENABLE_RUNTIMES "" CACHE STRING
|
set(LLVM_ENABLE_RUNTIMES "" CACHE STRING
|
||||||
"Semicolon-separated list of runtimes to build, or \"all\" (${LLVM_DEFAULT_RUNTIMES}). Supported runtimes are ${LLVM_SUPPORTED_RUNTIMES}.")
|
"Semicolon-separated list of runtimes to build, or \"all\" (${LLVM_DEFAULT_RUNTIMES}). Supported runtimes are ${LLVM_SUPPORTED_RUNTIMES}.")
|
||||||
|
|||||||
Reference in New Issue
Block a user