build-openal-soft-natives.xml 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  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. <condition property="ndk-build-name" value="ndk-build.cmd" else="ndk-build">
  8. <os family="windows" />
  9. </condition>
  10. <fileset id="lib.jars" dir="${openal-soft.lib.dir}">
  11. <include name="**/*.jar"/>
  12. </fileset>
  13. <fileset id="lib.jme.jars" dir="${openal-soft.jme.dir}">
  14. <include name="**/*.jar"/>
  15. </fileset>
  16. <pathconvert property="lib.importpath">
  17. <fileset refid="lib.jars"/>
  18. <fileset refid="lib.jme.jars"/>
  19. </pathconvert>
  20. <target name="build-openal-soft-natives" description="builds the native openal-soft library for android" depends="create-native-headers, -create-folders, compile-android">
  21. <echo message="Updating native jME3-openal-soft-natives.jar"/>
  22. <zip basedir="${openal-soft.output.dir}" file="${openal-soft.output.base}/jME3-openal-soft-natives-android.jar" compress="true"/>
  23. <copy file="${openal-soft.output.base}/jME3-openal-soft-natives-android.jar" todir="dist/opt/native-openal-soft/"/>
  24. </target>
  25. <target name="create-native-headers" description="creates the native C++ headers for the java native methods">
  26. <javah destdir="${openal-soft.source.dir}" classpath="${openal-soft.build.dir}${path.separator}${lib.importpath}">
  27. <class name="com.jme3.audio.android.AndroidOpenALSoftAudioRenderer"/>
  28. </javah>
  29. </target>
  30. <target name="-create-folders" description="creates the needed folders">
  31. <mkdir dir="${openal-soft.build.dir}"/>
  32. <mkdir dir="${openal-soft.build.dir}/jni"/>
  33. <mkdir dir="${openal-soft.output.base}"/>
  34. <mkdir dir="${openal-soft.output.dir}"/>
  35. </target>
  36. <target name="compile-android" description="compiles libopenalsoftjme using the Android NDK" depends="-check-android-ndk" if="haveAndoidNdk">
  37. <!-- copy OpenAL Soft files into jni directory -->
  38. <echo>Copying OpenAL Soft source files to build directory from ${openal-soft.include}</echo>
  39. <copy todir="${openal-soft.build.dir}/jni" verbose="true" flatten="false" overwrite="true">
  40. <fileset dir="${openal-soft.include}">
  41. <include name="**/*.*"/>
  42. <!--
  43. <include name="**/*.cpp"/>
  44. <include name="**/*.h"/>
  45. <include name="**/*.cl"/>
  46. <include name="**/*.c"/>
  47. <include name="**/*.inc"/>
  48. <exclude name="/android/*.*"/>
  49. <include name="**/*.*" />
  50. -->
  51. </fileset>
  52. </copy>
  53. <!-- copy jME3 Native OpenAL Soft files into jni directory -->
  54. <!--
  55. <echo>Copying jME3 JNI files for OpenAL Soft to build directory from ${openal-soft.source.dir}</echo>
  56. <copy todir="build/openal-soft-android/jni" verbose="true" flatten="false" overwrite="true">
  57. <fileset dir="${openal-soft.source.dir}">
  58. <include name="*.cpp" />
  59. <include name="*.h" />
  60. <include name="**/*.*" />
  61. </fileset>
  62. </copy>
  63. -->
  64. <!-- copy Android.mk and Application.mk files into jni directory -->
  65. <echo>Copying Android Make and JNI files for OpenAL Soft to build directory from ${openal-soft.source.dir}</echo>
  66. <copy todir="${openal-soft.build.dir}/jni" verbose="true" flatten="false" overwrite="true">
  67. <fileset dir="${openal-soft.source.dir}">
  68. <include name="*.*" />
  69. <!--<include name="**/*.*"/>-->
  70. </fileset>
  71. </copy>
  72. <!--
  73. <copy file="${openal-soft.source.dir}/Android.mk" todir="build/openal-soft-android/jni" verbose="true"/>
  74. <copy file="${openal-soft.source.dir}/Application.mk" todir="build/openal-soft-android/jni" verbose="true"/>
  75. -->
  76. <exec executable="${ndk.dir}/${ndk-build-name}" failonerror="true" >
  77. <!--<arg line="NDK_DEBUG=1"/>-->
  78. <arg line="TARGET_PLATFORM=android-9"/>
  79. <arg line="-C ${openal-soft.build.dir}/"/>
  80. </exec>
  81. <!-- copy resulting library directories to jarcontent directory -->
  82. <copy todir="${openal-soft.output.dir}" verbose="true" flatten="false">
  83. <fileset dir="${openal-soft.build.dir}/libs">
  84. <include name="**/*.*"/>
  85. <!--exclude name="**/x86/*.*"/-->
  86. </fileset>
  87. </copy>
  88. </target>
  89. <target name="-check-android-ndk">
  90. <available file="${ndk.dir}/${ndk-build-name}" property="haveAndoidNdk"/>
  91. </target>
  92. </project>