0003-compiler-rt-Simplify-cross-compilation.-Don-t-use-na.patch 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. From 3bc3328f89915cde33c26cec91a57b79109420f0 Mon Sep 17 00:00:00 2001
  2. From: Khem Raj <raj.khem@gmail.com>
  3. Date: Thu, 19 May 2016 23:11:45 -0700
  4. Subject: [PATCH] compiler-rt: Simplify cross-compilation. Don't use
  5. native-compiled llvm-config.
  6. Note: AddLLVM.cmake does not expose the LLVM source directory.
  7. So if you want to run the test suite, you need to either:
  8. 1) set LLVM_MAIN_SRC_DIR explicitly (to find lit.py)
  9. 2) change AddLLVM.cmake to point to an installed 'lit'.
  10. 3) add_subdirectory(compiler-rt/test) from clang instead of compiler-rt.
  11. https://us.codeaurora.org/patches/quic/llvm/50683/compiler-rt-cross-compilation.patch
  12. Signed-off-by: Greg Fitzgerald <gregf@codeaurora.org>
  13. Signed-off-by: Khem Raj <raj.khem@gmail.com>
  14. ---
  15. compiler-rt/CMakeLists.txt | 11 ++++++++++-
  16. 1 file changed, 10 insertions(+), 1 deletion(-)
  17. diff --git a/compiler-rt/CMakeLists.txt b/compiler-rt/CMakeLists.txt
  18. index 3a41aa43e406..3bbfbca1f645 100644
  19. --- a/compiler-rt/CMakeLists.txt
  20. +++ b/compiler-rt/CMakeLists.txt
  21. @@ -67,7 +67,16 @@ set(COMPILER_RT_BAREMETAL_BUILD OFF CACHE BOOL
  22. "Build for a bare-metal target.")
  23. if (COMPILER_RT_STANDALONE_BUILD)
  24. - load_llvm_config()
  25. + find_package(LLVM REQUIRED)
  26. + list(APPEND CMAKE_MODULE_PATH "${LLVM_CMAKE_DIR}")
  27. +
  28. + # Variables that AddLLVM.cmake depends on (included by AddCompilerRT)
  29. + set(LLVM_TOOLS_BINARY_DIR "${LLVM_INSTALL_PREFIX}/bin")
  30. + set(LLVM_LIBRARY_DIR "${LLVM_INSTALL_PREFIX}/lib")
  31. +
  32. + set(LLVM_LIBRARY_OUTPUT_INTDIR
  33. + ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/lib${LLVM_LIBDIR_SUFFIX})
  34. +
  35. if (TARGET intrinsics_gen)
  36. # Loading the llvm config causes this target to be imported so place it
  37. # under the appropriate folder in an IDE.