[libcxx] r243591 - Attempt to fix build issues introduced by

Eric Fiselier eric at efcs.ca
Wed Jul 29 16:23:18 PDT 2015


Author: ericwf
Date: Wed Jul 29 18:23:18 2015
New Revision: 243591

URL: http://llvm.org/viewvc/llvm-project?rev=243591&view=rev
Log:
Attempt to fix build issues introduced by 
r243574

Modified:
    libcxx/trunk/CMakeLists.txt
    libcxx/trunk/cmake/Modules/FindLLVM.cmake

Modified: libcxx/trunk/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/CMakeLists.txt?rev=243591&r1=243590&r2=243591&view=diff
==============================================================================
--- libcxx/trunk/CMakeLists.txt (original)
+++ libcxx/trunk/CMakeLists.txt Wed Jul 29 18:23:18 2015
@@ -35,6 +35,14 @@ MACRO_ENSURE_OUT_OF_SOURCE_BUILD(
 
 # Find the required bits of LLVM
 include(FindLLVM)
+# TODO(EricWF) Make this an error by default.
+if (NOT LLVM_FOUND)
+  message(WARNING "UNSUPPORTED LIBCXX CONFIGURATION DETECTED: "
+                  "llvm-config not found and LLVM_MAIN_SRC_DIR not defined. "
+                  "Reconfigure with -DLLVM_CONFIG=path/to/llvm-config "
+                  "or -DLLVM_PATH=path/to/llvm-source-root.")
+endif()
+
 
 #===============================================================================
 # Setup CMake Options
@@ -44,6 +52,7 @@ include(FindLLVM)
 option(LIBCXX_ENABLE_ASSERTIONS "Enable assertions independent of build mode." ON)
 option(LIBCXX_ENABLE_SHARED "Build libc++ as a shared library." ON)
 
+option(LIBCXX_INCLUDE_TESTS "Build the libc++ tests." ${LLVM_INCLUDE_TESTS})
 set(LIBCXX_LIBDIR_SUFFIX "${LLVM_LIBDIR_SUFFIX}" CACHE STRING
     "Define suffix of library directory name (32/64)")
 option(LIBCXX_INSTALL_HEADERS "Install the libc++ headers." ON)
@@ -62,7 +71,7 @@ option(LIBCXX_ENABLE_STATIC_ABI_LIBRARY
 option(LIBCXXABI_USE_LLVM_UNWINDER "Build and use the LLVM unwinder." OFF)
 
 # Target options --------------------------------------------------------------
-option(LIBCXX_BUILD_32_BITS "Build 32 bit libc++." OFF)
+option(LIBCXX_BUILD_32_BITS "Build 32 bit libc++." ${LLVM_BUILD_32_BITS})
 set(LIBCXX_SYSROOT "" CACHE STRING "Use alternate sysroot.")
 set(LIBCXX_GCC_TOOLCHAIN "" CACHE STRING "Use alternate GCC toolchain.")
 
@@ -106,11 +115,8 @@ endif()
 # Set LIBCXX_BUILD_32_BITS to (LIBCXX_BUILD_32_BITS OR LLVM_BUILD_32_BITS)
 # and check that we can build with 32 bits if requested.
 if (CMAKE_SIZEOF_VOID_P EQUAL 8 AND NOT WIN32)
-  if (LIBCXX_BUILD_32_BITS OR LLVM_BUILD_32_BITS)
-    if (NOT LLVM_BUILD_32_BITS) # Don't duplicate the output from LLVM
-      message(STATUS "Building 32 bits executables and libraries.")
-    endif()
-    set(LIBCXX_BUILD_32_BITS ON CACHE BOOL "" FORCE)
+  if (LIBCXX_BUILD_32_BITS AND NOT LLVM_BUILD_32_BITS) # Don't duplicate the output from LLVM
+    message(STATUS "Building 32 bits executables and libraries.")
   endif()
 elseif(LIBCXX_BUILD_32_BITS)
   message(FATAL_ERROR "LIBCXX_BUILD_32_BITS=ON is not supported on this platform.")
@@ -243,4 +249,6 @@ define_if_not(LIBCXX_ENABLE_THREAD_UNSAF
 include_directories(include)
 add_subdirectory(include)
 add_subdirectory(lib)
-add_subdirectory(test)
+if (LIBCXX_INCLUDE_TESTS)
+  add_subdirectory(test)
+endif()

Modified: libcxx/trunk/cmake/Modules/FindLLVM.cmake
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/cmake/Modules/FindLLVM.cmake?rev=243591&r1=243590&r2=243591&view=diff
==============================================================================
--- libcxx/trunk/cmake/Modules/FindLLVM.cmake (original)
+++ libcxx/trunk/cmake/Modules/FindLLVM.cmake Wed Jul 29 18:23:18 2015
@@ -1,6 +1,5 @@
-
-if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
-  # Rely on llvm-config.
+macro(find_llvm_parts)
+# Rely on llvm-config.
   set(CONFIG_OUTPUT)
   find_program(LLVM_CONFIG "llvm-config")
   if(DEFINED LLVM_PATH)
@@ -38,9 +37,8 @@ if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURR
     set(LLVM_MAIN_SRC_DIR ${MAIN_SRC_DIR} CACHE PATH "Path to LLVM source tree")
     set(LLVM_CMAKE_PATH "${LLVM_BINARY_DIR}/share/llvm/cmake")
   else()
-    message(FATAL_ERROR "llvm-config not found and LLVM_MAIN_SRC_DIR not defined. "
-                        "Reconfigure with -DLLVM_CONFIG=path/to/llvm-config "
-                        "or -DLLVM_PATH=path/to/llvm-source-root.")
+    set(LLVM_FOUND OFF)
+    return()
   endif()
 
   if (NOT EXISTS ${LLVM_MAIN_SRC_DIR})
@@ -54,28 +52,29 @@ if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURR
   list(APPEND CMAKE_MODULE_PATH "${LLVM_CMAKE_PATH}")
   list(APPEND CMAKE_MODULE_PATH "${LLVM_MAIN_SRC_DIR}/cmake/modules")
 
+  set(LLVM_FOUND ON)
+endmacro(find_llvm_parts)
 
-  if(LLVM_LIT)
-    # Define the default arguments to use with 'lit', and an option for the user
-    # to override.
-    set(LIT_ARGS_DEFAULT "-sv --show-xfail --show-unsupported")
-    if (MSVC OR XCODE)
-      set(LIT_ARGS_DEFAULT "${LIT_ARGS_DEFAULT} --no-progress-bar")
-    endif()
-    set(LLVM_LIT_ARGS "${LIT_ARGS_DEFAULT}" CACHE STRING "Default options for lit")
 
-    # On Win32 hosts, provide an option to specify the path to the GnuWin32 tools.
-    if( WIN32 AND NOT CYGWIN )
-      set(LLVM_LIT_TOOLS_DIR "" CACHE PATH "Path to GnuWin32 tools")
-    endif()
-  else()
-    set(LLVM_INCLUDE_TESTS OFF)
+if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
+  set(LIBCXX_BUILT_STANDALONE 1)
+  find_llvm_parts()
+
+  if (NOT DEFINED LLVM_INCLUDE_TESTS)
+    set(LLVM_INCLUDE_TESTS ${LLVM_FOUND})
   endif()
 
-  include(AddLLVM) # Include the LLVM CMake functions.
-  include(HandleLLVMOptions)
-  set(LIBCXX_BUILT_STANDALONE 1)
+  # Define the default arguments to use with 'lit', and an option for the user
+  # to override.
+  set(LIT_ARGS_DEFAULT "-sv --show-xfail --show-unsupported")
+  if (MSVC OR XCODE)
+    set(LIT_ARGS_DEFAULT "${LIT_ARGS_DEFAULT} --no-progress-bar")
+  endif()
+  set(LLVM_LIT_ARGS "${LIT_ARGS_DEFAULT}" CACHE STRING "Default options for lit")
+
+  include(AddLLVM OPTIONAL) # Include the LLVM CMake functions.
+  include(HandleLLVMOptions OPTIONAL)
 else()
+  set(LLVM_FOUND ON)
   set(LLVM_MAIN_SRC_DIR "${CMAKE_SOURCE_DIR}" CACHE PATH "Path to LLVM source tree")
-  set(LLVM_LIT "${CMAKE_SOURCE_DIR}/utils/lit/lit.py")
 endif()





More information about the cfe-commits mailing list