[libc] Do not install to the default triple in GPU mode
authorJoseph Huber <jhuber6@vols.utk.edu>
Fri, 27 Jan 2023 18:08:28 +0000 (12:08 -0600)
committerJoseph Huber <jhuber6@vols.utk.edu>
Fri, 27 Jan 2023 20:06:00 +0000 (14:06 -0600)
Currently this logic causes the `libcgpu.a` to be installed to the
user's default triple. The GPU target isn't really true to this in a
cross-compiling sense so we should just default to the regular `/lib`
directory

Reviewed By: sivachandra, lntue

Differential Revision: https://reviews.llvm.org/D142774

libc/lib/CMakeLists.txt

index 86246b8..c91097d 100644 (file)
@@ -11,7 +11,7 @@ set_target_properties(
 
 if(LIBC_TARGET_TRIPLE)
   set(LIBC_INSTALL_LIBRARY_DIR lib${LLVM_LIBDIR_SUFFIX}/${LIBC_TARGET_TRIPLE})
-elseif(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR)
+elseif(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT LIBC_GPU_BUILD)
   set(LIBC_INSTALL_LIBRARY_DIR
       lib${LLVM_LIBDIR_SUFFIX}/${LLVM_DEFAULT_TARGET_TRIPLE})
 else()