File tree Expand file tree Collapse file tree 3 files changed +22
-10
lines changed Expand file tree Collapse file tree 3 files changed +22
-10
lines changed Original file line number Diff line number Diff line change @@ -50,16 +50,28 @@ set(LIBC_NAMESPACE ${default_namespace}
5050 CACHE STRING "The namespace to use to enclose internal implementations. Must start with '__llvm_libc'."
5151)
5252
53-
54- add_subdirectory (newhdrgen)
55-
56-
5753# We will build the GPU utilities if we are not doing a runtimes build.
5854option (LIBC_BUILD_GPU_LOADER "Always build the GPU loader utilities" OFF )
59- if (LIBC_BUILD_GPU_LOADER OR (LLVM_LIBC_GPU_BUILD AND NOT LLVM_RUNTIMES_BUILD))
60- add_subdirectory (utils/gpu)
55+ if (LIBC_BUILD_GPU_LOADER OR NOT LLVM_RUNTIMES_BUILD)
56+ foreach (_name ${LLVM_RUNTIME_TARGETS} )
57+ if ("libc" IN_LIST RUNTIMES_${_name} _LLVM_ENABLE_RUNTIMES)
58+ if ("${_name} " STREQUAL "amdgcn-amd-amdhsa" OR "${_name} " STREQUAL "nvptx64-nvidia-cuda" )
59+ set (LIBC_NEED_LOADER_UTILS TRUE )
60+ endif ()
61+ endif ()
62+ endforeach ()
63+ if ("${LIBC_TARGET_TRIPLE} " STREQUAL "amdgcn-amd-amdhsa" OR
64+ "${LIBC_TARGET_TRIPLE} " STREQUAL "nvptx64-nvidia-cuda" )
65+ set (LIBC_NEED_LOADER_UTILS TRUE )
66+ endif ()
67+ if (LIBC_NEED_LOADER_UTILS)
68+ add_subdirectory (utils/gpu)
69+ return ()
70+ endif ()
6171endif ()
6272
73+ add_subdirectory (newhdrgen)
74+
6375option (LIBC_CMAKE_VERBOSE_LOGGING
6476 "Log details warnings and notifications during CMake configuration." OFF )
6577
Original file line number Diff line number Diff line change @@ -63,10 +63,6 @@ targeting the default host environment as well.
6363Runtimes cross build
6464--------------------
6565
66- .. note ::
67- These instructions need to be updated for new headergen. They may be
68- inaccurate.
69-
7066For users wanting more direct control over the build process, the build steps
7167can be done manually instead. This build closely follows the instructions in the
7268:ref: `main documentation<full_cross_build> ` but is specialized for the GPU
Original file line number Diff line number Diff line change @@ -197,6 +197,10 @@ if("${LIBC_TARGET_TRIPLE}" STREQUAL "amdgcn-amd-amdhsa" OR
197197 "${LIBC_TARGET_TRIPLE} " STREQUAL "nvptx64-nvidia-cuda" )
198198 set (LLVM_LIBC_GPU_BUILD ON )
199199endif ()
200+ if (NOT "libc" IN_LIST LLVM_ENABLE_PROJECTS AND LLVM_LIBC_GPU_BUILD)
201+ message (STATUS "Enabling libc project to build libc testing tools" )
202+ list (APPEND LLVM_ENABLE_PROJECTS "libc" )
203+ endif ()
200204
201205# LLVM_ENABLE_PROJECTS_USED is `ON` if the user has ever used the
202206# `LLVM_ENABLE_PROJECTS` CMake cache variable. This exists for
You can’t perform that action at this time.
0 commit comments