[PATCH] D40637: [CMake] Support runtimes and monorepo layouts when looking for libc++

Petr Hosek via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 11 17:21:35 PST 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL320446: [CMake] Support runtimes and monorepo layouts when looking for libcxx (authored by phosek).

Changed prior to commit:
  https://reviews.llvm.org/D40637?vs=124876&id=126482#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D40637

Files:
  compiler-rt/trunk/CMakeLists.txt
  compiler-rt/trunk/cmake/Modules/AddCompilerRT.cmake
  compiler-rt/trunk/lib/msan/tests/CMakeLists.txt
  compiler-rt/trunk/lib/tsan/CMakeLists.txt
  compiler-rt/trunk/test/msan/CMakeLists.txt
  compiler-rt/trunk/test/tsan/CMakeLists.txt


Index: compiler-rt/trunk/cmake/Modules/AddCompilerRT.cmake
===================================================================
--- compiler-rt/trunk/cmake/Modules/AddCompilerRT.cmake
+++ compiler-rt/trunk/cmake/Modules/AddCompilerRT.cmake
@@ -465,7 +465,7 @@
 #                   DEPS <list of build deps>
 #                   CFLAGS <list of compile flags>)
 macro(add_custom_libcxx name prefix)
-  if(NOT COMPILER_RT_HAS_LIBCXX_SOURCES)
+  if(NOT COMPILER_RT_LIBCXX_PATH)
     message(FATAL_ERROR "libcxx not found!")
   endif()
 
Index: compiler-rt/trunk/test/msan/CMakeLists.txt
===================================================================
--- compiler-rt/trunk/test/msan/CMakeLists.txt
+++ compiler-rt/trunk/test/msan/CMakeLists.txt
@@ -25,7 +25,7 @@
   list(APPEND MSAN_TEST_DEPS msan)
 endif()
 
-if(COMPILER_RT_INCLUDE_TESTS AND COMPILER_RT_HAS_LIBCXX_SOURCES)
+if(COMPILER_RT_INCLUDE_TESTS AND COMPILER_RT_LIBCXX_PATH)
   configure_lit_site_cfg(
     ${CMAKE_CURRENT_SOURCE_DIR}/Unit/lit.site.cfg.in
     ${CMAKE_CURRENT_BINARY_DIR}/Unit/lit.site.cfg)
Index: compiler-rt/trunk/test/tsan/CMakeLists.txt
===================================================================
--- compiler-rt/trunk/test/tsan/CMakeLists.txt
+++ compiler-rt/trunk/test/tsan/CMakeLists.txt
@@ -7,7 +7,7 @@
 if(NOT COMPILER_RT_STANDALONE_BUILD)
   list(APPEND TSAN_TEST_DEPS tsan)
 endif()
-if(COMPILER_RT_HAS_LIBCXX_SOURCES AND
+if(COMPILER_RT_LIBCXX_PATH AND
    COMPILER_RT_TEST_COMPILER_ID STREQUAL "Clang"
    AND NOT APPLE AND NOT ANDROID)
   list(APPEND TSAN_TEST_DEPS libcxx_tsan)
Index: compiler-rt/trunk/CMakeLists.txt
===================================================================
--- compiler-rt/trunk/CMakeLists.txt
+++ compiler-rt/trunk/CMakeLists.txt
@@ -344,17 +344,15 @@
 
 add_subdirectory(include)
 
-set(COMPILER_RT_LIBCXX_PATH ${LLVM_MAIN_SRC_DIR}/projects/libcxx)
-if(EXISTS ${COMPILER_RT_LIBCXX_PATH}/)
-  set(COMPILER_RT_HAS_LIBCXX_SOURCES TRUE)
-else()
-  set(COMPILER_RT_LIBCXX_PATH ${LLVM_MAIN_SRC_DIR}/../libcxx)
-  if(EXISTS ${COMPILER_RT_LIBCXX_PATH}/)
-    set(COMPILER_RT_HAS_LIBCXX_SOURCES TRUE)
-  else()
-    set(COMPILER_RT_HAS_LIBCXX_SOURCES FALSE)
+foreach(path IN ITEMS ${LLVM_MAIN_SRC_DIR}/projects/libcxx
+                      ${LLVM_MAIN_SRC_DIR}/runtimes/libcxx
+                      ${LLVM_MAIN_SRC_DIR}/../libcxx
+                      ${LLVM_EXTERNAL_LIBCXX_SOURCE_DIR})
+  if(IS_DIRECTORY ${path})
+    set(COMPILER_RT_LIBCXX_PATH ${path})
+    break()
   endif()
-endif()
+endforeach()
 
 set(COMPILER_RT_LLD_PATH ${LLVM_MAIN_SRC_DIR}/tools/lld)
 if(EXISTS ${COMPILER_RT_LLD_PATH}/ AND LLVM_TOOL_LLD_BUILD)
Index: compiler-rt/trunk/lib/tsan/CMakeLists.txt
===================================================================
--- compiler-rt/trunk/lib/tsan/CMakeLists.txt
+++ compiler-rt/trunk/lib/tsan/CMakeLists.txt
@@ -203,7 +203,7 @@
 endif()
 
 # Build libcxx instrumented with TSan.
-if(COMPILER_RT_HAS_LIBCXX_SOURCES AND
+if(COMPILER_RT_LIBCXX_PATH AND
    COMPILER_RT_TEST_COMPILER_ID STREQUAL "Clang" AND
    NOT ANDROID)
   set(libcxx_tsan_deps)
Index: compiler-rt/trunk/lib/msan/tests/CMakeLists.txt
===================================================================
--- compiler-rt/trunk/lib/msan/tests/CMakeLists.txt
+++ compiler-rt/trunk/lib/msan/tests/CMakeLists.txt
@@ -122,7 +122,7 @@
 endmacro()
 
 # We should only build MSan unit tests if we can build instrumented libcxx.
-if(COMPILER_RT_CAN_EXECUTE_TESTS AND COMPILER_RT_HAS_LIBCXX_SOURCES)
+if(COMPILER_RT_CAN_EXECUTE_TESTS AND COMPILER_RT_LIBCXX_PATH)
   foreach(arch ${MSAN_SUPPORTED_ARCH})
     get_target_flags_for_arch(${arch} TARGET_CFLAGS)
     set(LIBCXX_PREFIX ${CMAKE_CURRENT_BINARY_DIR}/../libcxx_msan_${arch})


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D40637.126482.patch
Type: text/x-patch
Size: 3738 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171212/e2b22a29/attachment.bin>


More information about the llvm-commits mailing list