Merge "Change STL for Windows to libc++."

This commit is contained in:
Pirama Arumuga Nainar 2018-10-11 17:00:53 +00:00 committed by Gerrit Code Review
commit 5155d9a8dd
1 changed files with 22 additions and 12 deletions

View File

@ -15,8 +15,7 @@ ifeq ($(strip $(LOCAL_CXX_STL)),default)
endif
ifeq ($($(my_prefix)OS),windows)
# libc++ is not supported on mingw.
my_cxx_stl := libstdc++
my_cxx_stl := libc++_static
endif
endif
else
@ -38,9 +37,9 @@ else
endif
ifdef LOCAL_IS_HOST_MODULE
ifeq ($($(my_prefix)OS),windows)
ifneq ($(filter $(my_cxx_stl),libc++ libc++_static),)
# libc++ is not supported on mingw.
my_cxx_stl := libstdc++
ifneq ($(filter $(my_cxx_stl),libc++),)
# only libc++_static is supported on mingw.
my_cxx_stl := libc++_static
endif
endif
endif
@ -52,8 +51,9 @@ linux_static_gcclibs := -Wl,--start-group -lgcc -lgcc_eh -lc -Wl,--end-group
darwin_dynamic_gcclibs := -lc -lSystem
darwin_static_gcclibs := NO_STATIC_HOST_BINARIES_ON_DARWIN
windows_dynamic_gcclibs := \
-lmsvcr110 -lmingw32 -lgcc -lmoldname -lmingwex -lmsvcrt -ladvapi32 \
-lshell32 -luser32 -lkernel32 -lmingw32 -lgcc -lmoldname -lmingwex -lmsvcrt
-Wl,--start-group -lmingw32 -lgcc -lgcc_eh -lmoldname -lmingwex -lmsvcr110 \
-lmsvcrt -lpthread -ladvapi32 -lshell32 -luser32 -lkernel32 -lpsapi \
-Wl,--end-group
windows_static_gcclibs := NO_STATIC_HOST_BINARIES_ON_WINDOWS
my_link_type := dynamic
@ -100,6 +100,20 @@ ifneq ($(filter $(my_cxx_stl),libc++ libc++_static),)
my_cppflags += -nostdinc++
my_ldflags += -nodefaultlibs
my_cxx_ldlibs += $($($(my_prefix)OS)_$(my_link_type)_gcclibs)
ifeq ($($(my_prefix)OS),windows)
# Use SjLj exceptions for 32-bit. libgcc_eh implements SjLj
# exception model for 32-bit.
ifeq (x86,$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH))
my_cppflags += -fsjlj-exceptions
endif
# Disable visibility annotations since we're using libc++ static
# library.
my_cppflags += -D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS
my_cppflags += -D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS
# Use Win32 threads in libc++.
my_cppflags += -D_LIBCPP_HAS_THREAD_API_WIN32
endif
else
ifeq (arm,$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH))
my_static_libraries += libunwind_llvm
@ -113,11 +127,7 @@ ifneq ($(filter $(my_cxx_stl),libc++ libc++_static),)
else ifeq ($(my_cxx_stl),ndk)
# Using an NDK STL. Handled in binary.mk.
else ifeq ($(my_cxx_stl),libstdc++)
ifndef LOCAL_IS_HOST_MODULE
$(error $(LOCAL_PATH): $(LOCAL_MODULE): libstdc++ is not supported for device modules)
else ifneq ($($(my_prefix)OS),windows)
$(error $(LOCAL_PATH): $(LOCAL_MODULE): libstdc++ is not supported on $($(my_prefix)OS))
endif
$(error $(LOCAL_PATH): $(LOCAL_MODULE): libstdc++ is not supported)
else ifeq ($(my_cxx_stl),none)
ifdef LOCAL_IS_HOST_MODULE
my_cppflags += -nostdinc++