From 1ef4ac48a0325c44dd407d358a4df7748c698d0f Mon Sep 17 00:00:00 2001 From: "rf.wu" Date: Fri, 11 Oct 2019 17:26:24 +0800 Subject: [PATCH] Add Android NDK complie supported. Usage: ./ndk_make.sh [clean] --- .gitignore | 3 +++ Android.mk | 14 ++++++++++++++ Application.mk | 6 ++++++ ndk_make.sh | 15 +++++++++++++++ 4 files changed, 38 insertions(+) create mode 100644 Android.mk create mode 100644 Application.mk create mode 100755 ndk_make.sh diff --git a/.gitignore b/.gitignore index 2f9d10f..25c762d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,6 @@ build/ /tags /bazel-* + +libs/ +obj/ diff --git a/Android.mk b/Android.mk new file mode 100644 index 0000000..0ff49a6 --- /dev/null +++ b/Android.mk @@ -0,0 +1,14 @@ +LOCAL_PATH := $(call my-dir) +# -------------------------------------- +include $(CLEAR_VARS) + +LOCAL_SRC_FILES := $(wildcard $(LOCAL_PATH)/src/*.cpp) + +LOCAL_C_INCLUDES += src/ +LOCAL_C_INCLUDES += include/ + +LOCAL_LDLIBS := -llog + +LOCAL_MODULE := yamlcpp +include $(BUILD_SHARED_LIBRARY) + diff --git a/Application.mk b/Application.mk new file mode 100644 index 0000000..12f0228 --- /dev/null +++ b/Application.mk @@ -0,0 +1,6 @@ +APP_ABI := arm64-v8a x86_64 +APP_PLATFORM := android-26 +APP_STL := c++_shared +APP_CPPFLAGS := -fexceptions +APP_CPPFLAGS += -frtti +#APP_ALLOW_MISSING_DEPS = true diff --git a/ndk_make.sh b/ndk_make.sh new file mode 100755 index 0000000..d5cbe3f --- /dev/null +++ b/ndk_make.sh @@ -0,0 +1,15 @@ +#!/bin/bash +if [ $# -gt 1 ];then + echo "[Usage]: $0 or $0 clean." + exit +elif [ $# -eq 0 ];then + ndk-build NDK_PROJECT_PATH=. APP_BUILD_SCRIPT=Android.mk NDK_APPLICATION_MK=Application.mk +elif [ $# -eq 1 ];then + if [ "$1" = "clean" ];then + ndk-build NDK_PROJECT_PATH=. APP_BUILD_SCRIPT=Android.mk NDK_APPLICATION_MK=Application.mk clean + exit + else + echo "[Usage]: $0 or $0 clean." + exit + fi +fi