[libc-commits] [PATCH] D151624: [libc][CMake] Place archives in build/lib/<target-triple>

Aiden Grossman via Phabricator via libc-commits libc-commits at lists.llvm.org
Sat Jun 3 15:43:47 PDT 2023


This revision was automatically updated to reflect the committed changes.
Closed by commit rGea8f4b984197: [libc][CMake] Place archives in build/lib/<target-triple> (authored by aidengrossman).

Changed prior to commit:
  https://reviews.llvm.org/D151624?vs=526305&id=528157#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D151624

Files:
  libc/CMakeLists.txt
  libc/cmake/modules/LLVMLibCLibraryRules.cmake


Index: libc/cmake/modules/LLVMLibCLibraryRules.cmake
===================================================================
--- libc/cmake/modules/LLVMLibCLibraryRules.cmake
+++ libc/cmake/modules/LLVMLibCLibraryRules.cmake
@@ -108,7 +108,7 @@
     STATIC
     ${objects}
   )
-  set_target_properties(${target_name}  PROPERTIES ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
+  set_target_properties(${target_name} PROPERTIES ARCHIVE_OUTPUT_DIRECTORY ${LIBC_LIBRARY_DIR})
 endfunction(add_entrypoint_library)
 
 # Rule to build a shared library of redirector objects.
@@ -135,7 +135,7 @@
     SHARED
     ${obj_files}
   )
-  set_target_properties(${target_name}  PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
+  set_target_properties(${target_name}  PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${LIBC_LIBRARY_DIR})
   target_link_libraries(${target_name}  -nostdlib -lc -lm)
   set_target_properties(${target_name}  PROPERTIES LINKER_LANGUAGE "C")
 endfunction(add_redirector_library)
Index: libc/CMakeLists.txt
===================================================================
--- libc/CMakeLists.txt
+++ libc/CMakeLists.txt
@@ -12,12 +12,21 @@
 
 list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules")
 
-# The top-level sourse and binary directories.
+# The top-level source directory.
 set(LIBC_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
-set(LIBC_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})
 # The top-level directory in which libc is being built.
 set(LIBC_BUILD_DIR ${CMAKE_CURRENT_BINARY_DIR})
 
+if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR)
+  set(LIBC_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}/${LLVM_DEFAULT_TARGET_TRIPLE})
+else()
+  if(LLVM_LIBRARY_OUTPUT_INTDIR)
+    set(LIBC_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR})
+  else()
+    set(LIBC_LIBRARY_DIR ${CMAKE_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX})
+  endif()
+endif()
+
 if(LLVM_LIBC_FULL_BUILD OR LIBC_GPU_BUILD OR LIBC_GPU_ARCHITECTURES)
   if(NOT LIBC_HDRGEN_EXE)
     # We need to set up hdrgen first since other targets depend on it.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D151624.528157.patch
Type: text/x-patch
Size: 2033 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libc-commits/attachments/20230603/1835b956/attachment.bin>


More information about the libc-commits mailing list