diff options
author | Joseph Huber <huberjn@outlook.com> | 2024-02-23 14:11:43 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-23 14:11:43 -0600 |
commit | b43dd08aa31f37cb9517a80f394631a7d8ff6b90 (patch) | |
tree | 1cb53931c3a4105fc7be456c519cba1d62928d40 /libc/lib | |
parent | 1a2ecbb3980a3005c2027eb5b69bbbe32c9c8294 (diff) | |
download | llvm-b43dd08aa31f37cb9517a80f394631a7d8ff6b90.zip llvm-b43dd08aa31f37cb9517a80f394631a7d8ff6b90.tar.gz llvm-b43dd08aa31f37cb9517a80f394631a7d8ff6b90.tar.bz2 |
[libc] Install a single LLVM-IR version of the GPU library (#82791)
Summary:
Recent patches have allowed us to treat these libraries as direct
builds. This makes it easier to simply build them to a single LLVM-IR
file. This matches the way these files are presented by the ROCm and
CUDA toolchains and makes it easier to work with.
Diffstat (limited to 'libc/lib')
-rw-r--r-- | libc/lib/CMakeLists.txt | 36 |
1 files changed, 27 insertions, 9 deletions
diff --git a/libc/lib/CMakeLists.txt b/libc/lib/CMakeLists.txt index 615f427..e5ebd1e1 100644 --- a/libc/lib/CMakeLists.txt +++ b/libc/lib/CMakeLists.txt @@ -40,22 +40,33 @@ foreach(archive IN ZIP_LISTS # Add the offloading version of the library for offloading languages. These # are installed in the standard search path separate from the other libraries. if(LIBC_TARGET_OS_IS_GPU) - set(libc_gpu_archive_target ${archive_1}gpu) - set(libc_gpu_archive_name ${archive_0}gpu-${LIBC_TARGET_ARCHITECTURE}) - add_gpu_entrypoint_library( - ${libc_gpu_archive_target} + ${archive_1}gpu + ${archive_1} DEPENDS ${${archive_2}} ) set_target_properties( - ${libc_gpu_archive_target} + ${archive_1}gpu PROPERTIES - ARCHIVE_OUTPUT_NAME ${libc_gpu_archive_name} + ARCHIVE_OUTPUT_NAME ${archive_0}gpu-${LIBC_TARGET_ARCHITECTURE} + ARCHIVE_OUTPUT_DIRECTORY ${LLVM_LIBRARY_OUTPUT_INTDIR} + ) + list(APPEND added_gpu_archive_targets ${archive_1}gpu) + + add_bitcode_entrypoint_library( + ${archive_1}bitcode + ${archive_1} + DEPENDS + ${${archive_2}} ) - set_target_properties(${libc_gpu_archive_target} PROPERTIES - ARCHIVE_OUTPUT_DIRECTORY ${LLVM_LIBRARY_OUTPUT_INTDIR}) - list(APPEND added_gpu_archive_targets ${libc_gpu_archive_target}) + set_target_properties( + ${archive_1}bitcode + PROPERTIES + OUTPUT_NAME ${archive_1}.bc + ) + add_dependencies(${archive_1}gpu ${archive_1}bitcode) + list(APPEND added_gpu_bitcode_targets ${archive_1}bitcode) endif() endforeach() @@ -71,6 +82,13 @@ if(LIBC_TARGET_OS_IS_GPU) ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX} COMPONENT libc ) + foreach(file ${added_gpu_bitcode_targets}) + install(FILES $<TARGET_PROPERTY:${file},TARGET_OBJECT> + DESTINATION ${LIBC_INSTALL_LIBRARY_DIR} + RENAME $<TARGET_PROPERTY:${file},OUTPUT_NAME> + COMPONENT libc + ) + endforeach() endif() if(NOT LIBC_TARGET_OS_IS_BAREMETAL) |