Change flow in STBI build script to ease development

* stb_image.h and AndroidNativeImageLoader.h are now placed in the source folder so that the IDE can access them
experimental
shadowislord 10 years ago
parent 17f130615a
commit ff55522f78
  1. 33
      jme3-android-native/stb_image.gradle

@ -22,10 +22,10 @@ task downloadStbImage(type: MyDownload) {
target = file(stbiFolder + File.separator + stbiDownloadTarget) target = file(stbiFolder + File.separator + stbiDownloadTarget)
} }
// Copy stb_image files to jni directory // Copy stb_image.h to the source directory.
task copyStbiFiles(type: Copy) { task copyStbiFiles(type: Copy) {
def sourceDir = file(stbiFolder) def sourceDir = file(stbiFolder)
def outputDir = file(stbiBuildJniDir) def outputDir = file(stbiJmeAndroidPath)
// println "copyStbiFiles sourceDir: " + sourceDir // println "copyStbiFiles sourceDir: " + sourceDir
// println "copyStbiFiles outputDir: " + outputDir // println "copyStbiFiles outputDir: " + outputDir
@ -42,20 +42,8 @@ copyStbiFiles.dependsOn {
} }
} }
task generateStbiHeaders(type: Exec) {
// Copy jME Android native files to jni directory String destDirPath = stbiJmeAndroidPath
task copyStbiJmeFiles(type: Copy, dependsOn:copyStbiFiles) {
def sourceDir = file(stbiJmeAndroidPath)
def outputDir = file(stbiBuildJniDir)
// println "copyStbiJmeFiles sourceDir: " + sourceDir
// println "copyStbiJmeFiles outputDir: " + outputDir
from sourceDir
into outputDir
}
task generateStbiHeaders(dependsOn: copyStbiJmeFiles) << {
String destDirPath = stbiBuildJniDir
String classes = "" String classes = ""
.concat("com.jme3.texture.plugins.AndroidNativeImageLoader, ") .concat("com.jme3.texture.plugins.AndroidNativeImageLoader, ")
@ -63,15 +51,24 @@ task generateStbiHeaders(dependsOn: copyStbiJmeFiles) << {
// println "stb_image destDir = " + destDir // println "stb_image destDir = " + destDir
// println "stb_image classpath = " + project.projectClassPath // println "stb_image classpath = " + project.projectClassPath
exec {
executable org.gradle.internal.jvm.Jvm.current().getExecutable('javah') executable org.gradle.internal.jvm.Jvm.current().getExecutable('javah')
args '-d', destDirPath args '-d', destDirPath
args '-classpath', project.projectClassPath args '-classpath', project.projectClassPath
args "com.jme3.texture.plugins.AndroidNativeImageLoader" args "com.jme3.texture.plugins.AndroidNativeImageLoader"
} }
// Copy jME Android native files to jni directory
task copyStbiJmeFiles(type: Copy, dependsOn:[copyStbiFiles, generateStbiHeaders]) {
def sourceDir = file(stbiJmeAndroidPath)
def outputDir = file(stbiBuildJniDir)
// println "copyStbiJmeFiles sourceDir: " + sourceDir
// println "copyStbiJmeFiles outputDir: " + outputDir
from sourceDir
into outputDir
} }
task buildStbiNativeLib(type: Exec, dependsOn: generateStbiHeaders) { task buildStbiNativeLib(type: Exec, dependsOn: copyStbiJmeFiles) {
// println "stb_image build dir: " + stbiBuildDir // println "stb_image build dir: " + stbiBuildDir
// println "ndkCommandPath: " + rootProject.ndkCommandPath // println "ndkCommandPath: " + rootProject.ndkCommandPath

Loading…
Cancel
Save