================
@@ -236,6 +237,36 @@ if(CMAKE_C_COMPILER_ID MATCHES "Clang")
endif()
endif()
+# Determine output and install paths based on LLVM_TARGET_TRIPLE
+if(LLVM_TREE_AVAILABLE)
+ # Despite Clang in the name, get_clang_resource_dir does not depend on Clang
+ # being added to the build. Flang uses the same resource dir as Clang.
+ include(GetClangResourceDir)
+ get_clang_resource_dir(RUNTIMES_OUTPUT_RESOURCE_DIR PREFIX
"${LLVM_LIBRARY_OUTPUT_INTDIR}/..")
+ get_clang_resource_dir(RUNTIMES_INSTALL_RESOURCE_PATH_DEFAULT)
+else()
+ # For the install prefix, still use the resource dir assuming the compilers
+ # looking for it (Clang, Flang) will be installed there using the same
prefix.
+ # This is to not have a difference between bootstrapping and
default/standalone runtimes
+ # builds.
+ set(RUNTIMES_OUTPUT_RESOURCE_DIR
"${CMAKE_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/clang/${LLVM_VERSION_MAJOR}")
+ set(RUNTIMES_INSTALL_RESOURCE_PATH_DEFAULT
"lib${LLVM_LIBDIR_SUFFIX}/clang/${LLVM_VERSION_MAJOR}")
+endif()
+
+# Determine build and install paths. The output paths are absolute, but the
+# install dirs are relative to CMAKE_INSTALL_PREFIX to be resolved by CMake.
+get_toolchain_library_subdir(toolchain_lib_subdir)
+extend_path(RUNTIMES_OUTPUT_RESOURCE_LIB_DIR "${RUNTIMES_OUTPUT_RESOURCE_DIR}"
"${toolchain_lib_subdir}")
+
+set(RUNTIMES_INSTALL_RESOURCE_PATH "${RUNTIMES_INSTALL_RESOURCE_PATH_DEFAULT}"
CACHE PATH "Path to install headers, runtime libraries, and Fortran modules to
(default: Clang resource dir)")
+extend_path(RUNTIMES_INSTALL_RESOURCE_LIB_PATH
"${RUNTIMES_INSTALL_RESOURCE_PATH}" "${toolchain_lib_subdir}")
----------------
petrhosek wrote:
That option applies to other runtimes in compiler-rt as well, but not to other
runtimes libraries (e.g. libc++). I don't think we should be introducing
`RUNTIMES_DEFAULT_TARGET_ONLY`, all of the variables introduced here only apply
to compiler-rt, other runtime libraries use a different scheme.
The existing build logic in compiler-rt is very convoluted and there are
probably codepaths that are no longer being used and are effectively dead code.
That's why I'm a bit hesitant about transplanting that logic into the runtimes
build. We ideally want to completely replace it with a clean-slate
implementation, but that's a much larger project than what you want to take on.
https://github.com/llvm/llvm-project/pull/177953
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits