android – LOCAL_EXPORT_C_INCLUDES和LOCAL_C_INCLUDES之间的区别

前端之家收集整理的这篇文章主要介绍了android – LOCAL_EXPORT_C_INCLUDES和LOCAL_C_INCLUDES之间的区别前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
有人请解释一下 android mk文件中LOCAL_EXPORT_C_INCLUDES和LOCAL_C_INCLUDES之间的区别.

解决方法

如果模块将路径添加到LOCAL_EXPORT_C_INCLUDES,则这些路径将添加到另一个模块的LOCAL_C_INCLUDES定义中,该模块使用LOCAL_STATIC_LIBRARIES或LOCAL_SHARED_LIBRARIES.

考虑我们有2个模块,例如foo和bar以及是树结构.

.
|-- Android.mk
|-- bar
|   |-- bar.c
|   |-- bar.h
|-- foo
    |-- foo.c
    `-- foo.h

bar使用foo作为静态库.由于bar.c需要包含foo.h,因此foo模块必须添加LOCAL_EXPORT_C_INCLUDES的包含路径.如果任何模块都没有使用bar,那么它可以添加到LOCAL_C_INCLUDES的包含路径.

Android.mk将如下所示:

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)
LOCAL_MODULE := foo
LOCAL_SRC_FILES := foo/foo.c
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/foo
include $(BUILD_STATIC_LIBRARY)

include $(CLEAR_VARS)
LOCAL_MODULE := bar
LOCAL_SRC_FILES := bar/bar.c
LOCAL_C_INCLUDES := $(LOCAL_PATH)/bar
LOCAL_STATIC_LIBRARIES := foo
include $(BUILD_SHARED_LIBRARY)

请看一下android-ndk示例目录中提供的示例:android-ndk-r9d / samples / module-exports

原文链接:https://www.f2er.com/android/310042.html

猜你在找的Android相关文章