Skip to content

Commit cf3b37c

Browse files
committed
[libc] Add GPU utility dependencies if present
Summary: These tools need to be built before we can do the library creation stage. If they are generated in the same build then this is not guaranteed so we should add explicit dependencies.
1 parent 07b3301 commit cf3b37c

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

libc/cmake/modules/LLVMLibCLibraryRules.cmake

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,9 @@ function(add_gpu_entrypoint_library target_name base_target_name)
132132
)
133133
add_custom_target(${dep}.__gpubin__ DEPENDS ${dep}
134134
"${CMAKE_CURRENT_BINARY_DIR}/binary/${name}.gpubin")
135+
if(TARGET clang-offload-packager)
136+
add_dependencies(${dep}.__gpubin__ clang-offload-packager)
137+
endif()
135138

136139
# CMake does not permit setting the name on object files. In order to have
137140
# human readable names we create an empty stub file with the entrypoint
@@ -209,6 +212,9 @@ function(add_bitcode_entrypoint_library target_name base_target_name)
209212
)
210213
add_custom_target(${target_name} DEPENDS ${output} ${all_deps})
211214
set_target_properties(${target_name} PROPERTIES TARGET_OBJECT ${output})
215+
if(TARGET llvm-link)
216+
add_dependencies(${target_name} llvm-link)
217+
endif()
212218
endfunction(add_bitcode_entrypoint_library)
213219

214220
# A rule to build a library from a collection of entrypoint objects.

0 commit comments

Comments
 (0)