Initial modular 3rd-party C libs system.

This commit is contained in:
Miku AuahDark
2021-11-01 17:50:36 +08:00
parent b3d9ceb314
commit 383fe4aec6
3 changed files with 44 additions and 0 deletions
+35
View File
@@ -28,6 +28,40 @@ android {
}
targetSdkVersion 30
}
def retrieveAll3pModules = { ->
def modules = []
fileTree("src/jni/lua-modules").visit { FileVisitDetails details ->
if (details.isDirectory()) {
if (file(details.file.path + "/Android.mk").exists()) {
logger.lifecycle("3rd-party module: " + details.file.path)
def javainfo = file(details.file.path + "/java.txt")
if (javainfo.exists()) {
def fstream = new FileInputStream(javainfo)
def infile = new BufferedReader(new InputStreamReader(fstream))
def javapath = infile.readLine().replace("\\", "/")
def mpath = null
if (javapath[0] != '/') {
mpath = details.file.path + "/" + javapath
} else {
mpath = details.file.path + javapath
}
modules << mpath
logger.lifecycle("Registered path " + mpath)
infile.close()
}
}
}
}
return modules
}
buildTypes {
release {
minifyEnabled true
@@ -57,6 +91,7 @@ android {
java {
srcDir 'src/jni/SDL2/android-project/app/src/main/java'
srcDir 'src/main/java'
srcDirs += retrieveAll3pModules()
}
}
playstore {
+1
View File
@@ -0,0 +1 @@
include $(call all-subdir-makefiles)
@@ -0,0 +1,8 @@
This folder should contain external Lua C modules that will be shipped along with LOVE. One for each folder
Each folder must contains:
* Android.mk describing how to build the external Lua C module.
The LOCAL_MODULE_FILENAME must be set accordingly as ndk-build appends "lib" prefix from LOCAL_MODULE by default.
* If your module interacts with Java-side, a file java.txt must contain where it should look Java source files.
Example, if you have src/java/your/package/name/MyFile.java, then you need to write "src/java" in java.txt.
If this file is absent, then your Java-side code will not be compiled along.