commit
a2ab6f183d
@ -1,132 +1,132 @@ |
|||||||
// OpenAL Soft r1.15.1 |
// OpenAL Soft r1.15.1 |
||||||
//String openALSoftUrl = 'http://repo.or.cz/w/openal-soft.git/snapshot/9b6a226da55a987cb883f425eeb568776ea12c8d.zip' |
//String openALSoftUrl = 'http://repo.or.cz/w/openal-soft.git/snapshot/9b6a226da55a987cb883f425eeb568776ea12c8d.zip' |
||||||
// OpenAL Soft r1.15.1 + Android OpenSL Support |
// OpenAL Soft r1.15.1 + Android OpenSL Support |
||||||
String openALSoftUrl = 'http://repo.or.cz/w/openal-soft.git/snapshot/be25e6802dacad78876c6fa1d6a5c63797b8a9ed.zip' |
String openALSoftUrl = 'http://repo.or.cz/w/openal-soft.git/snapshot/be25e6802dacad78876c6fa1d6a5c63797b8a9ed.zip' |
||||||
// OpenAL Soft r1.15.1 latest build (at the time) |
// OpenAL Soft r1.15.1 latest build (at the time) |
||||||
//String openALSoftUrl = 'http://repo.or.cz/w/openal-soft.git/snapshot/3f5914e0949ee12b504ee7254990e007ff8057ef.zip' |
//String openALSoftUrl = 'http://repo.or.cz/w/openal-soft.git/snapshot/3f5914e0949ee12b504ee7254990e007ff8057ef.zip' |
||||||
String openALSoftZipFile = 'OpenALSoft.zip' |
String openALSoftZipFile = 'OpenALSoft.zip' |
||||||
|
|
||||||
// OpenAL Soft directory the download is extracted into |
// OpenAL Soft directory the download is extracted into |
||||||
// Typically, the downloaded OpenAL Soft zip file will extract to a directory |
// Typically, the downloaded OpenAL Soft zip file will extract to a directory |
||||||
// called "openal-soft" |
// called "openal-soft" |
||||||
String openALSoftFolder = 'openal-soft' |
String openALSoftFolder = 'openal-soft' |
||||||
|
|
||||||
//Working directories for the ndk build. |
//Working directories for the ndk build. |
||||||
String openalsoftBuildDir = "${buildDir}" + File.separator + 'openalsoft' |
String openalsoftBuildDir = "${buildDir}" + File.separator + 'openalsoft' |
||||||
String openalsoftBuildJniDir = openalsoftBuildDir + File.separator + 'jni' |
String openalsoftBuildJniDir = openalsoftBuildDir + File.separator + 'jni' |
||||||
String openalsoftBuildLibsDir = openalsoftBuildDir + File.separator + 'libs' |
String openalsoftBuildLibsDir = openalsoftBuildDir + File.separator + 'libs' |
||||||
|
|
||||||
//Pre-compiled libs directory |
//Pre-compiled libs directory |
||||||
String openalsoftPreCompiledLibsDir = 'libs' + File.separator + 'openalsoft' |
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' |
||||||
|
|
||||||
// Download external source files if not available |
// Download external source files if not available |
||||||
task downloadOpenALSoft(type: MyDownload) { |
task downloadOpenALSoft(type: MyDownload) { |
||||||
sourceUrl = openALSoftUrl |
sourceUrl = openALSoftUrl |
||||||
target = file(openALSoftZipFile) |
target = file(openALSoftZipFile) |
||||||
} |
} |
||||||
|
|
||||||
// Unzip external source files |
// Unzip external source files |
||||||
task unzipOpenALSoft(type: Copy) { |
task unzipOpenALSoft(type: Copy) { |
||||||
def zipFile = file(openALSoftZipFile) |
def zipFile = file(openALSoftZipFile) |
||||||
def outputDir = file(".") |
def outputDir = file(".") |
||||||
|
|
||||||
from zipTree(zipFile) |
from zipTree(zipFile) |
||||||
into outputDir |
into outputDir |
||||||
} |
} |
||||||
unzipOpenALSoft.dependsOn { |
unzipOpenALSoft.dependsOn { |
||||||
def zipFilePath = project.projectDir.absolutePath + File.separator + openALSoftZipFile |
def zipFilePath = project.projectDir.absolutePath + File.separator + openALSoftZipFile |
||||||
def zipFile = new File(zipFilePath) |
def zipFile = new File(zipFilePath) |
||||||
// println "zipFile path: " + zipFile.absolutePath |
// println "zipFile path: " + zipFile.absolutePath |
||||||
// println "zipFile exists: " + zipFile.exists() |
// println "zipFile exists: " + zipFile.exists() |
||||||
if (!zipFile.exists()) { |
if (!zipFile.exists()) { |
||||||
downloadOpenALSoft |
downloadOpenALSoft |
||||||
} |
} |
||||||
} |
} |
||||||
|
|
||||||
// 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(openalsoftBuildJniDir) |
def outputDir = file(openalsoftBuildJniDir) |
||||||
// println "copyOpenALSoft sourceDir: " + sourceDir |
// println "copyOpenALSoft sourceDir: " + sourceDir |
||||||
// println "copyOpenALSoft outputDir: " + outputDir |
// println "copyOpenALSoft outputDir: " + outputDir |
||||||
|
|
||||||
from sourceDir |
from sourceDir |
||||||
into outputDir |
into outputDir |
||||||
} |
} |
||||||
copyOpenALSoft.dependsOn { |
copyOpenALSoft.dependsOn { |
||||||
def openALSoftUnzipDir = new File(project.projectDir.absolutePath + File.separator + openALSoftFolder) |
def openALSoftUnzipDir = new File(project.projectDir.absolutePath + File.separator + openALSoftFolder) |
||||||
// println "openALSoftUnzipDir path: " + openALSoftUnzipDir.absolutePath |
// println "openALSoftUnzipDir path: " + openALSoftUnzipDir.absolutePath |
||||||
// println "openALSoftUnzipDir exists: " + openALSoftUnzipDir.isDirectory() |
// println "openALSoftUnzipDir exists: " + openALSoftUnzipDir.isDirectory() |
||||||
if (!openALSoftUnzipDir.isDirectory()) { |
if (!openALSoftUnzipDir.isDirectory()) { |
||||||
unzipOpenALSoft |
unzipOpenALSoft |
||||||
} |
} |
||||||
} |
} |
||||||
|
|
||||||
// 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(openalsoftBuildJniDir) |
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 { |
copyJmeOpenALSoft.doLast { |
||||||
String destDirPath = openalsoftBuildJniDir |
String destDirPath = openalsoftBuildJniDir |
||||||
String classes = "" |
String classes = "" |
||||||
.concat("com.jme3.audio.android.AndroidOpenALSoftAudioRenderer, ") |
.concat("com.jme3.audio.android.AndroidOpenALSoftAudioRenderer, ") |
||||||
// println "openalsoft classes = " + classes |
// println "openalsoft classes = " + classes |
||||||
// println "openalsoft destDir = " + destDir |
// println "openalsoft destDir = " + destDir |
||||||
// println "openalsoft classpath = " + project.projectClassPath |
// println "openalsoft classpath = " + project.projectClassPath |
||||||
|
|
||||||
ant.javah( |
ant.javah( |
||||||
classpath: project.projectClassPath, |
classpath: project.projectClassPath, |
||||||
destdir: destDirPath, |
destdir: destDirPath, |
||||||
class: classes |
class: classes |
||||||
) |
) |
||||||
} |
} |
||||||
|
|
||||||
task buildOpenAlSoftNativeLib(type: Exec, dependsOn: copyJmeOpenALSoft) { |
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' |
||||||
workingDir openalsoftBuildDir |
workingDir openalsoftBuildDir |
||||||
executable project.ndkCommandPath |
executable project.ndkCommandPath |
||||||
} |
} |
||||||
|
|
||||||
// Copy pre-compiled libs to build directory (when not building new libs) |
// Copy pre-compiled libs to build directory (when not building new libs) |
||||||
task copyPreCompiledOpenAlSoftLibs(type: Copy) { |
task copyPreCompiledOpenAlSoftLibs(type: Copy) { |
||||||
def sourceDir = file(openalsoftPreCompiledLibsDir) |
def sourceDir = file(openalsoftPreCompiledLibsDir) |
||||||
def outputDir = file(openalsoftBuildLibsDir) |
def outputDir = file(openalsoftBuildLibsDir) |
||||||
// println "copyStbiJmeFiles sourceDir: " + sourceDir |
// println "copyStbiJmeFiles sourceDir: " + sourceDir |
||||||
// println "copyStbiJmeFiles outputDir: " + outputDir |
// println "copyStbiJmeFiles outputDir: " + outputDir |
||||||
|
|
||||||
from sourceDir |
from sourceDir |
||||||
into outputDir |
into outputDir |
||||||
} |
} |
||||||
|
|
||||||
if (ndkExists()) { |
if (ndkExists()) { |
||||||
compileJava.dependsOn { buildOpenAlSoftNativeLib } |
compileJava.dependsOn { buildOpenAlSoftNativeLib } |
||||||
} else { |
} else { |
||||||
compileJava.dependsOn { copyPreCompiledOpenAlSoftLibs } |
compileJava.dependsOn { copyPreCompiledOpenAlSoftLibs } |
||||||
} |
} |
||||||
|
|
||||||
jar.into("lib") { from openalsoftBuildLibsDir } |
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 |
||||||
String sourceUrl |
String sourceUrl |
||||||
|
|
||||||
@OutputFile |
@OutputFile |
||||||
File target |
File target |
||||||
|
|
||||||
@TaskAction |
@TaskAction |
||||||
void download() { |
void download() { |
||||||
ant.get(src: sourceUrl, dest: target) |
ant.get(src: sourceUrl, dest: target) |
||||||
} |
} |
||||||
} |
} |
||||||
|
@ -1,112 +1,112 @@ |
|||||||
// stb_image url for download |
// stb_image url for download |
||||||
String stbiUrl = 'http://www.nothings.org/stb_image.c' |
String stbiUrl = 'http://www.nothings.org/stb_image.c' |
||||||
String stbiDownloadTarget = 'stb_image.c' |
String stbiDownloadTarget = 'stb_image.c' |
||||||
|
|
||||||
// stb_image is not downloaded. The single source file is included in the repo |
// stb_image is not downloaded. The single source file is included in the repo |
||||||
String stbiFolder = 'stb_image' |
String stbiFolder = 'stb_image' |
||||||
|
|
||||||
//Working directories for the ndk build. |
//Working directories for the ndk build. |
||||||
String stbiBuildDir = "${buildDir}" + File.separator + 'stb_image' |
String stbiBuildDir = "${buildDir}" + File.separator + 'stb_image' |
||||||
String stbiBuildJniDir = stbiBuildDir + File.separator + 'jni' |
String stbiBuildJniDir = stbiBuildDir + File.separator + 'jni' |
||||||
String stbiBuildLibsDir = stbiBuildDir + File.separator + 'libs' |
String stbiBuildLibsDir = stbiBuildDir + File.separator + 'libs' |
||||||
|
|
||||||
//Pre-compiled libs directory |
//Pre-compiled libs directory |
||||||
String stbiPreCompiledLibsDir = 'libs' + File.separator + 'stb_image' |
String stbiPreCompiledLibsDir = 'libs' + File.separator + 'stb_image' |
||||||
|
|
||||||
// jME Android Native source files path |
// jME Android Native source files path |
||||||
String stbiJmeAndroidPath = 'src/native/jme_stbi' |
String stbiJmeAndroidPath = 'src/native/jme_stbi' |
||||||
|
|
||||||
// Download external source files if not available |
// Download external source files if not available |
||||||
task downloadStbImage(type: MyDownload) { |
task downloadStbImage(type: MyDownload) { |
||||||
sourceUrl = stbiUrl |
sourceUrl = stbiUrl |
||||||
target = file(stbiFolder + File.separator + stbiDownloadTarget) |
target = file(stbiFolder + File.separator + stbiDownloadTarget) |
||||||
} |
} |
||||||
|
|
||||||
// Copy stb_image files to jni directory |
// Copy stb_image files to jni directory |
||||||
task copyStbiFiles(type: Copy) { |
task copyStbiFiles(type: Copy) { |
||||||
def sourceDir = file(stbiFolder) |
def sourceDir = file(stbiFolder) |
||||||
def outputDir = file(stbiBuildJniDir) |
def outputDir = file(stbiBuildJniDir) |
||||||
// println "copyStbiFiles sourceDir: " + sourceDir |
// println "copyStbiFiles sourceDir: " + sourceDir |
||||||
// println "copyStbiFiles outputDir: " + outputDir |
// println "copyStbiFiles outputDir: " + outputDir |
||||||
|
|
||||||
from sourceDir |
from sourceDir |
||||||
into outputDir |
into outputDir |
||||||
} |
} |
||||||
copyStbiFiles.dependsOn { |
copyStbiFiles.dependsOn { |
||||||
def stbiFilePath = project.projectDir.absolutePath + stbiFolder + File.separator + stbiDownloadTarget |
def stbiFilePath = project.projectDir.absolutePath + stbiFolder + File.separator + stbiDownloadTarget |
||||||
def stbiFile = new File(stbiFilePath) |
def stbiFile = new File(stbiFilePath) |
||||||
// println "zipFile path: " + zipFile.absolutePath |
// println "zipFile path: " + zipFile.absolutePath |
||||||
// println "zipFile exists: " + zipFile.exists() |
// println "zipFile exists: " + zipFile.exists() |
||||||
if (!stbiFile.exists()) { |
if (!stbiFile.exists()) { |
||||||
downloadStbImage |
downloadStbImage |
||||||
} |
} |
||||||
} |
} |
||||||
|
|
||||||
|
|
||||||
// Copy jME Android native files to jni directory |
// Copy jME Android native files to jni directory |
||||||
task copyStbiJmeFiles(type: Copy, dependsOn:copyStbiFiles) { |
task copyStbiJmeFiles(type: Copy, dependsOn:copyStbiFiles) { |
||||||
def sourceDir = file(stbiJmeAndroidPath) |
def sourceDir = file(stbiJmeAndroidPath) |
||||||
def outputDir = file(stbiBuildJniDir) |
def outputDir = file(stbiBuildJniDir) |
||||||
// println "copyStbiJmeFiles sourceDir: " + sourceDir |
// println "copyStbiJmeFiles sourceDir: " + sourceDir |
||||||
// println "copyStbiJmeFiles outputDir: " + outputDir |
// println "copyStbiJmeFiles outputDir: " + outputDir |
||||||
|
|
||||||
from sourceDir |
from sourceDir |
||||||
into outputDir |
into outputDir |
||||||
} |
} |
||||||
copyStbiJmeFiles.doLast { |
copyStbiJmeFiles.doLast { |
||||||
String destDirPath = stbiBuildJniDir |
String destDirPath = stbiBuildJniDir |
||||||
String classes = "" |
String classes = "" |
||||||
.concat("com.jme3.texture.plugins.AndroidNativeImageLoader, ") |
.concat("com.jme3.texture.plugins.AndroidNativeImageLoader, ") |
||||||
|
|
||||||
// println "stb_image classes = " + classes |
// println "stb_image classes = " + classes |
||||||
// println "stb_image destDir = " + destDir |
// println "stb_image destDir = " + destDir |
||||||
// println "stb_image classpath = " + project.projectClassPath |
// println "stb_image classpath = " + project.projectClassPath |
||||||
|
|
||||||
ant.javah( |
ant.javah( |
||||||
classpath: project.projectClassPath, |
classpath: project.projectClassPath, |
||||||
destdir: destDirPath, |
destdir: destDirPath, |
||||||
class: classes |
class: classes |
||||||
) |
) |
||||||
|
|
||||||
} |
} |
||||||
|
|
||||||
task buildStbiNativeLib(type: Exec, dependsOn: copyStbiJmeFiles) { |
task buildStbiNativeLib(type: Exec, dependsOn: copyStbiJmeFiles) { |
||||||
// println "stb_image build dir: " + buildLibDir |
// println "stb_image build dir: " + buildLibDir |
||||||
// println "ndkCommandPath: " + project.ndkCommandPath |
// println "ndkCommandPath: " + project.ndkCommandPath |
||||||
args 'TARGET_PLATFORM=android-9' |
args 'TARGET_PLATFORM=android-9' |
||||||
workingDir stbiBuildDir |
workingDir stbiBuildDir |
||||||
executable project.ndkCommandPath |
executable project.ndkCommandPath |
||||||
} |
} |
||||||
|
|
||||||
// Copy pre-compiled libs to build directory (when not building new libs) |
// Copy pre-compiled libs to build directory (when not building new libs) |
||||||
task copyPreCompiledStbiLibs(type: Copy) { |
task copyPreCompiledStbiLibs(type: Copy) { |
||||||
def sourceDir = file(stbiPreCompiledLibsDir) |
def sourceDir = file(stbiPreCompiledLibsDir) |
||||||
def outputDir = file(stbiBuildLibsDir) |
def outputDir = file(stbiBuildLibsDir) |
||||||
// println "copyStbiJmeFiles sourceDir: " + sourceDir |
// println "copyStbiJmeFiles sourceDir: " + sourceDir |
||||||
// println "copyStbiJmeFiles outputDir: " + outputDir |
// println "copyStbiJmeFiles outputDir: " + outputDir |
||||||
|
|
||||||
from sourceDir |
from sourceDir |
||||||
into outputDir |
into outputDir |
||||||
} |
} |
||||||
|
|
||||||
if (ndkExists()) { |
if (ndkExists()) { |
||||||
compileJava.dependsOn { buildStbiNativeLib } |
compileJava.dependsOn { buildStbiNativeLib } |
||||||
} else { |
} else { |
||||||
compileJava.dependsOn { copyPreCompiledStbiLibs } |
compileJava.dependsOn { copyPreCompiledStbiLibs } |
||||||
} |
} |
||||||
|
|
||||||
jar.into("lib") { from stbiBuildLibsDir } |
jar.into("lib") { from stbiBuildLibsDir } |
||||||
|
|
||||||
// Helper class to wrap ant dowload task |
// Helper class to wrap ant dowload task |
||||||
class MyDownload extends DefaultTask { |
class MyDownload extends DefaultTask { |
||||||
@Input |
@Input |
||||||
String sourceUrl |
String sourceUrl |
||||||
|
|
||||||
@OutputFile |
@OutputFile |
||||||
File target |
File target |
||||||
|
|
||||||
@TaskAction |
@TaskAction |
||||||
void download() { |
void download() { |
||||||
ant.get(src: sourceUrl, dest: target) |
ant.get(src: sourceUrl, dest: target) |
||||||
} |
} |
||||||
} |
} |
||||||
|
Loading…
Reference in new issue