|
|
@ -11,10 +11,13 @@ String openALSoftZipFile = 'OpenALSoft.zip' |
|
|
|
// called "openal-soft" |
|
|
|
// called "openal-soft" |
|
|
|
String openALSoftFolder = 'openal-soft' |
|
|
|
String openALSoftFolder = 'openal-soft' |
|
|
|
|
|
|
|
|
|
|
|
//Working directory for the ndk build. |
|
|
|
//Working directories for the ndk build. |
|
|
|
//Must be the parent directory of the jni directory |
|
|
|
|
|
|
|
//Libs directory (output of ndk) will be created in this directory as well |
|
|
|
|
|
|
|
String openalsoftBuildDir = "${buildDir}" + File.separator + 'openalsoft' |
|
|
|
String openalsoftBuildDir = "${buildDir}" + File.separator + 'openalsoft' |
|
|
|
|
|
|
|
String openalsoftBuildJniDir = openalsoftBuildDir + File.separator + 'jni' |
|
|
|
|
|
|
|
String openalsoftBuildLibsDir = openalsoftBuildDir + File.separator + 'libs' |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//Pre-compiled libs directory |
|
|
|
|
|
|
|
String openalsoftPreCompiledLibsDir = 'libs' + File.separator + 'openalsoft' |
|
|
|
|
|
|
|
|
|
|
|
// jME Android Native source files path |
|
|
|
// jME Android Native source files path |
|
|
|
String openalsoftJmeAndroidPath = 'src/native/jme_openalsoft' |
|
|
|
String openalsoftJmeAndroidPath = 'src/native/jme_openalsoft' |
|
|
@ -46,7 +49,7 @@ unzipOpenALSoft.dependsOn { |
|
|
|
// Copy external source files to jni directory |
|
|
|
// Copy external source files to jni directory |
|
|
|
task copyOpenALSoft(type: Copy) { |
|
|
|
task copyOpenALSoft(type: Copy) { |
|
|
|
def sourceDir = file(openALSoftFolder) |
|
|
|
def sourceDir = file(openALSoftFolder) |
|
|
|
def outputDir = file(openalsoftBuildDir + File.separator + 'jni') |
|
|
|
def outputDir = file(openalsoftBuildJniDir) |
|
|
|
// println "copyOpenALSoft sourceDir: " + sourceDir |
|
|
|
// println "copyOpenALSoft sourceDir: " + sourceDir |
|
|
|
// println "copyOpenALSoft outputDir: " + outputDir |
|
|
|
// println "copyOpenALSoft outputDir: " + outputDir |
|
|
|
|
|
|
|
|
|
|
@ -65,19 +68,15 @@ copyOpenALSoft.dependsOn { |
|
|
|
// Copy jME Android native files to jni directory |
|
|
|
// Copy jME Android native files to jni directory |
|
|
|
task copyJmeOpenALSoft(type: Copy, dependsOn:copyOpenALSoft) { |
|
|
|
task copyJmeOpenALSoft(type: Copy, dependsOn:copyOpenALSoft) { |
|
|
|
def sourceDir = file(openalsoftJmeAndroidPath) |
|
|
|
def sourceDir = file(openalsoftJmeAndroidPath) |
|
|
|
def outputDir = file(openalsoftBuildDir + File.separator + 'jni') |
|
|
|
def outputDir = file(openalsoftBuildJniDir) |
|
|
|
// println "copyJmeOpenALSoft sourceDir: " + sourceDir |
|
|
|
// println "copyJmeOpenALSoft sourceDir: " + sourceDir |
|
|
|
// println "copyJmeOpenALSoft outputDir: " + outputDir |
|
|
|
// println "copyJmeOpenALSoft outputDir: " + outputDir |
|
|
|
|
|
|
|
|
|
|
|
from sourceDir |
|
|
|
from sourceDir |
|
|
|
into outputDir |
|
|
|
into outputDir |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
copyJmeOpenALSoft.doLast { |
|
|
|
jar.into("lib") { from openalsoftBuildDir + File.separator + 'libs' } |
|
|
|
String destDirPath = openalsoftBuildJniDir |
|
|
|
|
|
|
|
|
|
|
|
task generateOpenAlSoftHeaders(dependsOn:copyJmeOpenALSoft) { |
|
|
|
|
|
|
|
String destDir = openalsoftBuildDir + File.separator + 'jni' |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String classes = "" |
|
|
|
String classes = "" |
|
|
|
.concat("com.jme3.audio.android.AndroidOpenALSoftAudioRenderer, ") |
|
|
|
.concat("com.jme3.audio.android.AndroidOpenALSoftAudioRenderer, ") |
|
|
|
// println "openalsoft classes = " + classes |
|
|
|
// println "openalsoft classes = " + classes |
|
|
@ -86,13 +85,12 @@ task generateOpenAlSoftHeaders(dependsOn:copyJmeOpenALSoft) { |
|
|
|
|
|
|
|
|
|
|
|
ant.javah( |
|
|
|
ant.javah( |
|
|
|
classpath: project.projectClassPath, |
|
|
|
classpath: project.projectClassPath, |
|
|
|
destdir: destDir, |
|
|
|
destdir: destDirPath, |
|
|
|
class: classes |
|
|
|
class: classes |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
task buildOpenAlSoftNativeLib(type: Exec, dependsOn: generateOpenAlSoftHeaders) { |
|
|
|
task buildOpenAlSoftNativeLib(type: Exec, dependsOn: copyJmeOpenALSoft) { |
|
|
|
// println "openalsoft build dir: " + openalsoftBuildDir |
|
|
|
// println "openalsoft build dir: " + openalsoftBuildDir |
|
|
|
// println "ndkCommandPath: " + project.ndkCommandPath |
|
|
|
// println "ndkCommandPath: " + project.ndkCommandPath |
|
|
|
args 'TARGET_PLATFORM=android-9' |
|
|
|
args 'TARGET_PLATFORM=android-9' |
|
|
@ -100,13 +98,25 @@ task buildOpenAlSoftNativeLib(type: Exec, dependsOn: generateOpenAlSoftHeaders) |
|
|
|
executable project.ndkCommandPath |
|
|
|
executable project.ndkCommandPath |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
compileJava.dependsOn { |
|
|
|
// Copy pre-compiled libs to build directory (when not building new libs) |
|
|
|
// ndkPath is defined in the root project gradle.properties file |
|
|
|
task copyPreCompiledOpenAlSoftLibs(type: Copy) { |
|
|
|
if (ndkCommandPath != null && new File(ndkCommandPath).exists()) { |
|
|
|
def sourceDir = file(openalsoftPreCompiledLibsDir) |
|
|
|
buildOpenAlSoftNativeLib |
|
|
|
def outputDir = file(openalsoftBuildLibsDir) |
|
|
|
} |
|
|
|
// println "copyStbiJmeFiles sourceDir: " + sourceDir |
|
|
|
|
|
|
|
// println "copyStbiJmeFiles outputDir: " + outputDir |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
from sourceDir |
|
|
|
|
|
|
|
into outputDir |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (ndkExists()) { |
|
|
|
|
|
|
|
compileJava.dependsOn { buildOpenAlSoftNativeLib } |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
compileJava.dependsOn { copyPreCompiledOpenAlSoftLibs } |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
jar.into("lib") { from openalsoftBuildLibsDir } |
|
|
|
|
|
|
|
|
|
|
|
// Helper class to wrap ant dowload task |
|
|
|
// Helper class to wrap ant dowload task |
|
|
|
class MyDownload extends DefaultTask { |
|
|
|
class MyDownload extends DefaultTask { |
|
|
|
@Input |
|
|
|
@Input |
|
|
|