OSDN Git Service

Android: Copy OpenAL Soft library to dist/opt directory when building the engine...
[mikumikustudio/MikuMikuStudio.git] / engine / nbproject / build-openal-soft-natives.xml
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"/>
7
8     <condition property="ndk-build-name" value="ndk-build.cmd" else="ndk-build">
9         <os family="windows" />
10     </condition>
11
12     <fileset id="lib.jars" dir="${openal-soft.lib.dir}">
13         <include name="**/*.jar"/>
14     </fileset>
15     <fileset id="lib.jme.jars" dir="${openal-soft.jme.dir}">
16         <include name="**/*.jar"/>
17     </fileset>
18
19     <pathconvert property="lib.importpath">
20         <fileset refid="lib.jars"/>
21         <fileset refid="lib.jme.jars"/>
22     </pathconvert>
23
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/"/>
28     </target>
29
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"/>
33         </javah>
34     </target>
35
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}"/>
41     </target>
42
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="**/*.*"/>
49 <!--
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="**/*.*" />
57 -->
58             </fileset>
59         </copy>
60
61         <!-- copy jME3 Native OpenAL Soft files into jni directory -->
62 <!--
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="**/*.*" />
69             </fileset>
70         </copy>
71 -->
72
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="**/*.*"/>-->
79             </fileset>
80         </copy>
81 <!--
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"/>
84 -->
85
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}/"/>
90         </exec>
91
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/*.*"/-->
97             </fileset>
98         </copy>
99
100     </target>
101
102     <target name="-check-android-ndk">
103         <available file="${ndk.dir}/${ndk-build-name}" property="haveAndoidNdk"/>
104     </target>
105
106 </project>