Reputation: 431
I have a Application.mk and a Android.mk file.
Application.mk looks like
NDK_TOOLCHAIN_VERSION := 4.8
APP_PLATFORM := android-9
APP_STL := c++_shared
APP_ABI := armeabi-v7a
and my Android.mk looks like
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := foo1
LOCAL_SRC_FILES := foo1.cpp
# ... some other stuff ...
include $(BUILD_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := foo2
LOCAL_SRC_FILES := foo2.cpp
# ... some other stuff ...
include $(BUILD_SHARED_LIBRARY)
Now I want that library libfoo1 use c++_shared for APP_STL and libfoo2 use c++_static for APP_STL. (I know, normally that should not be made relation between app_stl values with static and shared build android). Is there a easy way without building a extra project and import the library to the other project?
Upvotes: 1
Views: 1052
Reputation: 1259
Yes, it is possible. Do the following changes:
# Application.mk
APP_STL := none
This way you disable internal logic of choosing STL implementation of NDK build system. Now, specify manually which C++ stdlib implementation you want link with:
# Android.mk
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := foo1
LOCAL_SRC_FILES := foo1.cpp
LOCAL_SHARED_LIBRARIES := c++_shared
# ... some other stuff ...
include $(BUILD_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := foo2
LOCAL_SRC_FILES := foo2.cpp
LOCAL_STATIC_LIBRARIES := c++_static
# ... some other stuff ...
include $(BUILD_SHARED_LIBRARY)
$(call import-module,cxx-stl/llvm-libc++)
Upvotes: 2