Attempt to fix build issues introduced by
r243574 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@243591 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -35,6 +35,14 @@ MACRO_ENSURE_OUT_OF_SOURCE_BUILD(
|
|||||||
|
|
||||||
# Find the required bits of LLVM
|
# Find the required bits of LLVM
|
||||||
include(FindLLVM)
|
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
|
# Setup CMake Options
|
||||||
@@ -44,6 +52,7 @@ include(FindLLVM)
|
|||||||
option(LIBCXX_ENABLE_ASSERTIONS "Enable assertions independent of build mode." ON)
|
option(LIBCXX_ENABLE_ASSERTIONS "Enable assertions independent of build mode." ON)
|
||||||
option(LIBCXX_ENABLE_SHARED "Build libc++ as a shared library." 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
|
set(LIBCXX_LIBDIR_SUFFIX "${LLVM_LIBDIR_SUFFIX}" CACHE STRING
|
||||||
"Define suffix of library directory name (32/64)")
|
"Define suffix of library directory name (32/64)")
|
||||||
option(LIBCXX_INSTALL_HEADERS "Install the libc++ headers." ON)
|
option(LIBCXX_INSTALL_HEADERS "Install the libc++ headers." ON)
|
||||||
@@ -62,7 +71,7 @@ option(LIBCXX_ENABLE_STATIC_ABI_LIBRARY "Statically link the ABI library" OFF)
|
|||||||
option(LIBCXXABI_USE_LLVM_UNWINDER "Build and use the LLVM unwinder." OFF)
|
option(LIBCXXABI_USE_LLVM_UNWINDER "Build and use the LLVM unwinder." OFF)
|
||||||
|
|
||||||
# Target options --------------------------------------------------------------
|
# 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_SYSROOT "" CACHE STRING "Use alternate sysroot.")
|
||||||
set(LIBCXX_GCC_TOOLCHAIN "" CACHE STRING "Use alternate GCC toolchain.")
|
set(LIBCXX_GCC_TOOLCHAIN "" CACHE STRING "Use alternate GCC toolchain.")
|
||||||
|
|
||||||
@@ -106,12 +115,9 @@ endif()
|
|||||||
# Set LIBCXX_BUILD_32_BITS to (LIBCXX_BUILD_32_BITS OR LLVM_BUILD_32_BITS)
|
# 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.
|
# and check that we can build with 32 bits if requested.
|
||||||
if (CMAKE_SIZEOF_VOID_P EQUAL 8 AND NOT WIN32)
|
if (CMAKE_SIZEOF_VOID_P EQUAL 8 AND NOT WIN32)
|
||||||
if (LIBCXX_BUILD_32_BITS OR LLVM_BUILD_32_BITS)
|
if (LIBCXX_BUILD_32_BITS AND NOT LLVM_BUILD_32_BITS) # Don't duplicate the output from LLVM
|
||||||
if (NOT LLVM_BUILD_32_BITS) # Don't duplicate the output from LLVM
|
|
||||||
message(STATUS "Building 32 bits executables and libraries.")
|
message(STATUS "Building 32 bits executables and libraries.")
|
||||||
endif()
|
endif()
|
||||||
set(LIBCXX_BUILD_32_BITS ON CACHE BOOL "" FORCE)
|
|
||||||
endif()
|
|
||||||
elseif(LIBCXX_BUILD_32_BITS)
|
elseif(LIBCXX_BUILD_32_BITS)
|
||||||
message(FATAL_ERROR "LIBCXX_BUILD_32_BITS=ON is not supported on this platform.")
|
message(FATAL_ERROR "LIBCXX_BUILD_32_BITS=ON is not supported on this platform.")
|
||||||
endif()
|
endif()
|
||||||
@@ -243,4 +249,6 @@ define_if_not(LIBCXX_ENABLE_THREAD_UNSAFE_C_FUNCTIONS -D_LIBCPP_HAS_NO_THREAD_UN
|
|||||||
include_directories(include)
|
include_directories(include)
|
||||||
add_subdirectory(include)
|
add_subdirectory(include)
|
||||||
add_subdirectory(lib)
|
add_subdirectory(lib)
|
||||||
|
if (LIBCXX_INCLUDE_TESTS)
|
||||||
add_subdirectory(test)
|
add_subdirectory(test)
|
||||||
|
endif()
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
|
macro(find_llvm_parts)
|
||||||
if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
|
|
||||||
# Rely on llvm-config.
|
# Rely on llvm-config.
|
||||||
set(CONFIG_OUTPUT)
|
set(CONFIG_OUTPUT)
|
||||||
find_program(LLVM_CONFIG "llvm-config")
|
find_program(LLVM_CONFIG "llvm-config")
|
||||||
@@ -38,9 +37,8 @@ if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
|
|||||||
set(LLVM_MAIN_SRC_DIR ${MAIN_SRC_DIR} CACHE PATH "Path to LLVM source tree")
|
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")
|
set(LLVM_CMAKE_PATH "${LLVM_BINARY_DIR}/share/llvm/cmake")
|
||||||
else()
|
else()
|
||||||
message(FATAL_ERROR "llvm-config not found and LLVM_MAIN_SRC_DIR not defined. "
|
set(LLVM_FOUND OFF)
|
||||||
"Reconfigure with -DLLVM_CONFIG=path/to/llvm-config "
|
return()
|
||||||
"or -DLLVM_PATH=path/to/llvm-source-root.")
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (NOT EXISTS ${LLVM_MAIN_SRC_DIR})
|
if (NOT EXISTS ${LLVM_MAIN_SRC_DIR})
|
||||||
@@ -54,8 +52,18 @@ if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
|
|||||||
list(APPEND CMAKE_MODULE_PATH "${LLVM_CMAKE_PATH}")
|
list(APPEND CMAKE_MODULE_PATH "${LLVM_CMAKE_PATH}")
|
||||||
list(APPEND CMAKE_MODULE_PATH "${LLVM_MAIN_SRC_DIR}/cmake/modules")
|
list(APPEND CMAKE_MODULE_PATH "${LLVM_MAIN_SRC_DIR}/cmake/modules")
|
||||||
|
|
||||||
|
set(LLVM_FOUND ON)
|
||||||
|
endmacro(find_llvm_parts)
|
||||||
|
|
||||||
|
|
||||||
|
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()
|
||||||
|
|
||||||
if(LLVM_LIT)
|
|
||||||
# Define the default arguments to use with 'lit', and an option for the user
|
# Define the default arguments to use with 'lit', and an option for the user
|
||||||
# to override.
|
# to override.
|
||||||
set(LIT_ARGS_DEFAULT "-sv --show-xfail --show-unsupported")
|
set(LIT_ARGS_DEFAULT "-sv --show-xfail --show-unsupported")
|
||||||
@@ -64,18 +72,9 @@ if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
|
|||||||
endif()
|
endif()
|
||||||
set(LLVM_LIT_ARGS "${LIT_ARGS_DEFAULT}" CACHE STRING "Default options for lit")
|
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.
|
include(AddLLVM OPTIONAL) # Include the LLVM CMake functions.
|
||||||
if( WIN32 AND NOT CYGWIN )
|
include(HandleLLVMOptions OPTIONAL)
|
||||||
set(LLVM_LIT_TOOLS_DIR "" CACHE PATH "Path to GnuWin32 tools")
|
|
||||||
endif()
|
|
||||||
else()
|
|
||||||
set(LLVM_INCLUDE_TESTS OFF)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
include(AddLLVM) # Include the LLVM CMake functions.
|
|
||||||
include(HandleLLVMOptions)
|
|
||||||
set(LIBCXX_BUILT_STANDALONE 1)
|
|
||||||
else()
|
else()
|
||||||
|
set(LLVM_FOUND ON)
|
||||||
set(LLVM_MAIN_SRC_DIR "${CMAKE_SOURCE_DIR}" CACHE PATH "Path to LLVM source tree")
|
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()
|
endif()
|
||||||
|
|||||||
Reference in New Issue
Block a user