brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.2 KiB · ce0b07f Raw
100 lines · plain
1set(libc_archive_targets "")2set(libc_archive_names "")3set(libc_archive_entrypoint_lists "")4if(LLVM_LIBC_FULL_BUILD)5  list(APPEND libc_archive_names c m)6  list(APPEND libc_archive_targets libc libm)7  list(APPEND libc_archive_entrypoint_lists8       TARGET_LIBC_ENTRYPOINTS TARGET_LIBM_ENTRYPOINTS)9else()10  list(APPEND libc_archive_names llvmlibc)11  list(APPEND libc_archive_targets libc)12  list(APPEND libc_archive_entrypoint_lists TARGET_LLVMLIBC_ENTRYPOINTS)13endif()14 15set(added_archive_targets "")16foreach(archive IN ZIP_LISTS17        libc_archive_names libc_archive_targets libc_archive_entrypoint_lists)18  if(NOT ${archive_2})19    # If an entrypoint list is missing, then skip adding targets for it.20    continue()21  endif()22  add_entrypoint_library(23    ${archive_1}24    DEPENDS25      ${${archive_2}}26  )27  set_target_properties(28    ${archive_1}29    PROPERTIES30      ARCHIVE_OUTPUT_NAME ${archive_0}31  )32  if(LLVM_LIBC_FULL_BUILD)33    target_link_libraries(${archive_1} PUBLIC libc-headers)34    if(TARGET libc-startup)35      add_dependencies(${archive_1} libc-startup)36    endif()37  endif()38  list(APPEND added_archive_targets ${archive_1})39 40  # Add the offloading version of the library for offloading languages. These41  # are installed in the standard search path separate from the other libraries.42  if(LIBC_TARGET_OS_IS_GPU)43    add_bitcode_entrypoint_library(44      ${archive_1}bitcode45      ${archive_1}46      DEPENDS47        ${${archive_2}}48    )49    set_target_properties(50      ${archive_1}bitcode51      PROPERTIES52        OUTPUT_NAME ${archive_1}.bc53    )54    list(APPEND added_bitcode_targets ${archive_1}bitcode)55  endif()56endforeach()57 58install(59  TARGETS ${added_archive_targets}60  ARCHIVE DESTINATION ${LIBC_INSTALL_LIBRARY_DIR}61  COMPONENT libc62)63 64foreach(file ${added_bitcode_targets})65  install(FILES $<TARGET_FILE:${file}>66          DESTINATION ${LIBC_INSTALL_LIBRARY_DIR}67          RENAME $<TARGET_PROPERTY:${file},OUTPUT_NAME>68          COMPONENT libc69  )70endforeach()71 72if(NOT LIBC_TARGET_OS_IS_BAREMETAL)73  # For now we will disable libc-startup installation for baremetal. The74  # correct way to do it would be to make a hookable startup for baremetal75  # and install it as part of the libc installation.76  set(startup_target "libc-startup")77endif()78 79if(LLVM_LIBC_FULL_BUILD)80  set(header_install_target install-libc-headers)81endif()82 83add_custom_target(install-libc84                  DEPENDS ${added_archive_targets}85                          ${added_bitcode_targets}86                          ${startup_target}87                          ${header_install_target}88                  COMMAND "${CMAKE_COMMAND}"89                          -DCMAKE_INSTALL_COMPONENT=libc90                          -P "${CMAKE_BINARY_DIR}/cmake_install.cmake")91add_custom_target(install-libc-stripped92                  DEPENDS ${added_archive_targets}93                          ${added_bitcode_targets}94                          ${startup_target}95                          ${header_install_target}96                  COMMAND "${CMAKE_COMMAND}"97                          -DCMAKE_INSTALL_COMPONENT=libc98                          -DCMAKE_INSTALL_DO_STRIP=199                          -P "${CMAKE_BINARY_DIR}/cmake_install.cmake")100