Ying Wang | 75e8fcb | 2014-10-07 13:03:29 -0700 | [diff] [blame] | 1 | ############################################################# |
| 2 | ## Set up flags based on LOCAL_CXX_STL. |
| 3 | ## Input variables: LOCAL_CXX_STL |
| 4 | ## Output variables: My_cflags, my_c_includes, my_shared_libraries, etc. |
| 5 | ############################################################# |
| 6 | |
Ying Wang | 75e8fcb | 2014-10-07 13:03:29 -0700 | [diff] [blame] | 7 | # Select the appropriate C++ STL |
| 8 | ifeq ($(strip $(LOCAL_CXX_STL)),default) |
| 9 | ifndef LOCAL_SDK_VERSION |
Dan Albert | 93766b2 | 2014-10-16 19:07:41 -0700 | [diff] [blame^] | 10 | # Platform code. Select the appropriate STL. |
| 11 | ifndef USE_MINGW |
Ying Wang | 75e8fcb | 2014-10-07 13:03:29 -0700 | [diff] [blame] | 12 | my_cxx_stl := libc++ |
| 13 | else |
Dan Albert | 93766b2 | 2014-10-16 19:07:41 -0700 | [diff] [blame^] | 14 | # libc++ is not supported on mingw. |
Dan Albert | 93e8cf7 | 2014-10-16 21:18:15 -0700 | [diff] [blame] | 15 | my_cxx_stl := libstdc++ |
Ying Wang | 75e8fcb | 2014-10-07 13:03:29 -0700 | [diff] [blame] | 16 | endif |
| 17 | else |
| 18 | my_cxx_stl := ndk |
| 19 | endif |
| 20 | else |
| 21 | my_cxx_stl := $(strip $(LOCAL_CXX_STL)) |
| 22 | endif |
| 23 | |
| 24 | ifneq ($(filter $(my_cxx_stl),libc++ libc++_static),) |
| 25 | my_cflags += -D_USING_LIBCXX |
| 26 | my_c_includes += external/libcxx/include |
| 27 | ifeq ($(my_cxx_stl),libc++) |
| 28 | my_shared_libraries += libc++ |
| 29 | else |
| 30 | my_static_libraries += libc++_static |
| 31 | endif |
| 32 | |
| 33 | ifdef LOCAL_IS_HOST_MODULE |
| 34 | my_cppflags += -nostdinc++ |
| 35 | my_ldflags += -nodefaultlibs |
Dan Albert | 5cab04f | 2014-11-06 17:32:25 -0800 | [diff] [blame] | 36 | my_ldlibs += -lc -lm -lpthread |
Ying Wang | 75e8fcb | 2014-10-07 13:03:29 -0700 | [diff] [blame] | 37 | endif |
| 38 | else ifneq ($(filter $(my_cxx_stl),stlport stlport_static),) |
Dan Albert | b49987e | 2014-10-16 09:53:51 -0700 | [diff] [blame] | 39 | ifndef LOCAL_IS_HOST_MODULE |
| 40 | my_c_includes += external/stlport/stlport bionic/libstdc++/include \ |
| 41 | bionic |
| 42 | ifeq ($(my_cxx_stl),stlport) |
| 43 | my_shared_libraries += libstdc++ libstlport |
| 44 | else |
| 45 | my_static_libraries += libstdc++ libstlport_static |
| 46 | endif |
Ying Wang | 75e8fcb | 2014-10-07 13:03:29 -0700 | [diff] [blame] | 47 | endif |
| 48 | else ifeq ($(my_cxx_stl),ndk) |
| 49 | # Using an NDK STL. Handled farther up in this file. |
| 50 | ifndef LOCAL_IS_HOST_MODULE |
| 51 | my_system_shared_libraries += libstdc++ |
| 52 | endif |
Dan Albert | 93e8cf7 | 2014-10-16 21:18:15 -0700 | [diff] [blame] | 53 | else ifeq ($(my_cxx_stl),libstdc++) |
Ying Wang | 75e8fcb | 2014-10-07 13:03:29 -0700 | [diff] [blame] | 54 | # Using bionic's basic libstdc++. Not actually an STL. Only around until the |
| 55 | # tree is in good enough shape to not need it. |
| 56 | ifndef LOCAL_IS_HOST_MODULE |
| 57 | my_c_includes += bionic/libstdc++/include |
| 58 | my_system_shared_libraries += libstdc++ |
| 59 | endif |
| 60 | # Host builds will use GNU libstdc++. |
| 61 | else ifeq ($(my_cxx_stl),none) |
| 62 | ifdef LOCAL_IS_HOST_MODULE |
| 63 | my_cppflags += -nostdinc++ |
| 64 | my_ldflags += -nodefaultlibs -lc -lm |
| 65 | endif |
| 66 | else |
| 67 | $(error $(my_cxx_stl) is not a supported STL.) |
| 68 | endif |