|
1 | 1 | cmake_minimum_required(VERSION 3.20.0)
|
2 | 2 | set(LLVM_SUBPROJECT_TITLE "libc")
|
3 | 3 |
|
| 4 | +include(CheckCXXCompilerFlag) |
| 5 | + |
4 | 6 | # Include LLVM's cmake policies.
|
5 | 7 | if(NOT DEFINED LLVM_COMMON_CMAKE_UTILS)
|
6 | 8 | set(LLVM_COMMON_CMAKE_UTILS ${CMAKE_CURRENT_SOURCE_DIR}/../cmake)
|
@@ -53,18 +55,19 @@ set(LIBC_NAMESPACE ${default_namespace}
|
53 | 55 |
|
54 | 56 | add_subdirectory(newhdrgen)
|
55 | 57 |
|
56 |
| - |
57 |
| -if(LLVM_LIBC_FULL_BUILD OR LLVM_LIBC_GPU_BUILD) |
58 |
| - if(NOT LIBC_HDRGEN_EXE) |
59 |
| - # We need to set up hdrgen first since other targets depend on it. |
60 |
| - add_subdirectory(utils/LibcTableGenUtil) |
61 |
| - add_subdirectory(utils/HdrGen) |
62 |
| - # Calling add_tablegen sets variables like LIBC_TABLEGEN_EXE in |
63 |
| - # PARENT_SCOPE which get lost until saved in the cache. |
64 |
| - set(LIBC_TABLEGEN_EXE "${LIBC_TABLEGEN_EXE}" CACHE INTERNAL "") |
65 |
| - set(LIBC_TABLEGEN_TARGET "${LIBC_TABLEGEN_TARGET}" CACHE INTERNAL "") |
66 |
| - else() |
67 |
| - message(STATUS "Will use ${LIBC_HDRGEN_EXE} for libc header generation.") |
| 58 | +if(NOT LIBC_USE_NEW_HEADER_GEN) |
| 59 | + if(LLVM_LIBC_FULL_BUILD OR LLVM_LIBC_GPU_BUILD) |
| 60 | + if(NOT LIBC_HDRGEN_EXE) |
| 61 | + # We need to set up hdrgen first since other targets depend on it. |
| 62 | + add_subdirectory(utils/LibcTableGenUtil) |
| 63 | + add_subdirectory(utils/HdrGen) |
| 64 | + # Calling add_tablegen sets variables like LIBC_TABLEGEN_EXE in |
| 65 | + # PARENT_SCOPE which get lost until saved in the cache. |
| 66 | + set(LIBC_TABLEGEN_EXE "${LIBC_TABLEGEN_EXE}" CACHE INTERNAL "") |
| 67 | + set(LIBC_TABLEGEN_TARGET "${LIBC_TABLEGEN_TARGET}" CACHE INTERNAL "") |
| 68 | + else() |
| 69 | + message(STATUS "Will use ${LIBC_HDRGEN_EXE} for libc header generation.") |
| 70 | + endif() |
68 | 71 | endif()
|
69 | 72 | endif()
|
70 | 73 | # We will build the GPU utilities if we are not doing a runtimes build.
|
@@ -353,7 +356,9 @@ endif()
|
353 | 356 |
|
354 | 357 | option(LLVM_LIBC_INCLUDE_SCUDO "Include the SCUDO standalone as the allocator for LLVM libc" OFF)
|
355 | 358 | if(LLVM_LIBC_INCLUDE_SCUDO)
|
356 |
| - if (NOT ("compiler-rt" IN_LIST LLVM_ENABLE_PROJECTS OR "compiler-rt" IN_LIST LLVM_ENABLE_RUNTIMES)) |
| 359 | + if (LLVM_LIBC_COMPILER_RT_PATH) |
| 360 | + add_subdirectory(${LLVM_LIBC_COMPILER_RT_PATH} ${CMAKE_CURRENT_BINARY_DIR}/compiler-rt) |
| 361 | + elseif(NOT ("compiler-rt" IN_LIST LLVM_ENABLE_PROJECTS OR "compiler-rt" IN_LIST LLVM_ENABLE_RUNTIMES)) |
357 | 362 | message(FATAL_ERROR "SCUDO cannot be included without adding compiler-rt to LLVM_ENABLE_PROJECTS or LLVM_ENABLE_RUNTIMES")
|
358 | 363 | endif()
|
359 | 364 | endif()
|
|
0 commit comments