2014-10-07 22:03:29 +02:00
|
|
|
#############################################################
|
|
|
|
## 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
|
2014-10-17 04:07:41 +02:00
|
|
|
# Platform code. Select the appropriate STL.
|
|
|
|
ifndef USE_MINGW
|
2014-10-07 22:03:29 +02:00
|
|
|
my_cxx_stl := libc++
|
2015-03-03 23:10:27 +01:00
|
|
|
ifdef LOCAL_IS_HOST_MODULE
|
|
|
|
ifneq (,$(BUILD_HOST_static))
|
|
|
|
my_cxx_stl := libc++_static
|
|
|
|
endif
|
|
|
|
endif
|
2014-10-07 22:03:29 +02:00
|
|
|
else
|
2014-10-17 04:07:41 +02:00
|
|
|
# libc++ is not supported on mingw.
|
2014-10-17 06:18:15 +02:00
|
|
|
my_cxx_stl := libstdc++
|
2014-10-07 22:03:29 +02:00
|
|
|
endif
|
|
|
|
else
|
|
|
|
my_cxx_stl := ndk
|
|
|
|
endif
|
|
|
|
else
|
|
|
|
my_cxx_stl := $(strip $(LOCAL_CXX_STL))
|
|
|
|
endif
|
|
|
|
|
2015-03-04 02:42:28 +01:00
|
|
|
# Yes, this is actually what the clang driver does.
|
|
|
|
HOST_dynamic_gcclibs := -lgcc_s -lgcc -lc -lgcc_s -lgcc
|
|
|
|
HOST_static_gcclibs := -Wl,--start-group -lgcc -lgcc_eh -lc -Wl,--end-group
|
|
|
|
|
2014-10-07 22:03:29 +02:00
|
|
|
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
|
2015-03-03 23:10:27 +01:00
|
|
|
my_ldlibs += -lpthread -lm
|
2015-03-04 02:42:28 +01:00
|
|
|
ifeq (,$(BUILD_HOST_static))
|
|
|
|
my_ldlibs += $(HOST_dynamic_gcclibs)
|
|
|
|
else
|
|
|
|
my_ldlibs += $(HOST_static_gcclibs)
|
|
|
|
endif
|
2014-10-07 22:03:29 +02:00
|
|
|
endif
|
|
|
|
else ifneq ($(filter $(my_cxx_stl),stlport stlport_static),)
|
2014-10-16 18:53:51 +02:00
|
|
|
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
|
2014-10-07 22:03:29 +02:00
|
|
|
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
|
2014-10-17 06:18:15 +02:00
|
|
|
else ifeq ($(my_cxx_stl),libstdc++)
|
2014-10-07 22:03:29 +02:00
|
|
|
# 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++
|
2015-03-03 23:10:27 +01:00
|
|
|
my_ldflags += -nodefaultlibs
|
2015-03-04 02:42:28 +01:00
|
|
|
ifeq (,$(BUILD_HOST_static))
|
|
|
|
my_ldlibs += $(HOST_dynamic_gcclibs)
|
|
|
|
else
|
|
|
|
my_ldlibs += $(HOST_static_gcclibs)
|
|
|
|
endif
|
2014-10-07 22:03:29 +02:00
|
|
|
endif
|
|
|
|
else
|
|
|
|
$(error $(my_cxx_stl) is not a supported STL.)
|
|
|
|
endif
|