Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 75e8fcbb authored by Ying Wang's avatar Ying Wang
Browse files

Apply LOCAL_CXX_STL to also prebuilts.

Because LOCAL_CXX_STL modifies a module's required shared libaries,
we need this for also prebuilt shared libraries and executables.

Change-Id: I418c26143999a613c40aadf990f131b123e0ac3d
parent 9bf56c5e
Loading
Loading
Loading
Loading
+1 −61
Original line number Diff line number Diff line
@@ -166,67 +166,7 @@ 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

# 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
include $(BUILD_SYSTEM)/cxx_stl_setup.mk

# Add static HAL libraries
ifdef LOCAL_HAL_STATIC_LIBRARIES

core/cxx_stl_setup.mk

0 → 100644
+67 −0
Original line number Diff line number Diff line
#############################################################
## Set up flags based on LOCAL_CXX_STL.
## Input variables: LOCAL_CXX_STL
## Output variables: My_cflags, my_c_includes, my_shared_libraries, etc.
#############################################################

# Only around for development purposes. Will be removed soon.
my_libcxx_is_default := false

# 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
+7 −4
Original line number Diff line number Diff line
@@ -91,16 +91,19 @@ endif # prebuilt_module_is_a_library
# of the shared libraries are determined.
ifdef LOCAL_INSTALLED_MODULE
ifdef LOCAL_SHARED_LIBRARIES
my_shared_libraries := $(LOCAL_SHARED_LIBRARIES)
# Extra shared libraries introduced by LOCAL_CXX_STL.
include $(BUILD_SYSTEM)/cxx_stl_setup.mk
$(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)DEPENDENCIES_ON_SHARED_LIBRARIES += \
  $(my_register_name):$(LOCAL_INSTALLED_MODULE):$(subst $(space),$(comma),$(LOCAL_SHARED_LIBRARIES))
  $(my_register_name):$(LOCAL_INSTALLED_MODULE):$(subst $(space),$(comma),$(my_shared_libraries))

# We also need the LOCAL_BUILT_MODULE dependency,
# since we use -rpath-link which points to the built module's path.
built_shared_libraries := \
my_built_shared_libraries := \
    $(addprefix $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)OUT_INTERMEDIATE_LIBRARIES)/, \
    $(addsuffix $($(my_prefix)SHLIB_SUFFIX), \
        $(LOCAL_SHARED_LIBRARIES)))
$(LOCAL_BUILT_MODULE) : $(built_shared_libraries)
        $(my_shared_libraries)))
$(LOCAL_BUILT_MODULE) : $(my_built_shared_libraries)
endif
endif