Merge "Move selection of C++ STL into the build system."
This commit is contained in:
commit
98f7742a7f
|
@ -107,6 +107,7 @@ my_shared_libraries := $(LOCAL_SHARED_LIBRARIES)
|
|||
my_cflags := $(LOCAL_CFLAGS)
|
||||
my_cppflags := $(LOCAL_CPPFLAGS)
|
||||
my_ldflags := $(LOCAL_LDFLAGS)
|
||||
my_ldlibs := $(LOCAL_LDLIBS)
|
||||
my_asflags := $(LOCAL_ASFLAGS)
|
||||
my_cc := $(LOCAL_CC)
|
||||
my_cxx := $(LOCAL_CXX)
|
||||
|
@ -164,11 +165,66 @@ my_whole_static_libraries := $(LOCAL_WHOLE_STATIC_LIBRARIES_$($(my_prefix)$(LOCA
|
|||
|
||||
my_cflags := $(filter-out $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)GLOBAL_UNSUPPORTED_CFLAGS),$(my_cflags))
|
||||
|
||||
# Only around for development purposes. Will be removed soon.
|
||||
my_libcxx_is_default := false
|
||||
|
||||
# Replace libstdc++ with libc++ if it's seen
|
||||
my_libcxx := $(filter libc++, $(my_shared_libraries))
|
||||
ifdef my_libcxx
|
||||
my_system_shared_libraries := $(filter-out libstdc++, $(my_system_shared_libraries))
|
||||
# Select the appropriate C++ STL
|
||||
ifeq ($(strip $(LOCAL_CXX_STL)),default)
|
||||
ifndef LOCAL_SDK_VERSION
|
||||
ifeq ($(strip $(my_libcxx_is_default)),true)
|
||||
# Platform code. Select the appropriate STL.
|
||||
my_cxx_stl := libc++
|
||||
else
|
||||
my_cxx_stl := bionic
|
||||
endif
|
||||
else
|
||||
my_cxx_stl := ndk
|
||||
endif
|
||||
else
|
||||
my_cxx_stl := $(strip $(LOCAL_CXX_STL))
|
||||
endif
|
||||
|
||||
ifneq ($(filter $(my_cxx_stl),libc++ libc++_static),)
|
||||
my_cflags += -D_USING_LIBCXX
|
||||
my_c_includes += external/libcxx/include
|
||||
ifeq ($(my_cxx_stl),libc++)
|
||||
my_shared_libraries += libc++
|
||||
else
|
||||
my_static_libraries += libc++_static
|
||||
endif
|
||||
|
||||
ifdef LOCAL_IS_HOST_MODULE
|
||||
my_cppflags += -nostdinc++
|
||||
my_ldflags += -nodefaultlibs
|
||||
my_ldlibs += -lc -lm
|
||||
endif
|
||||
else ifneq ($(filter $(my_cxx_stl),stlport stlport_static),)
|
||||
my_c_includes += external/stlport/stlport bionic/libstdc++/include bionic
|
||||
ifeq ($(my_cxx_stl),stlport)
|
||||
my_shared_libraries += libstdc++ libstlport
|
||||
else
|
||||
my_static_libraries += libstdc++ libstlport_static
|
||||
endif
|
||||
else ifeq ($(my_cxx_stl),ndk)
|
||||
# Using an NDK STL. Handled farther up in this file.
|
||||
ifndef LOCAL_IS_HOST_MODULE
|
||||
my_system_shared_libraries += libstdc++
|
||||
endif
|
||||
else ifeq ($(my_cxx_stl),bionic)
|
||||
# Using bionic's basic libstdc++. Not actually an STL. Only around until the
|
||||
# tree is in good enough shape to not need it.
|
||||
ifndef LOCAL_IS_HOST_MODULE
|
||||
my_c_includes += bionic/libstdc++/include
|
||||
my_system_shared_libraries += libstdc++
|
||||
endif
|
||||
# Host builds will use GNU libstdc++.
|
||||
else ifeq ($(my_cxx_stl),none)
|
||||
ifdef LOCAL_IS_HOST_MODULE
|
||||
my_cppflags += -nostdinc++
|
||||
my_ldflags += -nodefaultlibs -lc -lm
|
||||
endif
|
||||
else
|
||||
$(error $(my_cxx_stl) is not a supported STL.)
|
||||
endif
|
||||
|
||||
# Add static HAL libraries
|
||||
|
@ -947,7 +1003,7 @@ $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_DEBUG_CFLAGS := $(debug_cflags)
|
|||
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_C_INCLUDES := $(my_c_includes)
|
||||
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_IMPORT_INCLUDES := $(import_includes)
|
||||
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_LDFLAGS := $(my_ldflags)
|
||||
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_LDLIBS := $(LOCAL_LDLIBS)
|
||||
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_LDLIBS := $(my_ldlibs)
|
||||
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_NO_CRT := $(strip $(LOCAL_NO_CRT) $(LOCAL_NO_CRT_$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)))
|
||||
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_LIBCXX := $(my_libcxx)
|
||||
|
||||
|
|
|
@ -157,6 +157,7 @@ LOCAL_MODULE_UNSUPPORTED_TARGET_ARCH:=
|
|||
LOCAL_MODULE_UNSUPPORTED_TARGET_ARCH_WARN:=
|
||||
LOCAL_MODULE_HOST_ARCH:=
|
||||
LOCAL_NO_FPIE :=
|
||||
LOCAL_CXX_STL := default
|
||||
|
||||
# arch specific variables
|
||||
LOCAL_SRC_FILES_$(TARGET_ARCH):=
|
||||
|
|
|
@ -153,7 +153,6 @@ $(combo_2nd_arch_prefix)TARGET_RELEASE_CFLAGS := \
|
|||
|
||||
libc_root := bionic/libc
|
||||
libm_root := bionic/libm
|
||||
libstdc++_root := bionic/libstdc++
|
||||
|
||||
|
||||
## on some hosts, the target cross-compiler is not available so do not run this command
|
||||
|
@ -176,7 +175,6 @@ KERNEL_HEADERS := $(KERNEL_HEADERS_COMMON) $(KERNEL_HEADERS_ARCH)
|
|||
$(combo_2nd_arch_prefix)TARGET_C_INCLUDES := \
|
||||
$(libc_root)/arch-arm/include \
|
||||
$(libc_root)/include \
|
||||
$(libstdc++_root)/include \
|
||||
$(KERNEL_HEADERS) \
|
||||
$(libm_root)/include \
|
||||
$(libm_root)/include/arm \
|
||||
|
@ -190,7 +188,7 @@ $(combo_2nd_arch_prefix)TARGET_CRTEND_SO_O := $($(combo_2nd_arch_prefix)TARGET_O
|
|||
|
||||
$(combo_2nd_arch_prefix)TARGET_STRIP_MODULE:=true
|
||||
|
||||
$(combo_2nd_arch_prefix)TARGET_DEFAULT_SYSTEM_SHARED_LIBRARIES := libc libstdc++ libm
|
||||
$(combo_2nd_arch_prefix)TARGET_DEFAULT_SYSTEM_SHARED_LIBRARIES := libc libm
|
||||
|
||||
$(combo_2nd_arch_prefix)TARGET_CUSTOM_LD_COMMAND := true
|
||||
|
||||
|
|
|
@ -126,7 +126,6 @@ TARGET_RELEASE_CFLAGS := \
|
|||
|
||||
libc_root := bionic/libc
|
||||
libm_root := bionic/libm
|
||||
libstdc++_root := bionic/libstdc++
|
||||
|
||||
TARGET_LIBGCC := $(shell $(TARGET_CC) $(TARGET_GLOBAL_CFLAGS) \
|
||||
-print-libgcc-file-name)
|
||||
|
@ -140,7 +139,6 @@ KERNEL_HEADERS := $(KERNEL_HEADERS_COMMON) $(KERNEL_HEADERS_ARCH)
|
|||
TARGET_C_INCLUDES := \
|
||||
$(libc_root)/arch-arm64/include \
|
||||
$(libc_root)/include \
|
||||
$(libstdc++_root)/include \
|
||||
$(KERNEL_HEADERS) \
|
||||
$(libm_root)/include \
|
||||
$(libm_root)/include/arm64 \
|
||||
|
@ -154,7 +152,7 @@ TARGET_CRTEND_SO_O := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtend_so.o
|
|||
|
||||
TARGET_STRIP_MODULE:=true
|
||||
|
||||
TARGET_DEFAULT_SYSTEM_SHARED_LIBRARIES := libc libstdc++ libm
|
||||
TARGET_DEFAULT_SYSTEM_SHARED_LIBRARIES := libc libm
|
||||
|
||||
TARGET_CUSTOM_LD_COMMAND := true
|
||||
|
||||
|
|
|
@ -121,7 +121,6 @@ $(combo_2nd_arch_prefix)TARGET_RELEASE_CFLAGS := \
|
|||
|
||||
libc_root := bionic/libc
|
||||
libm_root := bionic/libm
|
||||
libstdc++_root := bionic/libstdc++
|
||||
|
||||
|
||||
## on some hosts, the target cross-compiler is not available so do not run this command
|
||||
|
@ -148,7 +147,6 @@ KERNEL_HEADERS := $(KERNEL_HEADERS_COMMON) $(KERNEL_HEADERS_ARCH)
|
|||
$(combo_2nd_arch_prefix)TARGET_C_INCLUDES := \
|
||||
$(libc_root)/arch-mips/include \
|
||||
$(libc_root)/include \
|
||||
$(libstdc++_root)/include \
|
||||
$(KERNEL_HEADERS) \
|
||||
$(libm_root)/include \
|
||||
$(libm_root)/include/mips \
|
||||
|
@ -162,7 +160,7 @@ $(combo_2nd_arch_prefix)TARGET_CRTEND_SO_O := $($(combo_2nd_arch_prefix)TARGET_O
|
|||
|
||||
$(combo_2nd_arch_prefix)TARGET_STRIP_MODULE:=true
|
||||
|
||||
$(combo_2nd_arch_prefix)TARGET_DEFAULT_SYSTEM_SHARED_LIBRARIES := libc libstdc++ libm
|
||||
$(combo_2nd_arch_prefix)TARGET_DEFAULT_SYSTEM_SHARED_LIBRARIES := libc libm
|
||||
|
||||
$(combo_2nd_arch_prefix)TARGET_CUSTOM_LD_COMMAND := true
|
||||
|
||||
|
|
|
@ -121,7 +121,6 @@ TARGET_RELEASE_CFLAGS := \
|
|||
|
||||
libc_root := bionic/libc
|
||||
libm_root := bionic/libm
|
||||
libstdc++_root := bionic/libstdc++
|
||||
libthread_db_root := bionic/libthread_db
|
||||
|
||||
|
||||
|
@ -150,7 +149,6 @@ KERNEL_HEADERS := $(KERNEL_HEADERS_COMMON) $(KERNEL_HEADERS_ARCH)
|
|||
TARGET_C_INCLUDES := \
|
||||
$(libc_root)/arch-mips64/include \
|
||||
$(libc_root)/include \
|
||||
$(libstdc++_root)/include \
|
||||
$(KERNEL_HEADERS) \
|
||||
$(libm_root)/include \
|
||||
$(libm_root)/include/mips \
|
||||
|
|
|
@ -70,7 +70,6 @@ $(combo_2nd_arch_prefix)TARGET_NO_UNDEFINED_LDFLAGS := -Wl,--no-undefined
|
|||
|
||||
libc_root := bionic/libc
|
||||
libm_root := bionic/libm
|
||||
libstdc++_root := bionic/libstdc++
|
||||
|
||||
KERNEL_HEADERS_COMMON := $(libc_root)/kernel/uapi
|
||||
KERNEL_HEADERS_ARCH := $(libc_root)/kernel/uapi/asm-x86 # x86 covers both x86 and x86_64.
|
||||
|
@ -130,7 +129,6 @@ $(combo_2nd_arch_prefix)TARGET_GLOBAL_LDFLAGS += -Wl,--gc-sections
|
|||
$(combo_2nd_arch_prefix)TARGET_C_INCLUDES := \
|
||||
$(libc_root)/arch-x86/include \
|
||||
$(libc_root)/include \
|
||||
$(libstdc++_root)/include \
|
||||
$(KERNEL_HEADERS) \
|
||||
$(libm_root)/include \
|
||||
$(libm_root)/include/i387 \
|
||||
|
@ -144,7 +142,7 @@ $(combo_2nd_arch_prefix)TARGET_CRTEND_SO_O := $($(combo_2nd_arch_prefix)TARGET_O
|
|||
|
||||
$(combo_2nd_arch_prefix)TARGET_STRIP_MODULE:=true
|
||||
|
||||
$(combo_2nd_arch_prefix)TARGET_DEFAULT_SYSTEM_SHARED_LIBRARIES := libc libstdc++ libm
|
||||
$(combo_2nd_arch_prefix)TARGET_DEFAULT_SYSTEM_SHARED_LIBRARIES := libc libm
|
||||
|
||||
$(combo_2nd_arch_prefix)TARGET_CUSTOM_LD_COMMAND := true
|
||||
define $(combo_2nd_arch_prefix)transform-o-to-shared-lib-inner
|
||||
|
|
|
@ -70,7 +70,6 @@ TARGET_NO_UNDEFINED_LDFLAGS := -Wl,--no-undefined
|
|||
|
||||
libc_root := bionic/libc
|
||||
libm_root := bionic/libm
|
||||
libstdc++_root := bionic/libstdc++
|
||||
|
||||
KERNEL_HEADERS_COMMON := $(libc_root)/kernel/uapi
|
||||
KERNEL_HEADERS_ARCH := $(libc_root)/kernel/uapi/asm-x86 # x86 covers both x86 and x86_64.
|
||||
|
@ -135,7 +134,6 @@ TARGET_GLOBAL_LDFLAGS += -Wl,--gc-sections
|
|||
TARGET_C_INCLUDES := \
|
||||
$(libc_root)/arch-x86_64/include \
|
||||
$(libc_root)/include \
|
||||
$(libstdc++_root)/include \
|
||||
$(KERNEL_HEADERS) \
|
||||
$(libm_root)/include \
|
||||
$(libm_root)/include/amd64 \
|
||||
|
@ -149,7 +147,7 @@ TARGET_CRTEND_SO_O := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtend_so.o
|
|||
|
||||
TARGET_STRIP_MODULE:=true
|
||||
|
||||
TARGET_DEFAULT_SYSTEM_SHARED_LIBRARIES := libc libstdc++ libm
|
||||
TARGET_DEFAULT_SYSTEM_SHARED_LIBRARIES := libc libm
|
||||
|
||||
TARGET_CUSTOM_LD_COMMAND := true
|
||||
define transform-o-to-shared-lib-inner
|
||||
|
|
|
@ -5,7 +5,17 @@
|
|||
LOCAL_CFLAGS += -DGTEST_OS_LINUX_ANDROID -DGTEST_HAS_STD_STRING
|
||||
|
||||
LOCAL_C_INCLUDES += external/gtest/include
|
||||
ifneq ($(filter libc++,$(LOCAL_SHARED_LIBRARIES)),)
|
||||
|
||||
my_test_libcxx := false
|
||||
ifndef LOCAL_SDK_VERSION
|
||||
ifeq (,$(TARGET_BUILD_APPS))
|
||||
ifeq ($(strip $(LOCAL_CXX_STL)),libc++)
|
||||
my_test_libcxx := true
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(my_test_libcxx),true)
|
||||
LOCAL_STATIC_LIBRARIES += libgtest_libc++ libgtest_main_libc++
|
||||
else
|
||||
LOCAL_STATIC_LIBRARIES += libgtest libgtest_main
|
||||
|
|
|
@ -21,5 +21,6 @@ LOCAL_STATIC_LIBRARIES := libhost
|
|||
LOCAL_C_INCLUDES := build/libs/host/include
|
||||
LOCAL_MODULE := acp
|
||||
LOCAL_ACP_UNAVAILABLE := true
|
||||
LOCAL_CXX_STL := none
|
||||
|
||||
include $(BUILD_HOST_EXECUTABLE)
|
||||
|
|
Loading…
Reference in New Issue