Browse Source

Detect LOVE submodule first before building.

Miku AuahDark 6 years ago
parent
commit
fa276ea4d8

+ 9 - 2
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)

+ 1 - 1
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:])

+ 14 - 0
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:])

+ 1 - 1
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:])