File tree Expand file tree Collapse file tree 3 files changed +16
-12
lines changed Expand file tree Collapse file tree 3 files changed +16
-12
lines changed Original file line number Diff line number Diff line change @@ -18,3 +18,5 @@ target_include_directories(libc-hdrgen PRIVATE ${LLVM_INCLUDE_DIR} ${LLVM_MAIN_I
18
18
target_link_libraries (libc-hdrgen PRIVATE LibcTableGenUtil )
19
19
20
20
add_subdirectory (PrototypeTestGen )
21
+
22
+ setup_host_tool (libc-hdrgen LIBC_HDRGEN libc_hdrgen_exe libc_hdrgen_target )
Original file line number Diff line number Diff line change @@ -67,6 +67,12 @@ function(llvm_create_cross_target project_name target_name toolchain buildtype)
67
67
"-DLLVM_EXTERNAL_${name} _SOURCE_DIR=${LLVM_EXTERNAL_${name} _SOURCE_DIR}" )
68
68
endforeach ()
69
69
70
+ if ("libc" IN_LIST LLVM_ENABLE_PROJECTS )
71
+ if (LLVM_LIBC_FULL_BUILD AND NOT LIBC_HDRGEN_EXE )
72
+ set (libc_flags -DLLVM_LIBC_FULL_BUILD=ON -DLIBC_HDRGEN_ONLY=ON )
73
+ endif ()
74
+ endif ()
75
+
70
76
add_custom_command (OUTPUT ${${project_name}_${target_name}_BUILD}/CMakeCache.txt
71
77
COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR} "
72
78
-DCMAKE_MAKE_PROGRAM= "${CMAKE_MAKE_PROGRAM} "
@@ -86,7 +92,7 @@ function(llvm_create_cross_target project_name target_name toolchain buildtype)
86
92
-DLLVM_TEMPORARILY_ALLOW_OLD_TOOLCHAIN= "${LLVM_TEMPORARILY_ALLOW_OLD_TOOLCHAIN} "
87
93
-DLLVM_INCLUDE_BENCHMARKS=OFF
88
94
-DLLVM_INCLUDE_TESTS=OFF
89
- ${build_type_flags} ${linker_flag} ${external_clang_dir}
95
+ ${build_type_flags} ${linker_flag} ${external_clang_dir} ${libc_flags}
90
96
${ARGN}
91
97
WORKING_DIRECTORY ${${project_name}_${target_name}_BUILD}
92
98
DEPENDS CREATE_${project_name}_${target_name}
Original file line number Diff line number Diff line change @@ -425,18 +425,14 @@ if(runtimes)
425
425
endif ()
426
426
if ("libc" IN_LIST LLVM_ENABLE_PROJECTS AND
427
427
(LLVM_LIBC_FULL_BUILD OR LIBC_GPU_BUILD OR LIBC_GPU_ARCHITECTURES ))
428
- if (TARGET libc-hdrgen )
429
- set (libc_tools libc-hdrgen )
430
- set (libc_cmake_args "-DLIBC_HDRGEN_EXE=$<TARGET_FILE:libc-hdrgen>"
431
- "-DLLVM_LIBC_FULL_BUILD=ON" )
432
- list (APPEND extra_deps ${libc_tools} )
433
- else ()
434
- # We want to build the libc build tools before we can build the libc
435
- # itself. So, the libc project should be included in LLVM_ENABLE_PROJECTS.
436
- # This should have been done in llvm/CMakeLists.txt automatically when
437
- # "libc" is detected in LLVM_ENABLE_RUNTIMES.
438
- message (FATAL_ERROR "libc-hdrgen target missing unexpectedly" )
428
+ get_host_tool_path (libc-hdrgen LIBC_HDRGEN libc_hdrgen_exe libc_hdrgen_target )
429
+ if (NOT libc_hdrgen_exe )
430
+ message (FATAL_ERROR "libc-hdrgen executable missing" )
439
431
endif ()
432
+ set (libc_cmake_args "-DLIBC_HDRGEN_EXE=${libc_hdrgen_exe} "
433
+ "-DLLVM_LIBC_FULL_BUILD=ON" )
434
+ set (libc_tools libc_hdrgen_target )
435
+ list (APPEND extra_deps ${libc_hdrgen_target} )
440
436
if (LIBC_GPU_BUILD OR LIBC_GPU_ARCHITECTURES )
441
437
foreach (dep clang-offload-packager nvptx-arch amdgpu-arch )
442
438
if (TARGET ${dep} )
You can’t perform that action at this time.
0 commit comments