[PATCH] D23752: cmake: Supporting overriding runtime libdir via CLANG_LIBDIR_SUFFIX

Michał Górny via cfe-commits cfe-commits at lists.llvm.org
Sun Aug 21 00:42:38 PDT 2016


mgorny created this revision.
mgorny added reviewers: chandlerc, chapuni, samsonov.
mgorny added a subscriber: cfe-commits.

Make it possible to override the value of CLANG_LIBDIR_SUFFIX, and use it uniformly to control install location of runtimes (i.e. lib/clang), therefore supporting sharing a common runtime between multiple multilib variants.

Previously, CLANG_LIBDIR_SUFFIX was pinned to LLVM_LIBDIR_SUFFIX and used only to define runtime path in driver code. This patch extends its use to building and installing the runtime (the former is needed for tests to work correctly).

The goal is to support install layout alike "LLVM_LIBDIR_SUFFIX=64 CLANG_LIBDIR_SUFFIX=''" -- where all shared libraries would be installed into ABI-specific /usr/lib64, while runtime (that is common between multilib ABIs) would be installed into /usr/lib.

Bug: https://llvm.org/bugs/show_bug.cgi?id=23792

https://reviews.llvm.org/D23752

Files:
  CMakeLists.txt
  lib/Headers/CMakeLists.txt
  runtime/CMakeLists.txt

Index: runtime/CMakeLists.txt
===================================================================
--- runtime/CMakeLists.txt
+++ runtime/CMakeLists.txt
@@ -71,9 +71,9 @@
                -DCMAKE_MAKE_PROGRAM=${CMAKE_MAKE_PROGRAM}
                -DLLVM_CONFIG_PATH=${LLVM_RUNTIME_OUTPUT_INTDIR}/llvm-config
                -DLLVM_LIT_ARGS=${LLVM_LIT_ARGS}
-               -DCOMPILER_RT_OUTPUT_DIR=${LLVM_LIBRARY_OUTPUT_INTDIR}/clang/${CLANG_VERSION}
+               -DCOMPILER_RT_OUTPUT_DIR=${CLANG_LIBRARY_OUTPUT_INTDIR}/clang/${CLANG_VERSION}
                -DCOMPILER_RT_EXEC_OUTPUT_DIR=${LLVM_RUNTIME_OUTPUT_INTDIR}
-               -DCOMPILER_RT_INSTALL_PATH:STRING=lib${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION}
+               -DCOMPILER_RT_INSTALL_PATH:STRING=lib${CLANG_LIBDIR_SUFFIX}/clang/${CLANG_VERSION}
                -DCOMPILER_RT_INCLUDE_TESTS=${LLVM_INCLUDE_TESTS}
                -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}
                -DLLVM_LIBDIR_SUFFIX=${LLVM_LIBDIR_SUFFIX}
Index: lib/Headers/CMakeLists.txt
===================================================================
--- lib/Headers/CMakeLists.txt
+++ lib/Headers/CMakeLists.txt
@@ -88,7 +88,7 @@
   xtestintrin.h
   )
 
-set(output_dir ${LLVM_LIBRARY_OUTPUT_INTDIR}/clang/${CLANG_VERSION}/include)
+set(output_dir ${CLANG_LIBRARY_OUTPUT_INTDIR}/clang/${CLANG_VERSION}/include)
 
 # Generate arm_neon.h
 clang_tablegen(arm_neon.h -gen-arm-neon
@@ -118,7 +118,7 @@
   FILES ${files} ${CMAKE_CURRENT_BINARY_DIR}/arm_neon.h
   COMPONENT clang-headers
   PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
-  DESTINATION lib${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION}/include)
+  DESTINATION lib${CLANG_LIBDIR_SUFFIX}/clang/${CLANG_VERSION}/include)
 
 if (NOT CMAKE_CONFIGURATION_TYPES) # don't add this for IDE's.
   add_custom_target(install-clang-headers
Index: CMakeLists.txt
===================================================================
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -235,8 +235,9 @@
 set(CLANG_VENDOR_UTI "org.llvm.clang" CACHE STRING
   "Vendor-specific uti.")
 
-# The libdir suffix must exactly match whatever LLVM's configuration used.
-set(CLANG_LIBDIR_SUFFIX "${LLVM_LIBDIR_SUFFIX}")
+set(CLANG_LIBDIR_SUFFIX "${LLVM_LIBDIR_SUFFIX}" CACHE
+  STRING "Define suffix of library directory name for clang runtime (32/64)")
+set(CLANG_LIBRARY_OUTPUT_INTDIR ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/lib${CLANG_LIBDIR_SUFFIX})
 
 set(CLANG_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
 set(CLANG_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D23752.68800.patch
Type: text/x-patch
Size: 2545 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160821/9b9627e9/attachment.bin>


More information about the cfe-commits mailing list