[libc-commits] [PATCH] D144280: [libc] Fix dependencies for generating the GPU binary file
Joseph Huber via Phabricator via libc-commits
libc-commits at lists.llvm.org
Mon Feb 20 07:37:31 PST 2023
This revision was automatically updated to reflect the committed changes.
Closed by commit rG4a872412d868: [libc] Fix dependencies for generating the GPU binary file (authored by jhuber6).
Changed prior to commit:
https://reviews.llvm.org/D144280?vs=498475&id=498853#toc
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D144280/new/
https://reviews.llvm.org/D144280
Files:
libc/cmake/modules/LLVMLibCObjectRules.cmake
Index: libc/cmake/modules/LLVMLibCObjectRules.cmake
===================================================================
--- libc/cmake/modules/LLVMLibCObjectRules.cmake
+++ libc/cmake/modules/LLVMLibCObjectRules.cmake
@@ -132,9 +132,9 @@
add_custom_command(OUTPUT ${packaged_output_name}
COMMAND ${LIBC_CLANG_OFFLOAD_PACKAGER}
${packager_images} -o ${packaged_output_name}
- DEPENDS ${gpu_target_names}
+ DEPENDS ${gpu_target_names} ${ADD_GPU_OBJ_SRCS} ${ADD_GPU_OBJ_HDRS}
COMMENT "Packaging LLVM offloading binary")
- add_custom_target(${packaged_target_name} DEPENDS ${packaged_output_name})
+ add_custom_target(${packaged_target_name} DEPENDS ${packaged_output_name} ${gpu_target_name})
# We create an empty 'stub' file for the host to contain the embedded device
# code. This will be packaged into 'libcgpu.a'.
@@ -142,20 +142,28 @@
# into a single bitcode file and use that. For now we simply build for
# every single one and let the offloading linker handle it.
get_filename_component(stub_filename ${ADD_GPU_OBJ_SRCS} NAME)
- file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/stubs)
- file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/stubs/${stub_filename} "// Empty file.\n")
+ add_custom_command(
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/stubs/${stub_filename}"
+ COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/stubs/
+ COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_BINARY_DIR}/stubs/${stub_filename}
+ DEPENDS ${gpu_target_names} ${ADD_GPU_OBJ_SRCS} ${ADD_GPU_OBJ_HDRS}
+ )
+ set(stub_target_name ${fq_target_name}.__stub__)
+ add_custom_target(${stub_target_name} DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/stubs/${stub_filename})
+
add_library(
${fq_target_name}
# We want an object library as the objects will eventually get packaged into
# an archive (like libcgpu.a).
EXCLUDE_FROM_ALL
OBJECT
- "${CMAKE_CURRENT_BINARY_DIR}/stubs/${stub_filename}"
+ ${CMAKE_CURRENT_BINARY_DIR}/stubs/${stub_filename}
)
target_compile_options(${fq_target_name} BEFORE PRIVATE ${common_compile_options}
-nostdlib -Xclang -fembed-offload-object=${packaged_output_name})
target_include_directories(${fq_target_name} PRIVATE ${include_dirs})
- add_dependencies(${fq_target_name} ${full_deps_list} ${packaged_target_name})
+ add_dependencies(${fq_target_name}
+ ${full_deps_list} ${packaged_target_name} ${stub_target_name})
# We only build the internal target for a single supported architecture.
set(include_dirs ${LIBC_BUILD_DIR}/include ${LIBC_SOURCE_DIR} ${LIBC_BUILD_DIR})
@@ -561,7 +569,6 @@
)
endif()
-
if(LLVM_LIBC_ENABLE_LINTING AND TARGET ${internal_target_name})
if(NOT LLVM_LIBC_CLANG_TIDY)
message(FATAL_ERROR "Something is wrong! LLVM_LIBC_ENABLE_LINTING is "
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D144280.498853.patch
Type: text/x-patch
Size: 2963 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libc-commits/attachments/20230220/7f7f2d84/attachment-0001.bin>
More information about the libc-commits
mailing list