SDK: Add build support for Android implementation of OpenAL Soft

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@10610 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
iwg..om 12 years ago
parent 785d50f516
commit c1402b30e9
  1. 4
      engine/build.xml
  2. 19
      engine/nbproject/build-impl.xml
  3. 105
      engine/nbproject/build-openal-soft-natives.xml
  4. 2
      engine/nbproject/configs/Native_OpenAL_Soft.properties
  5. 23
      engine/nbproject/openal-soft-native.properties
  6. 1
      engine/nbproject/project.properties
  7. 1
      engine/nbproject/project.xml

@ -19,6 +19,10 @@
</exec> </exec>
</target> </target>
<target name="build-openal-soft-natives" description="uses native build tools to build the openalsoftjme shared library for Android" depends="jar">
<ant antfile="nbproject/build-openal-soft-natives.xml" target="build-openal-soft-natives"/>
</target>
<target name="-do-compile" description="Overrides default compile target to separate the build into folders" depends="init,deps-jar,-pre-pre-compile,-pre-compile, -copy-persistence-xml,-compile-depend" if="have.sources"> <target name="-do-compile" description="Overrides default compile target to separate the build into folders" depends="init,deps-jar,-pre-pre-compile,-pre-compile, -copy-persistence-xml,-compile-depend" if="have.sources">
<mkdir dir="${build.dir}/core"/> <mkdir dir="${build.dir}/core"/>
<mkdir dir="${build.dir}/effects"/> <mkdir dir="${build.dir}/effects"/>

@ -187,6 +187,7 @@ is divided into following sections:
<available file="${src.lwjgl.dir}"/> <available file="${src.lwjgl.dir}"/>
<available file="${src.jogl.dir}"/> <available file="${src.jogl.dir}"/>
<available file="${src.android.dir}"/> <available file="${src.android.dir}"/>
<available file="${src.openal-soft-native.dir}"/>
<available file="${src.ios.dir}"/> <available file="${src.ios.dir}"/>
</or> </or>
</condition> </condition>
@ -296,6 +297,7 @@ is divided into following sections:
<fail unless="src.lwjgl.dir">Must set src.lwjgl.dir</fail> <fail unless="src.lwjgl.dir">Must set src.lwjgl.dir</fail>
<fail unless="src.jogl.dir">Must set src.jogl.dir</fail> <fail unless="src.jogl.dir">Must set src.jogl.dir</fail>
<fail unless="src.android.dir">Must set src.android.dir</fail> <fail unless="src.android.dir">Must set src.android.dir</fail>
<fail unless="src.openal-soft-native.dir">Must set src.openal-soft-native.dir</fail>
<fail unless="src.ios.dir">Must set src.ios.dir</fail> <fail unless="src.ios.dir">Must set src.ios.dir</fail>
<fail unless="test.test.dir">Must set test.test.dir</fail> <fail unless="test.test.dir">Must set test.test.dir</fail>
<fail unless="build.dir">Must set build.dir</fail> <fail unless="build.dir">Must set build.dir</fail>
@ -318,7 +320,7 @@ is divided into following sections:
</target> </target>
<target depends="-init-ap-cmdline-properties" if="ap.supported.internal" name="-init-macrodef-javac-with-processors"> <target depends="-init-ap-cmdline-properties" if="ap.supported.internal" name="-init-macrodef-javac-with-processors">
<macrodef name="javac" uri="http://www.netbeans.org/ns/j2se-project/3"> <macrodef name="javac" uri="http://www.netbeans.org/ns/j2se-project/3">
<attribute default="${src.core.dir}:${src.core-data.dir}:${src.core-effects.dir}:${src.core-plugins.dir}:${src.desktop.dir}:${src.terrain.dir}:${src.jbullet.dir}:${src.bullet.dir}:${src.bullet-native.dir}:${src.bullet-common.dir}:${src.networking.dir}:${src.niftygui.dir}:${src.jogg.dir}:${src.ogre.dir}:${src.blender.dir}:${src.xml.dir}:${src.tools.dir}:${src.test.dir}:${src.lwjgl.dir}:${src.jogl.dir}:${src.android.dir}:${src.ios.dir}" name="srcdir"/> <attribute default="${src.openal-soft-native.dir}:${src.core.dir}:${src.core-data.dir}:${src.core-effects.dir}:${src.core-plugins.dir}:${src.desktop.dir}:${src.terrain.dir}:${src.jbullet.dir}:${src.bullet.dir}:${src.bullet-native.dir}:${src.bullet-common.dir}:${src.networking.dir}:${src.niftygui.dir}:${src.jogg.dir}:${src.ogre.dir}:${src.blender.dir}:${src.xml.dir}:${src.tools.dir}:${src.test.dir}:${src.lwjgl.dir}:${src.jogl.dir}:${src.android.dir}:${src.ios.dir}" name="srcdir"/>
<attribute default="${build.classes.dir}" name="destdir"/> <attribute default="${build.classes.dir}" name="destdir"/>
<attribute default="${javac.classpath}" name="classpath"/> <attribute default="${javac.classpath}" name="classpath"/>
<attribute default="${javac.processorpath}" name="processorpath"/> <attribute default="${javac.processorpath}" name="processorpath"/>
@ -358,7 +360,7 @@ is divided into following sections:
</target> </target>
<target depends="-init-ap-cmdline-properties" name="-init-macrodef-javac-without-processors" unless="ap.supported.internal"> <target depends="-init-ap-cmdline-properties" name="-init-macrodef-javac-without-processors" unless="ap.supported.internal">
<macrodef name="javac" uri="http://www.netbeans.org/ns/j2se-project/3"> <macrodef name="javac" uri="http://www.netbeans.org/ns/j2se-project/3">
<attribute default="${src.core.dir}:${src.core-data.dir}:${src.core-effects.dir}:${src.core-plugins.dir}:${src.desktop.dir}:${src.terrain.dir}:${src.jbullet.dir}:${src.bullet.dir}:${src.bullet-native.dir}:${src.bullet-common.dir}:${src.networking.dir}:${src.niftygui.dir}:${src.jogg.dir}:${src.ogre.dir}:${src.blender.dir}:${src.xml.dir}:${src.tools.dir}:${src.test.dir}:${src.lwjgl.dir}:${src.jogl.dir}:${src.android.dir}:${src.ios.dir}" name="srcdir"/> <attribute default="${src.openal-soft-native.dir}:${src.core.dir}:${src.core-data.dir}:${src.core-effects.dir}:${src.core-plugins.dir}:${src.desktop.dir}:${src.terrain.dir}:${src.jbullet.dir}:${src.bullet.dir}:${src.bullet-native.dir}:${src.bullet-common.dir}:${src.networking.dir}:${src.niftygui.dir}:${src.jogg.dir}:${src.ogre.dir}:${src.blender.dir}:${src.xml.dir}:${src.tools.dir}:${src.test.dir}:${src.lwjgl.dir}:${src.jogl.dir}:${src.android.dir}:${src.ios.dir}" name="srcdir"/>
<attribute default="${build.classes.dir}" name="destdir"/> <attribute default="${build.classes.dir}" name="destdir"/>
<attribute default="${javac.classpath}" name="classpath"/> <attribute default="${javac.classpath}" name="classpath"/>
<attribute default="${javac.processorpath}" name="processorpath"/> <attribute default="${javac.processorpath}" name="processorpath"/>
@ -390,7 +392,7 @@ is divided into following sections:
</target> </target>
<target depends="-init-macrodef-javac-with-processors,-init-macrodef-javac-without-processors" name="-init-macrodef-javac"> <target depends="-init-macrodef-javac-with-processors,-init-macrodef-javac-without-processors" name="-init-macrodef-javac">
<macrodef name="depend" uri="http://www.netbeans.org/ns/j2se-project/3"> <macrodef name="depend" uri="http://www.netbeans.org/ns/j2se-project/3">
<attribute default="${src.core.dir}:${src.core-data.dir}:${src.core-effects.dir}:${src.core-plugins.dir}:${src.desktop.dir}:${src.terrain.dir}:${src.jbullet.dir}:${src.bullet.dir}:${src.bullet-native.dir}:${src.bullet-common.dir}:${src.networking.dir}:${src.niftygui.dir}:${src.jogg.dir}:${src.ogre.dir}:${src.blender.dir}:${src.xml.dir}:${src.tools.dir}:${src.test.dir}:${src.lwjgl.dir}:${src.jogl.dir}:${src.android.dir}:${src.ios.dir}" name="srcdir"/> <attribute default="${src.openal-soft-native.dir}:${src.core.dir}:${src.core-data.dir}:${src.core-effects.dir}:${src.core-plugins.dir}:${src.desktop.dir}:${src.terrain.dir}:${src.jbullet.dir}:${src.bullet.dir}:${src.bullet-native.dir}:${src.bullet-common.dir}:${src.networking.dir}:${src.niftygui.dir}:${src.jogg.dir}:${src.ogre.dir}:${src.blender.dir}:${src.xml.dir}:${src.tools.dir}:${src.test.dir}:${src.lwjgl.dir}:${src.jogl.dir}:${src.android.dir}:${src.ios.dir}" name="srcdir"/>
<attribute default="${build.classes.dir}" name="destdir"/> <attribute default="${build.classes.dir}" name="destdir"/>
<attribute default="${javac.classpath}" name="classpath"/> <attribute default="${javac.classpath}" name="classpath"/>
<sequential> <sequential>
@ -977,11 +979,12 @@ is divided into following sections:
<include name="*"/> <include name="*"/>
</dirset> </dirset>
</pathconvert> </pathconvert>
<j2seproject3:depend srcdir="${src.core.dir}:${src.core-data.dir}:${src.core-effects.dir}:${src.core-plugins.dir}:${src.desktop.dir}:${src.terrain.dir}:${src.jbullet.dir}:${src.bullet.dir}:${src.bullet-native.dir}:${src.bullet-common.dir}:${src.networking.dir}:${src.niftygui.dir}:${src.jogg.dir}:${src.ogre.dir}:${src.blender.dir}:${src.xml.dir}:${src.tools.dir}:${src.test.dir}:${src.lwjgl.dir}:${src.jogl.dir}:${src.android.dir}:${src.ios.dir}:${build.generated.subdirs}"/> <j2seproject3:depend srcdir="${src.openal-soft-native.dir}:${src.core.dir}:${src.core-data.dir}:${src.core-effects.dir}:${src.core-plugins.dir}:${src.desktop.dir}:${src.terrain.dir}:${src.jbullet.dir}:${src.bullet.dir}:${src.bullet-native.dir}:${src.bullet-common.dir}:${src.networking.dir}:${src.niftygui.dir}:${src.jogg.dir}:${src.ogre.dir}:${src.blender.dir}:${src.xml.dir}:${src.tools.dir}:${src.test.dir}:${src.lwjgl.dir}:${src.jogl.dir}:${src.android.dir}:${src.ios.dir}:${build.generated.subdirs}"/>
</target> </target>
<target depends="init,deps-jar,-pre-pre-compile,-pre-compile, -copy-persistence-xml,-compile-depend" if="have.sources" name="-do-compile"> <target depends="init,deps-jar,-pre-pre-compile,-pre-compile, -copy-persistence-xml,-compile-depend" if="have.sources" name="-do-compile">
<j2seproject3:javac gensrcdir="${build.generated.sources.dir}"/> <j2seproject3:javac gensrcdir="${build.generated.sources.dir}"/>
<copy todir="${build.classes.dir}"> <copy todir="${build.classes.dir}">
<fileset dir="${src.openal-soft-native.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
<fileset dir="${src.core.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/> <fileset dir="${src.core.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
<fileset dir="${src.core-data.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/> <fileset dir="${src.core-data.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
<fileset dir="${src.core-effects.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/> <fileset dir="${src.core-effects.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
@ -1024,7 +1027,7 @@ is divided into following sections:
<target depends="init,deps-jar,-pre-pre-compile" name="-do-compile-single"> <target depends="init,deps-jar,-pre-pre-compile" name="-do-compile-single">
<fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail> <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
<j2seproject3:force-recompile/> <j2seproject3:force-recompile/>
<j2seproject3:javac excludes="" gensrcdir="${build.generated.sources.dir}" includes="${javac.includes}" sourcepath="${src.core.dir}:${src.core-data.dir}:${src.core-effects.dir}:${src.core-plugins.dir}:${src.desktop.dir}:${src.terrain.dir}:${src.jbullet.dir}:${src.bullet.dir}:${src.bullet-native.dir}:${src.bullet-common.dir}:${src.networking.dir}:${src.niftygui.dir}:${src.jogg.dir}:${src.ogre.dir}:${src.blender.dir}:${src.xml.dir}:${src.tools.dir}:${src.test.dir}:${src.lwjgl.dir}:${src.jogl.dir}:${src.android.dir}:${src.ios.dir}"/> <j2seproject3:javac excludes="" gensrcdir="${build.generated.sources.dir}" includes="${javac.includes}" sourcepath="${src.openal-soft-native.dir}:${src.core.dir}:${src.core-data.dir}:${src.core-effects.dir}:${src.core-plugins.dir}:${src.desktop.dir}:${src.terrain.dir}:${src.jbullet.dir}:${src.bullet.dir}:${src.bullet-native.dir}:${src.bullet-common.dir}:${src.networking.dir}:${src.niftygui.dir}:${src.jogg.dir}:${src.ogre.dir}:${src.blender.dir}:${src.xml.dir}:${src.tools.dir}:${src.test.dir}:${src.lwjgl.dir}:${src.jogl.dir}:${src.android.dir}:${src.ios.dir}"/>
</target> </target>
<target name="-post-compile-single"> <target name="-post-compile-single">
<!-- Empty placeholder for easier customization. --> <!-- Empty placeholder for easier customization. -->
@ -1285,6 +1288,9 @@ is divided into following sections:
<classpath> <classpath>
<path path="${javac.classpath}"/> <path path="${javac.classpath}"/>
</classpath> </classpath>
<fileset dir="${src.openal-soft-native.dir}" excludes="*.java,${excludes}" includes="${includes}">
<filename name="**/*.java"/>
</fileset>
<fileset dir="${src.core.dir}" excludes="*.java,${excludes}" includes="${includes}"> <fileset dir="${src.core.dir}" excludes="*.java,${excludes}" includes="${includes}">
<filename name="**/*.java"/> <filename name="**/*.java"/>
</fileset> </fileset>
@ -1358,6 +1364,9 @@ is divided into following sections:
<arg line="${javadoc.endorsed.classpath.cmd.line.arg}"/> <arg line="${javadoc.endorsed.classpath.cmd.line.arg}"/>
</javadoc> </javadoc>
<copy todir="${dist.javadoc.dir}"> <copy todir="${dist.javadoc.dir}">
<fileset dir="${src.openal-soft-native.dir}" excludes="${excludes}" includes="${includes}">
<filename name="**/doc-files/**"/>
</fileset>
<fileset dir="${src.core.dir}" excludes="${excludes}" includes="${includes}"> <fileset dir="${src.core.dir}" excludes="${excludes}" includes="${includes}">
<filename name="**/doc-files/**"/> <filename name="**/doc-files/**"/>
</fileset> </fileset>

@ -0,0 +1,105 @@
<?xml version="1.0" encoding="UTF-8"?>
<project name="build openal-soft natives" default="all" basedir="../">
<!-- load cpp compiler ant task -->
<taskdef resource="cpptasks.tasks" classpath="lib/antlibs/cpptasks.jar"/>
<!-- load properties -->
<property file="nbproject/openal-soft-native.properties"/>
<condition property="ndk-build-name" value="ndk-build.cmd" else="ndk-build">
<os family="windows" />
</condition>
<fileset id="lib.jars" dir="${openal-soft.lib.dir}">
<include name="**/*.jar"/>
</fileset>
<fileset id="lib.jme.jars" dir="${openal-soft.jme.dir}">
<include name="**/*.jar"/>
</fileset>
<pathconvert property="lib.importpath">
<fileset refid="lib.jars"/>
<fileset refid="lib.jme.jars"/>
</pathconvert>
<target name="build-openal-soft-natives" description="builds the native openal-soft library for android" depends="create-native-headers, -create-folders, compile-android">
<echo message="Updating native jME3-openal-soft-natives.jar"/>
<zip basedir="${openal-soft.output.dir}" file="${openal-soft.output.base}/jME3-openal-soft-natives-android.jar" compress="true"/>
<copy file="${openal-soft.output.base}/jME3-openal-soft-natives-android.jar" todir="dist/opt/native-openal-soft/"/>
</target>
<target name="create-native-headers" description="creates the native C++ headers for the java native methods">
<javah destdir="${openal-soft.source.dir}" classpath="${openal-soft.build.dir}${path.separator}${lib.importpath}">
<class name="com.jme3.audio.android.AndroidOpenALSoftAudioRenderer"/>
</javah>
</target>
<target name="-create-folders" description="creates the needed folders">
<mkdir dir="${openal-soft.build.dir}"/>
<mkdir dir="${openal-soft.build.dir}/jni"/>
<mkdir dir="${openal-soft.output.base}"/>
<mkdir dir="${openal-soft.output.dir}"/>
</target>
<target name="compile-android" description="compiles libopenalsoftjme using the Android NDK" depends="-check-android-ndk" if="haveAndoidNdk">
<!-- copy OpenAL Soft files into jni directory -->
<echo>Copying OpenAL Soft source files to build directory from ${openal-soft.include}</echo>
<copy todir="${openal-soft.build.dir}/jni" verbose="true" flatten="false" overwrite="true">
<fileset dir="${openal-soft.include}">
<include name="**/*.*"/>
<!--
<include name="**/*.cpp"/>
<include name="**/*.h"/>
<include name="**/*.cl"/>
<include name="**/*.c"/>
<include name="**/*.inc"/>
<exclude name="/android/*.*"/>
<include name="**/*.*" />
-->
</fileset>
</copy>
<!-- copy jME3 Native OpenAL Soft files into jni directory -->
<!--
<echo>Copying jME3 JNI files for OpenAL Soft to build directory from ${openal-soft.source.dir}</echo>
<copy todir="build/openal-soft-android/jni" verbose="true" flatten="false" overwrite="true">
<fileset dir="${openal-soft.source.dir}">
<include name="*.cpp" />
<include name="*.h" />
<include name="**/*.*" />
</fileset>
</copy>
-->
<!-- copy Android.mk and Application.mk files into jni directory -->
<echo>Copying Android Make and JNI files for OpenAL Soft to build directory from ${openal-soft.source.dir}</echo>
<copy todir="${openal-soft.build.dir}/jni" verbose="true" flatten="false" overwrite="true">
<fileset dir="${openal-soft.source.dir}">
<include name="*.*" />
</fileset>
</copy>
<!--
<copy file="${openal-soft.source.dir}/Android.mk" todir="build/openal-soft-android/jni" verbose="true"/>
<copy file="${openal-soft.source.dir}/Application.mk" todir="build/openal-soft-android/jni" verbose="true"/>
-->
<exec executable="${ndk.dir}/${ndk-build-name}" failonerror="true" >
<!--<arg line="NDK_DEBUG=1"/>-->
<arg line="TARGET_PLATFORM=android-9"/>
<arg line="-C ${openal-soft.build.dir}/"/>
</exec>
<!-- copy resulting library directories to jarcontent directory -->
<copy todir="${openal-soft.output.dir}" verbose="true" flatten="false">
<fileset dir="${openal-soft.build.dir}/libs">
<include name="**/*.*"/>
<!--exclude name="**/x86/*.*"/-->
</fileset>
</copy>
</target>
<target name="-check-android-ndk">
<available file="${ndk.dir}/${ndk-build-name}" property="haveAndoidNdk"/>
</target>
</project>

@ -0,0 +1,2 @@
$label=Native OpenAL Soft
$target.build=build-openal-soft-natives

@ -0,0 +1,23 @@
##########################################################
# these are the ant build properties for openal-soft-jme #
##########################################################
# location of Android NDK if available
ndk.dir=D:/android/android-ndk-r7
# directory of OpenAL Soft download
openal-soft.folder=../openalsoft_1_15_1/openal-soft
# compile options
openal-soft.compile.debug=false
# native header include directories
openal-soft.java.include=${java.home}/../include
# dont change these..
openal-soft.include=${openal-soft.folder}
openal-soft.source.dir=src/openal-soft-native/android
openal-soft.build.dir=build/openal-soft/
openal-soft.output.base=lib/openal-soft
openal-soft.output.dir=${openal-soft.output.base}/jarcontent
openal-soft.jme.dir=dist
openal-soft.lib.dir=dist/lib

@ -125,6 +125,7 @@ src.lwjgl.dir=src/lwjgl
src.networking.dir=src/networking src.networking.dir=src/networking
src.niftygui.dir=src/niftygui src.niftygui.dir=src/niftygui
src.ogre.dir=src/ogre src.ogre.dir=src/ogre
src.openal-soft-native.dir=src\\openal-soft-native
src.terrain.dir=src/terrain src.terrain.dir=src/terrain
src.test.dir=src/test src.test.dir=src/test
src.tools.dir=src/tools src.tools.dir=src/tools

@ -32,6 +32,7 @@
<root id="src.lwjgl.dir" name="LWJGL Renderer"/> <root id="src.lwjgl.dir" name="LWJGL Renderer"/>
<root id="src.jogl.dir" name="JOGL Renderer"/> <root id="src.jogl.dir" name="JOGL Renderer"/>
<root id="src.android.dir" name="Android Renderer"/> <root id="src.android.dir" name="Android Renderer"/>
<root id="src.openal-soft-native.dir" name="OpenAL Soft C++"/>
<root id="src.ios.dir" name="iOS Renderer"/> <root id="src.ios.dir" name="iOS Renderer"/>
</source-roots> </source-roots>
<test-roots> <test-roots>

Loading…
Cancel
Save