AOSP:静态预建模块及其家属

时间:2018-06-19 01:07:23

标签: android-source

  • 我有预制的opencv二进制文件作为使用android NDK r16 for arm64-v8a& amp; armeabi-V7A。
  • 我尝试在AOSP构建中使用这些二进制文件,用于相同的上述两种体系结构。
  • opencv prebuild的输出似乎已将opencv特定的.a文件与3rdparty .a文件分开。我收集这意味着成功链接我将包括opencv库(例如libopencv_core.a)以及第三方依赖(libtbb.a)。 我不确定如何在静态预建模块说明中指定3rdparty依赖项。

这是opencv输出的文件夹结构

sdk
    └── native
    ├── 3rdparty
    │   └── libs
    │       ├── arm64-v8a
    │       │   ├── libcpufeatures.a
    │       │   └── libtbb.a
    │       ├── armeabi-v7a
    │       │   ├── libcpufeatures.a
    │       │   └── libtbb.a
    │       ├── x86
    │       │   ├── libcpufeatures.a
    │       │   ├── libittnotify.a
    │       │   └── libtbb.a
    │       └── x86_64
    │           ├── libcpufeatures.a
    │           ├── libittnotify.a
    │           └── libtbb.a
    ├── jni
    │   ├── android.toolchain.cmake
    │   ├── include
    │   │   ├── opencv
    │   │   │   ├── cvaux.h
    |   |   |   ...
    │   │   └── opencv2
    │   │       ├── core
    └── libs
        ├── arm64-v8a
        │   ├── libopencv_core.a
        │   ├── libopencv_features2d.a
        │   ├── libopencv_imgproc.a
        │   └── libopencv_video.a
        ├── armeabi-v7a
        │   ├── libopencv_core.a
        │   ├── libopencv_features2d.a
        │   ├── libopencv_imgproc.a
        │   └── libopencv_video.a
        ├── x86
        │   ├── libopencv_core.a
        │   ├── libopencv_features2d.a
        │   ├── libopencv_imgproc.a
        │   └── libopencv_video.a
        └── x86_64
            ├── libopencv_core.a
            ├── libopencv_features2d.a
            ├── libopencv_imgproc.a
            └── libopencv_video.a

依赖项位于3rdparty文件夹中。 我创建了一个Android.mk文件,它使所有opencv库中的PREBUILD成为可能,但我不确定如何将依赖项添加到预构建模块中。这是我目前的Android.mk文件

ROOT_DIR := $(call my-dir)


LOCAL_PATH := $(ROOT_DIR)/core-libs/opencv/Android/sdk/native/libs
include $(CLEAR_VARS)
LOCAL_MODULE := opencv_core_prebuilt
LOCAL_MULTILIB := both
LOCAL_MODULE_CLASS := STATIC_LIBRARIES
LOCAL_MODULE_SUFFIX := .a
LOCAL_SRC_FILES_64 := arm64-v8a/libopencv_core.a
LOCAL_SRC_FILES_32 := armeabi-v7a/libopencv_core.a
LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/../jni/include
LOCAL_EXPORT_CFLAGS_64 := -L$(LOCAL_PATH)/../3rdparty/libs/arm64-v8a -llibtbb.a -llibcpufeatures.a
LOCAL_EXPORT_CFLAGS_32 := -L$(LOCAL_PATH)/../3rdparty/libs/armeabi-v7a -llibtbb.a -llibcpufeatures.a
include $(BUILD_PREBUILT)

include $(CLEAR_VARS)
LOCAL_MODULE := opencv_features2d_prebuilt
LOCAL_MULTILIB := both
LOCAL_MODULE_CLASS := STATIC_LIBRARIES
LOCAL_MODULE_SUFFIX := .a
LOCAL_SRC_FILES_64 := arm64-v8a/libopencv_features2d.a
LOCAL_SRC_FILES_32 := armeabi-v7a/libopencv_features2d.a
LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/../jni/include 
include $(BUILD_PREBUILT)

include $(CLEAR_VARS)
LOCAL_MODULE := opencv_imgproc_prebuilt
LOCAL_MULTILIB := both 
LOCAL_MODULE_CLASS := STATIC_LIBRARIES
LOCAL_MODULE_SUFFIX := .a
LOCAL_SRC_FILES_64 := arm64-v8a/libopencv_imgproc.a
LOCAL_SRC_FILES_32 := armeabi-v7a/libopencv_imgproc.a
LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/../jni/include 
include $(BUILD_PREBUILT)

include $(CLEAR_VARS)
LOCAL_MODULE := opencv_video_prebuilt
LOCAL_MULTILIB := both
LOCAL_MODULE_CLASS := STATIC_LIBRARIES
LOCAL_MODULE_SUFFIX := .a
LOCAL_SRC_FILES_64 := arm64-v8a/libopencv_video.a
LOCAL_SRC_FILES_32 := armeabi-v7a/libopencv_video.a
LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/../jni/include 
include $(BUILD_PREBUILT)

当我尝试链接到opencv prebuilds时,我得到了对libtbb调用的未定义引用。

如何指定libtbb依赖项以及如何确保相应的3rdparty .a文件链接在一起。

我可以将它添加到LOCAL_SRC_FILES变量吗?

0 个答案:

没有答案