From fa276ea4d8e3c8dcbd3c07023d1eb5b594cc7d7d Mon Sep 17 00:00:00 2001 From: Miku AuahDark Date: Sun, 24 Nov 2019 17:36:32 +0800 Subject: [PATCH] Detect LOVE submodule first before building. --- love/src/jni/Android.mk | 11 +++++++++-- love/src/jni/detect_androidapi.py | 2 +- love/src/jni/detect_love.py | 14 ++++++++++++++ love/src/jni/detect_ndkrel.py | 2 +- 4 files changed, 25 insertions(+), 4 deletions(-) create mode 100644 love/src/jni/detect_love.py diff --git a/love/src/jni/Android.mk b/love/src/jni/Android.mk index 065d1b86..1163c25b 100644 --- a/love/src/jni/Android.mk +++ b/love/src/jni/Android.mk @@ -1,3 +1,10 @@ -IS_NDK_R17 := $(shell python $(call my-dir)/detect_ndkrel.py $(NDK_ROOT)/source.properties 17) -IS_ANDROID_21 := $(shell python $(call my-dir)/detect_androidapi.py $(TARGET_PLATFORM) 21) +LOVE_JNI_DIR := $(call my-dir) +IS_NDK_R17 := $(shell python ${LOVE_JNI_DIR}/detect_ndkrel.py $(NDK_ROOT)/source.properties 17) +IS_ANDROID_21 := $(shell python ${LOVE_JNI_DIR}/detect_androidapi.py $(TARGET_PLATFORM) 21) +HAS_LOVE := $(shell python ${LOVE_JNI_DIR}/detect_love.py ${LOVE_JNI_DIR}) + +ifneq (${HAS_LOVE},yes) + $(error Missing LOVE. Make sure to initialize the submodule correctly!) +endif + include $(call all-subdir-makefiles) diff --git a/love/src/jni/detect_androidapi.py b/love/src/jni/detect_androidapi.py index dfd18cfb..80c06890 100644 --- a/love/src/jni/detect_androidapi.py +++ b/love/src/jni/detect_androidapi.py @@ -14,4 +14,4 @@ def main(argv): print("unknown") if __name__ == "__main__": - main(sys.argv[1:]) + main(sys.argv[1:]) diff --git a/love/src/jni/detect_love.py b/love/src/jni/detect_love.py new file mode 100644 index 00000000..8fc93dc9 --- /dev/null +++ b/love/src/jni/detect_love.py @@ -0,0 +1,14 @@ +import sys +from os import path + +def main(argv): + if len(argv) > 0: + if path.isdir(argv[0] + "/love") and path.isfile(argv[0] + "/love/Android.mk"): + print("yes") + else: + print("no") + else: + print("no") + +if __name__ == "__main__": + main(sys.argv[1:]) diff --git a/love/src/jni/detect_ndkrel.py b/love/src/jni/detect_ndkrel.py index 55c66360..df96a312 100644 --- a/love/src/jni/detect_ndkrel.py +++ b/love/src/jni/detect_ndkrel.py @@ -17,4 +17,4 @@ def main(argv): print("unknown") if __name__ == "__main__": - main(sys.argv[1:]) + main(sys.argv[1:])