1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-01-31 20:51:52 +01:00

Support for multiarch runtimes layout

This change adds a support for multiarch style runtimes layout, so in
addition to the existing layout where runtimes get installed to:

lib/clang/$version/lib/$os

Clang now allows runtimes to be installed to:

lib/clang/$version/$target/lib

This also includes libc++, libc++abi and libunwind; today those are
assumed to be in Clang library directory built for host, with the
new layout it is possible to install libc++, libc++abi and libunwind
into the runtime directory built for different targets.

The use of new layout is enabled by setting the
LLVM_ENABLE_RUNTIME_TARGET_DIR CMake variable and is supported by both
projects and runtimes layouts. The runtimes CMake build has been further
modified to use the new layout when building runtimes for multiple
targets.

Differential Revision: https://reviews.llvm.org/D45604

llvm-svn: 335809
This commit is contained in:
Petr Hosek 2018-06-28 03:11:52 +00:00
parent 3582c81a34
commit 60cd282c53
2 changed files with 14 additions and 15 deletions

View File

@ -584,6 +584,9 @@ endif()
set(LLVM_TARGET_TRIPLE_ENV CACHE STRING "The name of environment variable to override default target. Disabled by blank.")
mark_as_advanced(LLVM_TARGET_TRIPLE_ENV)
set(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR OFF CACHE BOOL
"Enable per-target runtimes directory")
# All options referred to from HandleLLVMOptions have to be specified
# BEFORE this include, otherwise options will not be correctly set on
# first cmake run

View File

@ -124,6 +124,9 @@ if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR})
set(LLVM_RUNTIMES_PREFIX "${LLVM_RUNTIMES_TARGET}/")
endif()
string(REGEX MATCH "[0-9]+\\.[0-9]+(\\.[0-9]+)?" CLANG_VERSION
${PACKAGE_VERSION})
foreach(entry ${runtimes})
get_filename_component(projName ${entry} NAME)
@ -133,12 +136,6 @@ if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR})
# The subdirectories need to treat this as standalone builds
set(${canon_name}_STANDALONE_BUILD On)
if(LLVM_RUNTIMES_TARGET)
if(NOT "${projName}" MATCHES "compiler-rt")
set(${canon_name}_INSTALL_PREFIX "lib/${LLVM_RUNTIMES_PREFIX}/" CACHE STRING "" FORCE)
endif()
endif()
# Setting a variable to let sub-projects detect which other projects
# will be included under here.
set(HAVE_${canon_name} On)
@ -153,15 +150,6 @@ if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR})
foreach(entry ${runtimes})
get_filename_component(projName ${entry} NAME)
if(LLVM_RUNTIMES_TARGET)
if(NOT "${projName}" MATCHES "compiler-rt")
set(LLVM_BINARY_DIR "${LLVM_LIBRARY_DIR}/${LLVM_RUNTIMES_PREFIX}")
set(LLVM_LIBDIR_SUFFIX "${LLVM_RUNTIMES_LIBDIR_SUFFIX}")
set(LLVM_LIBRARY_OUTPUT_INTDIR "${LLVM_LIBRARY_DIR}/${LLVM_RUNTIMES_PREFIX}lib${LLVM_RUNTIMES_LIBDIR_SUFFIX}")
set(LLVM_RUNTIME_OUTPUT_INTDIR "${LLVM_TOOLS_BINARY_DIR}/${LLVM_RUNTIMES_PREFIX}")
endif()
endif()
# Between each sub-project we want to cache and clear the LIT properties
set_property(GLOBAL PROPERTY LLVM_LIT_TESTSUITES)
set_property(GLOBAL PROPERTY LLVM_LIT_PARAMS)
@ -247,6 +235,8 @@ else() # if this is included from LLVM's CMake
${compiler_rt_path}/lib/builtins
CMAKE_ARGS -DLLVM_LIBRARY_OUTPUT_INTDIR=${LLVM_LIBRARY_DIR}
-DLLVM_RUNTIME_OUTPUT_INTDIR=${LLVM_TOOLS_BINARY_DIR}
-DLLVM_DEFAULT_TARGET_TRIPLE=${TARGET_TRIPLE}
-DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=ON
-DCMAKE_C_COMPILER_TARGET=${TARGET_TRIPLE}
-DCMAKE_ASM_COMPILER_TARGET=${TARGET_TRIPLE}
-DCMAKE_C_COMPILER_WORKS=ON
@ -278,6 +268,8 @@ else() # if this is included from LLVM's CMake
${compiler_rt_path}/lib/builtins
CMAKE_ARGS -DLLVM_LIBRARY_OUTPUT_INTDIR=${LLVM_LIBRARY_DIR}
-DLLVM_RUNTIME_OUTPUT_INTDIR=${LLVM_TOOLS_BINARY_DIR}
-DLLVM_DEFAULT_TARGET_TRIPLE=${target}
-DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=ON
-DCMAKE_C_COMPILER_TARGET=${target}
-DCMAKE_ASM_COMPILER_TARGET=${target}
-DCMAKE_C_COMPILER_WORKS=ON
@ -371,6 +363,8 @@ else() # if this is included from LLVM's CMake
CMAKE_ARGS -DCOMPILER_RT_BUILD_BUILTINS=Off
-DLLVM_INCLUDE_TESTS=${LLVM_INCLUDE_TESTS}
-DLLVM_LIBRARY_DIR=${LLVM_LIBRARY_DIR}
-DLLVM_DEFAULT_TARGET_TRIPLE=${TARGET_TRIPLE}
-DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=ON
-DCMAKE_C_COMPILER_TARGET=${TARGET_TRIPLE}
-DCMAKE_CXX_COMPILER_TARGET=${TARGET_TRIPLE}
-DCMAKE_ASM_COMPILER_TARGET=${TARGET_TRIPLE}
@ -455,6 +449,8 @@ else() # if this is included from LLVM's CMake
CMAKE_ARGS -DCOMPILER_RT_BUILD_BUILTINS=Off
-DLLVM_INCLUDE_TESTS=${LLVM_INCLUDE_TESTS}
-DLLVM_LIBRARY_DIR=${LLVM_LIBRARY_DIR}
-DLLVM_DEFAULT_TARGET_TRIPLE=${target}
-DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=ON
-DCMAKE_C_COMPILER_TARGET=${target}
-DCMAKE_CXX_COMPILER_TARGET=${target}
-DCMAKE_ASM_COMPILER_TARGET=${target}