platform_build/core/cxx_stl_setup.mk
Dan Albert 93766b28ce Make libc++ the default STL.
Previously, code defaulted to using libstdc++ (which was GNU libstdc++
on the host, or Bionic's "libstdc++" on the target). Now we default to
libc++. The exception for this is when using mingw, because we cannot
build libc++ for mingw.

Change-Id: I68726fa26cdcb6263f17c838d3e859debd57fae1
2014-11-07 13:24:56 -08:00

68 lines
2.2 KiB
Makefile

#############################################################
## Set up flags based on LOCAL_CXX_STL.
## Input variables: LOCAL_CXX_STL
## Output variables: My_cflags, my_c_includes, my_shared_libraries, etc.
#############################################################
# Select the appropriate C++ STL
ifeq ($(strip $(LOCAL_CXX_STL)),default)
ifndef LOCAL_SDK_VERSION
# Platform code. Select the appropriate STL.
ifndef USE_MINGW
my_cxx_stl := libc++
else
# libc++ is not supported on mingw.
my_cxx_stl := libstdc++
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 -lpthread
endif
else ifneq ($(filter $(my_cxx_stl),stlport stlport_static),)
ifndef LOCAL_IS_HOST_MODULE
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
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),libstdc++)
# 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