1 <?xml version="1.0" encoding="UTF-8"?>
2 <project name="build openal-soft natives" default="all" basedir="../">
3 <!-- load cpp compiler ant task -->
4 <taskdef resource="cpptasks.tasks" classpath="lib/antlibs/cpptasks.jar"/>
5 <!-- load properties -->
6 <property file="nbproject/openal-soft-native.properties"/>
8 <condition property="ndk-build-name" value="ndk-build.cmd" else="ndk-build">
9 <os family="windows" />
12 <fileset id="lib.jars" dir="${openal-soft.lib.dir}">
13 <include name="**/*.jar"/>
15 <fileset id="lib.jme.jars" dir="${openal-soft.jme.dir}">
16 <include name="**/*.jar"/>
19 <pathconvert property="lib.importpath">
20 <fileset refid="lib.jars"/>
21 <fileset refid="lib.jme.jars"/>
24 <target name="build-openal-soft-natives" description="builds the native openal-soft library for android" depends="create-native-headers, -create-folders, compile-android">
25 <echo message="Updating native jME3-openal-soft-natives.jar"/>
26 <zip basedir="${openal-soft.output.dir}" file="${openal-soft.output.base}/jME3-openal-soft-natives-android.jar" compress="true"/>
27 <copy file="${openal-soft.output.base}/jME3-openal-soft-natives-android.jar" todir="dist/opt/native-openal-soft/"/>
30 <target name="create-native-headers" description="creates the native C++ headers for the java native methods">
31 <javah destdir="${openal-soft.source.dir}" classpath="${openal-soft.build.dir}${path.separator}${lib.importpath}">
32 <class name="com.jme3.audio.android.AndroidOpenALSoftAudioRenderer"/>
36 <target name="-create-folders" description="creates the needed folders">
37 <mkdir dir="${openal-soft.build.dir}"/>
38 <mkdir dir="${openal-soft.build.dir}/jni"/>
39 <mkdir dir="${openal-soft.output.base}"/>
40 <mkdir dir="${openal-soft.output.dir}"/>
43 <target name="compile-android" description="compiles libopenalsoftjme using the Android NDK" depends="-check-android-ndk" if="haveAndoidNdk">
44 <!-- copy OpenAL Soft files into jni directory -->
45 <echo>Copying OpenAL Soft source files to build directory from ${openal-soft.include}</echo>
46 <copy todir="${openal-soft.build.dir}/jni" verbose="true" flatten="false" overwrite="true">
47 <fileset dir="${openal-soft.include}">
48 <include name="**/*.*"/>
50 <include name="**/*.cpp"/>
51 <include name="**/*.h"/>
52 <include name="**/*.cl"/>
53 <include name="**/*.c"/>
54 <include name="**/*.inc"/>
55 <exclude name="/android/*.*"/>
56 <include name="**/*.*" />
61 <!-- copy jME3 Native OpenAL Soft files into jni directory -->
63 <echo>Copying jME3 JNI files for OpenAL Soft to build directory from ${openal-soft.source.dir}</echo>
64 <copy todir="build/openal-soft-android/jni" verbose="true" flatten="false" overwrite="true">
65 <fileset dir="${openal-soft.source.dir}">
66 <include name="*.cpp" />
67 <include name="*.h" />
68 <include name="**/*.*" />
73 <!-- copy Android.mk and Application.mk files into jni directory -->
74 <echo>Copying Android Make and JNI files for OpenAL Soft to build directory from ${openal-soft.source.dir}</echo>
75 <copy todir="${openal-soft.build.dir}/jni" verbose="true" flatten="false" overwrite="true">
76 <fileset dir="${openal-soft.source.dir}">
77 <include name="*.*" />
78 <!--<include name="**/*.*"/>-->
82 <copy file="${openal-soft.source.dir}/Android.mk" todir="build/openal-soft-android/jni" verbose="true"/>
83 <copy file="${openal-soft.source.dir}/Application.mk" todir="build/openal-soft-android/jni" verbose="true"/>
86 <exec executable="${ndk.dir}/${ndk-build-name}" failonerror="true" >
87 <!--<arg line="NDK_DEBUG=1"/>-->
88 <arg line="TARGET_PLATFORM=android-9"/>
89 <arg line="-C ${openal-soft.build.dir}/"/>
92 <!-- copy resulting library directories to jarcontent directory -->
93 <copy todir="${openal-soft.output.dir}" verbose="true" flatten="false">
94 <fileset dir="${openal-soft.build.dir}/libs">
95 <include name="**/*.*"/>
96 <!--exclude name="**/x86/*.*"/-->
102 <target name="-check-android-ndk">
103 <available file="${ndk.dir}/${ndk-build-name}" property="haveAndoidNdk"/>