zoukankan      html  css  js  c++  java
  • 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)

  • 相关阅读:
    tomcat中配置https服务
    https无法下载
    将页面导成excel
    如何用sql语言只获得数据库当前日期,且格式为"yyyymmdd"?
    一个测试webservice服务的工具
    java中相对路径,绝对路径问题总结(转)
    Hadoop: I/O操作中的数据检查
    Java中Array.sort相关方法
    数据的I/O序列化操作
    Java中Comparable和Comparator实现对象比较
  • 原文地址:https://www.cnblogs.com/405845829qq/p/8818712.html
Copyright © 2011-2022 走看看