[libc-commits] [PATCH] D141112: [libc] Add a separate install target for the libc static archives.

Siva Chandra via Phabricator via libc-commits libc-commits at lists.llvm.org
Fri Jan 6 15:30:55 PST 2023


sivachandra updated this revision to Diff 487004.
sivachandra added a comment.

Remove an intermediate variable.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D141112/new/

https://reviews.llvm.org/D141112

Files:
  libc/CMakeLists.txt
  libc/lib/CMakeLists.txt


Index: libc/lib/CMakeLists.txt
===================================================================
--- libc/lib/CMakeLists.txt
+++ libc/lib/CMakeLists.txt
@@ -9,14 +9,23 @@
     ARCHIVE_OUTPUT_NAME ${LIBC_ARCHIVE_NAME}
 )
 
-if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR)
-  set(LIBC_INSTALL_LIBRARY_DIR lib${LLVM_LIBDIR_SUFFIX}/${LLVM_DEFAULT_TARGET_TRIPLE})
+if(LIBC_TARGET_TRIPLE)
+  set(LIBC_INSTALL_LIBRARY_DIR lib${LLVM_LIBDIR_SUFFIX}/${LIBC_TARGET_TRIPLE})
+elseif(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR)
+  set(LIBC_INSTALL_LIBRARY_DIR
+      lib${LLVM_LIBDIR_SUFFIX}/${LLVM_DEFAULT_TARGET_TRIPLE})
 else()
   set(LIBC_INSTALL_LIBRARY_DIR lib${LLVM_LIBDIR_SUFFIX})
 endif()
 
 install(
   TARGETS ${LIBC_TARGET}
-  ARCHIVE DESTINATION "${LIBC_INSTALL_LIBRARY_DIR}"
-  COMPONENT ${LIBC_COMPONENT}
+  ARCHIVE DESTINATION ${LIBC_INSTALL_LIBRARY_DIR}
+  COMPONENT libc-static-archives
+)
+
+add_llvm_install_targets(
+  install-libc-static-archives
+  DEPENDS ${LIBC_TARGET}
+  COMPONENT libc-static-archives
 )
Index: libc/CMakeLists.txt
===================================================================
--- libc/CMakeLists.txt
+++ libc/CMakeLists.txt
@@ -163,7 +163,13 @@
 if(LLVM_LIBC_FULL_BUILD)
   set(LIBC_TARGET libc)
   set(LIBC_COMPONENT libc)
-  set(LIBC_INSTALL_DEPENDS "libc;install-libc-headers;libc-startup")
+  set(LIBC_INSTALL_DEPENDS "install-libc-static-archives;install-libc-headers")
+  if(NOT LIBC_TARGET_OS_IS_BAREMETAL)
+    # For now we will disable libc-startup installation for baremetal. The
+    # correct way to do it would be to make a hookable startup for baremetal
+    # and install it as part of the libc installation.
+    list(APPEND LIBC_INSTALL_DEPENDS "libc-startup")
+  endif()
   set(LIBC_INSTALL_TARGET install-libc)
   if(LIBC_TARGET_ARCHITECTURE_IS_GPU)
     set(LIBC_ARCHIVE_NAME cgpu)
@@ -173,7 +179,7 @@
 else()
   set(LIBC_TARGET llvmlibc)
   set(LIBC_COMPONENT llvmlibc)
-  set(LIBC_INSTALL_DEPENDS llvmlibc)
+  set(LIBC_INSTALL_DEPENDS install-libc-static-archives)
   set(LIBC_INSTALL_TARGET install-llvmlibc)
   set(LIBC_ARCHIVE_NAME llvmlibc)
 endif()


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D141112.487004.patch
Type: text/x-patch
Size: 2099 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libc-commits/attachments/20230106/3b4946c1/attachment.bin>


More information about the libc-commits mailing list