aboutsummaryrefslogtreecommitdiff
path: root/libc/lib
diff options
context:
space:
mode:
authorPetr Hosek <phosek@google.com>2024-01-19 15:45:22 -0800
committerGitHub <noreply@github.com>2024-01-19 15:45:22 -0800
commitb86d02375eb42db49e375484fe26cb837b316cbf (patch)
tree7d046cb764f6a5f881e8e8d4844d710bfa174a16 /libc/lib
parentb7360fbe8ca0c9411e89fafd654856c484f84f5e (diff)
downloadllvm-b86d02375eb42db49e375484fe26cb837b316cbf.zip
llvm-b86d02375eb42db49e375484fe26cb837b316cbf.tar.gz
llvm-b86d02375eb42db49e375484fe26cb837b316cbf.tar.bz2
[libc] Redo the install targets (#78795)
Prior to this change, we wouldn't build headers that aren't referenced by other parts of the libc which would result in a build error during installation. To address this, we make the header target a dependency of the libc archive. Additionally, we also redo the install targets, moving the install targets closer to build targets and simplifying the hierarchy and generally matching what we do for other runtimes.
Diffstat (limited to 'libc/lib')
-rw-r--r--libc/lib/CMakeLists.txt36
1 files changed, 30 insertions, 6 deletions
diff --git a/libc/lib/CMakeLists.txt b/libc/lib/CMakeLists.txt
index f257582..66aaa34 100644
--- a/libc/lib/CMakeLists.txt
+++ b/libc/lib/CMakeLists.txt
@@ -33,6 +33,9 @@ foreach(archive IN ZIP_LISTS
PROPERTIES
ARCHIVE_OUTPUT_NAME ${archive_0}
)
+ if(LLVM_LIBC_FULL_BUILD)
+ target_link_libraries(${archive_1} PUBLIC libc-headers)
+ endif()
list(APPEND added_archive_targets ${archive_1})
endforeach()
@@ -48,11 +51,32 @@ endif()
install(
TARGETS ${added_archive_targets}
ARCHIVE DESTINATION ${LIBC_INSTALL_LIBRARY_DIR}
- COMPONENT libc-static-archives
+ COMPONENT libc
)
-add_llvm_install_targets(
- install-libc-static-archives
- DEPENDS ${added_archive_targets}
- COMPONENT libc-static-archives
-)
+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.
+ set(startup_target "libc-startup")
+endif()
+
+if(LLVM_LIBC_FULL_BUILD)
+ set(header_install_target install-libc-headers)
+endif()
+
+add_custom_target(install-libc
+ DEPENDS ${added_archive_targets}
+ ${startup_target}
+ ${header_install_target}
+ COMMAND "${CMAKE_COMMAND}"
+ -DCMAKE_INSTALL_COMPONENT=libc
+ -P "${LIBCXX_BINARY_DIR}/cmake_install.cmake")
+add_custom_target(install-libc-stripped
+ DEPENDS ${added_archive_targets}
+ ${startup_target}
+ ${header_install_target}
+ COMMAND "${CMAKE_COMMAND}"
+ -DCMAKE_INSTALL_COMPONENT=libc
+ -DCMAKE_INSTALL_DO_STRIP=1
+ -P "${LIBCXX_BINARY_DIR}/cmake_install.cmake")