llvm.org GIT mirror llvm / d9df72a
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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@335809 91177308-0d34-0410-b5e6-96231b3b80d8 Petr Hosek 1 year, 26 days ago
2 changed file(s) with 14 addition(s) and 15 deletion(s). Raw diff Collapse all Expand all
583583 set(LLVM_TARGET_TRIPLE_ENV CACHE STRING "The name of environment variable to override default target. Disabled by blank.")
584584 mark_as_advanced(LLVM_TARGET_TRIPLE_ENV)
585585
586 set(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR OFF CACHE BOOL
587 "Enable per-target runtimes directory")
588
586589 # All options referred to from HandleLLVMOptions have to be specified
587590 # BEFORE this include, otherwise options will not be correctly set on
588591 # first cmake run
123123 set(LLVM_RUNTIMES_PREFIX "${LLVM_RUNTIMES_TARGET}/")
124124 endif()
125125
126 string(REGEX MATCH "[0-9]+\\.[0-9]+(\\.[0-9]+)?" CLANG_VERSION
127 ${PACKAGE_VERSION})
128
126129 foreach(entry ${runtimes})
127130 get_filename_component(projName ${entry} NAME)
128131
132135 # The subdirectories need to treat this as standalone builds
133136 set(${canon_name}_STANDALONE_BUILD On)
134137
135 if(LLVM_RUNTIMES_TARGET)
136 if(NOT "${projName}" MATCHES "compiler-rt")
137 set(${canon_name}_INSTALL_PREFIX "lib/${LLVM_RUNTIMES_PREFIX}/" CACHE STRING "" FORCE)
138 endif()
139 endif()
140
141138 # Setting a variable to let sub-projects detect which other projects
142139 # will be included under here.
143140 set(HAVE_${canon_name} On)
151148 # other runtimes are added.
152149 foreach(entry ${runtimes})
153150 get_filename_component(projName ${entry} NAME)
154
155 if(LLVM_RUNTIMES_TARGET)
156 if(NOT "${projName}" MATCHES "compiler-rt")
157 set(LLVM_BINARY_DIR "${LLVM_LIBRARY_DIR}/${LLVM_RUNTIMES_PREFIX}")
158 set(LLVM_LIBDIR_SUFFIX "${LLVM_RUNTIMES_LIBDIR_SUFFIX}")
159 set(LLVM_LIBRARY_OUTPUT_INTDIR "${LLVM_LIBRARY_DIR}/${LLVM_RUNTIMES_PREFIX}lib${LLVM_RUNTIMES_LIBDIR_SUFFIX}")
160 set(LLVM_RUNTIME_OUTPUT_INTDIR "${LLVM_TOOLS_BINARY_DIR}/${LLVM_RUNTIMES_PREFIX}")
161 endif()
162 endif()
163151
164152 # Between each sub-project we want to cache and clear the LIT properties
165153 set_property(GLOBAL PROPERTY LLVM_LIT_TESTSUITES)
246234 ${compiler_rt_path}/lib/builtins
247235 CMAKE_ARGS -DLLVM_LIBRARY_OUTPUT_INTDIR=${LLVM_LIBRARY_DIR}
248236 -DLLVM_RUNTIME_OUTPUT_INTDIR=${LLVM_TOOLS_BINARY_DIR}
237 -DLLVM_DEFAULT_TARGET_TRIPLE=${TARGET_TRIPLE}
238 -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=ON
249239 -DCMAKE_C_COMPILER_TARGET=${TARGET_TRIPLE}
250240 -DCMAKE_ASM_COMPILER_TARGET=${TARGET_TRIPLE}
251241 -DCMAKE_C_COMPILER_WORKS=ON
277267 ${compiler_rt_path}/lib/builtins
278268 CMAKE_ARGS -DLLVM_LIBRARY_OUTPUT_INTDIR=${LLVM_LIBRARY_DIR}
279269 -DLLVM_RUNTIME_OUTPUT_INTDIR=${LLVM_TOOLS_BINARY_DIR}
270 -DLLVM_DEFAULT_TARGET_TRIPLE=${target}
271 -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=ON
280272 -DCMAKE_C_COMPILER_TARGET=${target}
281273 -DCMAKE_ASM_COMPILER_TARGET=${target}
282274 -DCMAKE_C_COMPILER_WORKS=ON
370362 CMAKE_ARGS -DCOMPILER_RT_BUILD_BUILTINS=Off
371363 -DLLVM_INCLUDE_TESTS=${LLVM_INCLUDE_TESTS}
372364 -DLLVM_LIBRARY_DIR=${LLVM_LIBRARY_DIR}
365 -DLLVM_DEFAULT_TARGET_TRIPLE=${TARGET_TRIPLE}
366 -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=ON
373367 -DCMAKE_C_COMPILER_TARGET=${TARGET_TRIPLE}
374368 -DCMAKE_CXX_COMPILER_TARGET=${TARGET_TRIPLE}
375369 -DCMAKE_ASM_COMPILER_TARGET=${TARGET_TRIPLE}
454448 CMAKE_ARGS -DCOMPILER_RT_BUILD_BUILTINS=Off
455449 -DLLVM_INCLUDE_TESTS=${LLVM_INCLUDE_TESTS}
456450 -DLLVM_LIBRARY_DIR=${LLVM_LIBRARY_DIR}
451 -DLLVM_DEFAULT_TARGET_TRIPLE=${target}
452 -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=ON
457453 -DCMAKE_C_COMPILER_TARGET=${target}
458454 -DCMAKE_CXX_COMPILER_TARGET=${target}
459455 -DCMAKE_ASM_COMPILER_TARGET=${target}