Add support for downloading and building OpenAL Soft for native Android audio
git-svn-id: https://jmonkeyengine.googlecode.com/svn/branches/gradle-restructure@10988 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
This commit is contained in:
parent
71938ff80d
commit
5b2a661f56
@ -9,6 +9,32 @@
|
|||||||
// Note however, that you may define your own "run" and "debug" task if you
|
// Note however, that you may define your own "run" and "debug" task if you
|
||||||
// prefer. In this case NetBeans will not add these tasks but you may rely on
|
// prefer. In this case NetBeans will not add these tasks but you may rely on
|
||||||
// your own implementation.
|
// your own implementation.
|
||||||
|
// // OpenAL Soft r1.15.1
|
||||||
|
//String openALSoftUrl = 'http://repo.or.cz/w/openal-soft.git/snapshot/9b6a226da55a987cb883f425eeb568776ea12c8d.zip'
|
||||||
|
// OpenAL Soft r1.15.1 + Android OpenSL Support
|
||||||
|
String openALSoftUrl = 'http://repo.or.cz/w/openal-soft.git/snapshot/be25e6802dacad78876c6fa1d6a5c63797b8a9ed.zip'
|
||||||
|
// OpenAL Soft r1.15.1 latest build (at the time)
|
||||||
|
//String openALSoftUrl = 'http://repo.or.cz/w/openal-soft.git/snapshot/3f5914e0949ee12b504ee7254990e007ff8057ef.zip'
|
||||||
|
|
||||||
|
// OpenAL Soft directory the download is extracted into
|
||||||
|
// Typically, the downloaded OpenAL Soft zip file will extract to a directory
|
||||||
|
// called "openal-soft"
|
||||||
|
String openALSoftFolder = 'openal-soft'
|
||||||
|
|
||||||
|
//Working directory 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 ndkWorkingPath = 'src/native'
|
||||||
|
|
||||||
|
// jni folder path to build from
|
||||||
|
String jniPath = ndkWorkingPath + '/jni'
|
||||||
|
|
||||||
|
//Output directory of the NDK (do not change)
|
||||||
|
String ndkOutputPath = ndkWorkingPath + '/libs'
|
||||||
|
|
||||||
|
// jME Android Native source files path
|
||||||
|
String jMEAndroidPath = 'src/native/android'
|
||||||
|
|
||||||
if (!hasProperty('mainClass')) {
|
if (!hasProperty('mainClass')) {
|
||||||
ext.mainClass = ''
|
ext.mainClass = ''
|
||||||
}
|
}
|
||||||
@ -16,7 +42,7 @@ if (!hasProperty('mainClass')) {
|
|||||||
sourceSets {
|
sourceSets {
|
||||||
main {
|
main {
|
||||||
java {
|
java {
|
||||||
srcDir 'src/native/android'
|
srcDir jMEAndroidPath
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -29,4 +55,80 @@ dependencies {
|
|||||||
//
|
//
|
||||||
// You can read more about how to add dependency here:
|
// You can read more about how to add dependency here:
|
||||||
// http://www.gradle.org/docs/current/userguide/dependency_management.html#sec:how_to_declare_your_dependencies
|
// http://www.gradle.org/docs/current/userguide/dependency_management.html#sec:how_to_declare_your_dependencies
|
||||||
|
compile project(':jme3-android')
|
||||||
|
}
|
||||||
|
|
||||||
|
// Download bullet if not available
|
||||||
|
task downloadOpenALSoft(type: MyDownload) {
|
||||||
|
sourceUrl = openALSoftUrl
|
||||||
|
target = file('OpenALSoft.zip')
|
||||||
|
}
|
||||||
|
|
||||||
|
// Unzip OpenALSoft
|
||||||
|
task unzipOpenALSoft(type: Copy, dependsOn:downloadOpenALSoft) {
|
||||||
|
def zipFile = file('OpenALSoft.zip')
|
||||||
|
def outputDir = file(".")
|
||||||
|
|
||||||
|
from zipTree(zipFile)
|
||||||
|
into outputDir
|
||||||
|
}
|
||||||
|
|
||||||
|
// Copy OpenALSoft files to jni directory
|
||||||
|
task copyOpenALSoft(type: Copy, dependsOn:unzipOpenALSoft) {
|
||||||
|
def sourceDir = file(openALSoftFolder)
|
||||||
|
def outputDir = file(jniPath)
|
||||||
|
|
||||||
|
from sourceDir
|
||||||
|
into outputDir
|
||||||
|
}
|
||||||
|
|
||||||
|
// Copy jME Android native files to jni directory
|
||||||
|
task copyJmeOpenALSoft(type: Copy, dependsOn:copyOpenALSoft) {
|
||||||
|
def sourceDir = file(jMEAndroidPath)
|
||||||
|
def outputDir = file(jniPath)
|
||||||
|
|
||||||
|
from sourceDir
|
||||||
|
into outputDir
|
||||||
|
}
|
||||||
|
|
||||||
|
task buildNative(type: Exec, dependsOn:copyJmeOpenALSoft) {
|
||||||
|
String ndkBuildFile = "ndk-build"
|
||||||
|
// if windows, use ndk-build.cmd instead
|
||||||
|
if (System.properties['os.name'].toLowerCase().contains('windows')) {
|
||||||
|
ndkBuildFile = "ndk-build.cmd"
|
||||||
|
}
|
||||||
|
|
||||||
|
String ndkBuildPath = ndkPath + File.separator + ndkBuildFile
|
||||||
|
//Use the environment variable for the NDK location if defined
|
||||||
|
if (System.env.ANDROID_NDK != null) {
|
||||||
|
ndkBuildPath = System.env.ANDROID_NDK + File.separator + ndkBuildFile
|
||||||
|
}
|
||||||
|
|
||||||
|
// need to target android-9 so the ndk can pull in the opensl library
|
||||||
|
args 'TARGET_PLATFORM=android-9'
|
||||||
|
workingDir ndkWorkingPath
|
||||||
|
executable ndkBuildPath
|
||||||
|
}
|
||||||
|
|
||||||
|
jar.into("lib") { from ndkOutputPath }
|
||||||
|
|
||||||
|
compileJava.dependsOn {
|
||||||
|
def ndkFile = new File(ndkPath)
|
||||||
|
if (ndkFile.exists()) {
|
||||||
|
buildNative
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Helper class to wrap ant dowload task
|
||||||
|
class MyDownload extends DefaultTask {
|
||||||
|
@Input
|
||||||
|
String sourceUrl
|
||||||
|
|
||||||
|
@OutputFile
|
||||||
|
File target
|
||||||
|
|
||||||
|
@TaskAction
|
||||||
|
void download() {
|
||||||
|
ant.get(src: sourceUrl, dest: target)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Binary file not shown.
BIN
jme3-android-native/src/native/libs/armeabi/libopenalsoftjme.so
Normal file
BIN
jme3-android-native/src/native/libs/armeabi/libopenalsoftjme.so
Normal file
Binary file not shown.
BIN
jme3-android-native/src/native/libs/mips/libopenalsoftjme.so
Normal file
BIN
jme3-android-native/src/native/libs/mips/libopenalsoftjme.so
Normal file
Binary file not shown.
BIN
jme3-android-native/src/native/libs/x86/libopenalsoftjme.so
Normal file
BIN
jme3-android-native/src/native/libs/x86/libopenalsoftjme.so
Normal file
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user