Răsfoiți Sursa

update android native build to support precompiled libs that are used if not building the libs. If building the libs, then the pre-compiled libs are updated with the output of the build.

iwgeric 11 ani în urmă
părinte
comite
57b77151aa

BIN
jme3-android-native/libs/openalsoft/armeabi-v7a/libopenalsoftjme.so


BIN
jme3-android-native/libs/openalsoft/armeabi/libopenalsoftjme.so


BIN
jme3-android-native/libs/openalsoft/mips/libopenalsoftjme.so


BIN
jme3-android-native/libs/openalsoft/x86/libopenalsoftjme.so


BIN
jme3-android-native/libs/stb_image/armeabi-v7a/libstbijme.so


BIN
jme3-android-native/libs/stb_image/armeabi/libstbijme.so


BIN
jme3-android-native/libs/stb_image/mips/libstbijme.so


BIN
jme3-android-native/libs/stb_image/x86/libstbijme.so


+ 17 - 3
jme3-android-native/openalsoft.gradle

@@ -75,7 +75,8 @@ task copyJmeOpenALSoft(type: Copy, dependsOn:copyOpenALSoft) {
     from sourceDir
     into outputDir
 }
-copyJmeOpenALSoft.doLast {
+
+task generateOpenAlSoftHeaders(dependsOn: copyJmeOpenALSoft) << {
     String destDirPath = openalsoftBuildJniDir
     String classes = ""
             .concat("com.jme3.audio.android.AndroidOpenALSoftAudioRenderer, ")
@@ -90,7 +91,7 @@ copyJmeOpenALSoft.doLast {
     )
 }
 
-task buildOpenAlSoftNativeLib(type: Exec, dependsOn: copyJmeOpenALSoft) {
+task buildOpenAlSoftNativeLib(type: Exec, dependsOn: generateOpenAlSoftHeaders) {
 //    println "openalsoft build dir: " + openalsoftBuildDir
 //    println "ndkCommandPath: " + project.ndkCommandPath
     args 'TARGET_PLATFORM=android-9'
@@ -98,6 +99,17 @@ task buildOpenAlSoftNativeLib(type: Exec, dependsOn: copyJmeOpenALSoft) {
     executable project.ndkCommandPath
 }
 
+task updatePreCompiledOpenAlSoftLibs(type: Copy, dependsOn: buildOpenAlSoftNativeLib) {
+    def sourceDir = new File(openalsoftBuildLibsDir)
+    def outputDir = new File(openalsoftPreCompiledLibsDir)
+//    println "updatePreCompiledOpenAlSoftLibs sourceDir: " + sourceDir
+//    println "updatePreCompiledOpenAlSoftLibs outputDir: " + outputDir
+
+    from sourceDir
+    into outputDir
+}
+
+
 // Copy pre-compiled libs to build directory (when not building new libs)
 task copyPreCompiledOpenAlSoftLibs(type: Copy) {
     def sourceDir = file(openalsoftPreCompiledLibsDir)
@@ -110,8 +122,10 @@ task copyPreCompiledOpenAlSoftLibs(type: Copy) {
 }
 
 if (ndkExists()) {
-    compileJava.dependsOn { buildOpenAlSoftNativeLib }
+    // build native libs and update stored pre-compiled libs to commit
+    compileJava.dependsOn { updatePreCompiledOpenAlSoftLibs }
 } else {
+    // use pre-compiled native libs (not building new ones)
     compileJava.dependsOn { copyPreCompiledOpenAlSoftLibs }
 }
 

+ 16 - 3
jme3-android-native/stb_image.gradle

@@ -53,7 +53,8 @@ task copyStbiJmeFiles(type: Copy, dependsOn:copyStbiFiles) {
     from sourceDir
     into outputDir
 }
-copyStbiJmeFiles.doLast {
+
+task generateStbiHeaders(dependsOn: copyStbiJmeFiles) << {
     String destDirPath = stbiBuildJniDir
     String classes = ""
             .concat("com.jme3.texture.plugins.AndroidNativeImageLoader, ")
@@ -70,7 +71,7 @@ copyStbiJmeFiles.doLast {
 
 }
 
-task buildStbiNativeLib(type: Exec, dependsOn: copyStbiJmeFiles) {
+task buildStbiNativeLib(type: Exec, dependsOn: generateStbiHeaders) {
 //    println "stb_image build dir: " + buildLibDir
 //    println "ndkCommandPath: " + project.ndkCommandPath
     args 'TARGET_PLATFORM=android-9'
@@ -78,6 +79,16 @@ task buildStbiNativeLib(type: Exec, dependsOn: copyStbiJmeFiles) {
     executable project.ndkCommandPath
 }
 
+task updatePreCompiledStbiLibs(type: Copy, dependsOn: buildStbiNativeLib) {
+    def sourceDir = new File(stbiBuildLibsDir)
+    def outputDir = new File(stbiPreCompiledLibsDir)
+//    println "updatePreCompiledStbiLibs sourceDir: " + sourceDir
+//    println "updatePreCompiledStbiLibs outputDir: " + outputDir
+
+    from sourceDir
+    into outputDir
+}
+
 // Copy pre-compiled libs to build directory (when not building new libs)
 task copyPreCompiledStbiLibs(type: Copy) {
     def sourceDir = file(stbiPreCompiledLibsDir)
@@ -90,8 +101,10 @@ task copyPreCompiledStbiLibs(type: Copy) {
 }
 
 if (ndkExists()) {
-    compileJava.dependsOn { buildStbiNativeLib }
+    // build native libs and update stored pre-compiled libs to commit
+    compileJava.dependsOn { updatePreCompiledStbiLibs }
 } else {
+    // use pre-compiled native libs (not building new ones)
     compileJava.dependsOn { copyPreCompiledStbiLibs }
 }