android NDK .mk Template

android.mk

LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
#//////////////////////////////////////////////////////////////////////////////////////////////
LOCAL_MODULE := libxls
#//////////////////////////////////////////////////////////////////////////////////////////////
#//////////////////////////////////////////////////////////////////////////////////////////////
#工作包含目录

LOCAL_C_INCLUDES += $(LOCAL_PATH)/src
$(warning 工作目录 $(LOCAL_PATH) 包含目录 $(LOCAL_C_INCLUDES))
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_C_INCLUDES)




FILE_LIST += $(wildcard $(LOCAL_PATH)/src/*.c)
$(warning FILE_LIST =============>  $(FILE_LIST))



LOCAL_CFLAGS += -DGL_GLEXT_PROTOTYPES
LOCAL_CFLAGS += \
    -Wall -Wextra \
    -Wdocumentation \
    -Wdocumentation-unknown-command \
    -Wmissing-prototypes \
    -Wunreachable-code-break \
    -Wunneeded-internal-declaration \
    -Wmissing-variable-declarations \
    -Wfloat-conversion \
    -Wshorten-64-to-32 \
    -Wunreachable-code-return \
    -x c++\
# Warnings we haven't fixed (yet)
LOCAL_CFLAGS += -Wno-unused-parameter -Wno-sign-compare

#开启模块的 C++ 异常控制编译支持都会被打开
LOCAL_CPP_FEATURES += exceptions


#添加跨平台源文件
LOCAL_SRC_FILES := $(FILE_LIST)\
        

LOCAL_LDLIBS += -L$(SYSROOT)/usr/lib -llog
#依赖添加
LOCAL_LDLIBS += -ldl -lGLESv1_CM -lGLESv2 -lOpenSLES -llog -landroid










#编译生成动态库
include $(BUILD_SHARED_LIBRARY)






#编译生成静态库
#include $(BUILD_STATIC_LIBRARY)

application.mk

APP_PLATFORM := android-18


#APP_ABI := all
APP_ABI := armeabi-v7a

APP_STL := c++_static

APP_CPPFLAGS := -frtti -DCC_ENABLE_CHIPMUNK_INTEGRATION=1 -std=c++11 -fsigned-char -Wno-extern-c-compat

#所有模块的 C++ 异常控制编译支持都会被打开
APP_CPPFLAGS += -fexceptions

APP_LDFLAGS := -latomic

APP_SHORT_COMMANDS := true


#ifeq ($(NDK_DEBUG),1)
#  APP_CPPFLAGS += -DCOCOS2D_DEBUG=1
#  APP_OPTIM := debug
#else
#  APP_CPPFLAGS += -DNDEBUG
#  APP_OPTIM := release
#endif

 ndk-builds.cmd

ndk-build NDK_PROJECT_PATH=. APP_BUILD_SCRIPT=./Android.mk NDK_APPLICATION_MK=./Application.mk

 

posted @ 2020-02-17 23:56  YZFHKMS-X  阅读(282)  评论(0编辑  收藏  举报