libcxx: fix bootstrapping for mingw-w64
Differential Revision: https://reviews.llvm.org/D33388 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@303928 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -41,7 +41,15 @@ if (LIBCXX_SUPPORTS_NODEFAULTLIBS_FLAG)
|
|||||||
if (MINGW)
|
if (MINGW)
|
||||||
# Mingw64 requires quite a few "C" runtime libraries in order for basic
|
# Mingw64 requires quite a few "C" runtime libraries in order for basic
|
||||||
# programs to link successfully with -nodefaultlibs.
|
# programs to link successfully with -nodefaultlibs.
|
||||||
list(APPEND CMAKE_REQUIRED_LIBRARIES mingw32 gcc gcc_eh mingwex msvcrt gcc)
|
if (LIBCXX_USE_COMPILER_RT)
|
||||||
|
set(MINGW_RUNTIME ${LIBCXXABI_BUILTINS_LIBRARY})
|
||||||
|
else ()
|
||||||
|
set(MINGW_RUNTIME gcc_s gcc)
|
||||||
|
endif()
|
||||||
|
set(MINGW_LIBRARIES mingw32 ${MINGW_RUNTIME} moldname mingwex msvcrt advapi32
|
||||||
|
shell32 user32 kernel32 mingw32 ${MINGW_RUNTIME}
|
||||||
|
moldname mingwex msvcrt)
|
||||||
|
list(APPEND CMAKE_REQUIRED_LIBRARIES ${MINGW_LIBRARIES})
|
||||||
endif()
|
endif()
|
||||||
if (CMAKE_C_FLAGS MATCHES -fsanitize OR CMAKE_CXX_FLAGS MATCHES -fsanitize)
|
if (CMAKE_C_FLAGS MATCHES -fsanitize OR CMAKE_CXX_FLAGS MATCHES -fsanitize)
|
||||||
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -fno-sanitize=all")
|
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -fno-sanitize=all")
|
||||||
|
|||||||
@@ -27,7 +27,7 @@
|
|||||||
# include <pthread.h>
|
# include <pthread.h>
|
||||||
# include <sched.h>
|
# include <sched.h>
|
||||||
#elif defined(_LIBCPP_HAS_THREAD_API_WIN32)
|
#elif defined(_LIBCPP_HAS_THREAD_API_WIN32)
|
||||||
#include <Windows.h>
|
#include <windows.h>
|
||||||
#include <process.h>
|
#include <process.h>
|
||||||
#include <fibersapi.h>
|
#include <fibersapi.h>
|
||||||
#include <__undef_min_max>
|
#include <__undef_min_max>
|
||||||
|
|||||||
@@ -242,14 +242,11 @@ endif()
|
|||||||
if (LIBCXX_ENABLE_STATIC)
|
if (LIBCXX_ENABLE_STATIC)
|
||||||
add_library(cxx_static STATIC $<TARGET_OBJECTS:cxx_objects>)
|
add_library(cxx_static STATIC $<TARGET_OBJECTS:cxx_objects>)
|
||||||
target_link_libraries(cxx_static ${LIBCXX_LIBRARIES})
|
target_link_libraries(cxx_static ${LIBCXX_LIBRARIES})
|
||||||
set(STATIC_OUTPUT_NAME "c++")
|
set(CMAKE_STATIC_LIBRARY_PREFIX "lib")
|
||||||
if (WIN32)
|
|
||||||
set(STATIC_OUTPUT_NAME "libc++")
|
|
||||||
endif()
|
|
||||||
set_target_properties(cxx_static
|
set_target_properties(cxx_static
|
||||||
PROPERTIES
|
PROPERTIES
|
||||||
LINK_FLAGS "${LIBCXX_LINK_FLAGS}"
|
LINK_FLAGS "${LIBCXX_LINK_FLAGS}"
|
||||||
OUTPUT_NAME "${STATIC_OUTPUT_NAME}"
|
OUTPUT_NAME "c++"
|
||||||
)
|
)
|
||||||
|
|
||||||
list(APPEND LIBCXX_TARGETS "cxx_static")
|
list(APPEND LIBCXX_TARGETS "cxx_static")
|
||||||
|
|||||||
Reference in New Issue
Block a user