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