• android NDK 使用(多个)静态库生成动态库


    android NDK 使用(多个)静态库生成动态库。

    1、编写Android.mk文件:如下两种方式都可以,用于NDK编译工具生成的两个.a文件来生成最终的libtwolib-second.so动态库。

    LOCAL_PATH:=$(callmy-dir)

    include$(CLEAR_VARS)

    LOCAL_MODULE:=libtwolib-second

    LOCAL_SRC_FILES:=second.c

    LOCAL_LDFLAGS:=first.athird.a

    LOCAL_LDLIBS:=-L$(SYSROOT)/usr/lib-llog

    include$(BUILD_SHARED_LIBRARY)

    方式二:

    LOCAL_PATH:=$(callmy-dir)

    include$(CLEAR_VARS)

    LOCAL_MODULE:=libtwolib-first

    LOCAL_SRC_FILES:=first.a

    include$(PREBUILT_STATIC_LIBRARY)

    include$(CLEAR_VARS)

    LOCAL_MODULE:=libtwolib-third

    LOCAL_SRC_FILES:=third.a

    include$(PREBUILT_STATIC_LIBRARY)

    include$(CLEAR_VARS)

    LOCAL_MODULE:=libtwolib-second

    LOCAL_SRC_FILES:=second.c

    LOCAL_STATIC_LIBRARIES:=libtwolib-firstlibtwolib-third

    LOCAL_LDLIBS:=-L$(SYSROOT)/usr/lib-llog

    include$(BUILD_SHARED_LIBRARY)

    2、生成动态库

    # Android.mk for FFmpeg

    # Lei Xiaohua à×???è

    # leixiaohua1020@126.com

    # https://blog.csdn.net/leixiaohua1020

    #

    LOCAL_PATH := $(call my-dir)

    # FFmpeg library

    include $(CLEAR_VARS)

    LOCAL_MODULE := avcodec

    LOCAL_SRC_FILES := libavcodec-57.so

    include $(PREBUILT_SHARED_LIBRARY)

    include $(CLEAR_VARS)

    LOCAL_MODULE := avdevice

    LOCAL_SRC_FILES := libavdevice-57.so

    include $(PREBUILT_SHARED_LIBRARY)

    include $(CLEAR_VARS)

    LOCAL_MODULE := avfilter

    LOCAL_SRC_FILES := libavfilter-6.so

    include $(PREBUILT_SHARED_LIBRARY)

    include $(CLEAR_VARS)

    LOCAL_MODULE := avformat

    LOCAL_SRC_FILES := libavformat-57.so

    include $(PREBUILT_SHARED_LIBRARY)

    include $(CLEAR_VARS)

    LOCAL_MODULE := avresample

    LOCAL_SRC_FILES := libavresample-3.so

    include $(PREBUILT_SHARED_LIBRARY)

    include $(CLEAR_VARS)

    LOCAL_MODULE := avutil

    LOCAL_SRC_FILES := libavutil-55.so

    include $(PREBUILT_SHARED_LIBRARY)

    include $(CLEAR_VARS)

    LOCAL_MODULE := swresample

    LOCAL_SRC_FILES := libswresample-2.so

    include $(PREBUILT_SHARED_LIBRARY)

    include $(CLEAR_VARS)

    LOCAL_MODULE := swscale

    LOCAL_SRC_FILES := libswscale-4.so

    include $(PREBUILT_SHARED_LIBRARY)

    # Program

    include $(CLEAR_VARS)

    LOCAL_MODULE := sffstreamer

    LOCAL_SRC_FILES :=simplest_ffmpeg_streamer.c

    LOCAL_C_INCLUDES += $(LOCAL_PATH)/include

    LOCAL_LDLIBS := -llog -lz

    LOCAL_SHARED_LIBRARIES := avcodec avdevice avfilter avformat avutil avresample swresample swscale

    include $(BUILD_SHARED_LIBRARY)

    附:

    可以直接编写Android.mk文件来生成两个.a文件,如下:

    LOCAL_PATH:=$(callmy-dir)

    include$(CLEAR_VARS)

    LOCAL_MODULE:=libtwolib-first

    LOCAL_SRC_FILES:=first.c

    include$(BUILD_STATIC_LIBRARY)

    include$(CLEAR_VARS)

    LOCAL_MODULE:=libtwolib-third

    LOCAL_SRC_FILES:=third.c

    include$(BUILD_STATIC_LIBRARY)

    include$(CLEAR_VARS)

    LOCAL_MODULE:=libtwolib-second

    LOCAL_SRC_FILES:=second.c

    LOCAL_STATIC_LIBRARIES:=libtwolib-firstlibtwolib-third

    LOCAL_LDLIBS:=-L$(SYSROOT)/usr/lib-llog

    include$(BUILD_SHARED_LIBRARY)

  • 相关阅读:
    QLPreviewController来预览文件
    Camera360SDK
    实现 JSON + Jquery+.Net ajax功能
    showModalDialog传值
    web方式AJAX调用
    CRM4.0多个实体关联查询
    用javascript 动态添加部门和人员
    GridView中使用超连接
    根据订单号查询出订单附属实体
    sql 常用聚合函数
  • 原文地址:https://www.cnblogs.com/405845829qq/p/8818712.html
Copyright © 2020-2023  润新知