build.xml 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. <project default="build_jar" name="ZeroTierOneSDK" basedir=".">
  2. <property environment="env"/>
  3. <condition property="isWindows">
  4. <os family="windows"/>
  5. </condition>
  6. <condition property="isMac">
  7. <os family="mac"/>
  8. </condition>
  9. <target name="clean_ant">
  10. <delete dir="bin" failonerror="false"/>
  11. <delete dir="classes" failonerror="false"/>
  12. <delete dir="build_win32" failonerror="false"/>
  13. <delete dir="build_win64" failonerror="false"/>
  14. <delete dir="mac32_64" failonerror="false"/>
  15. <delete dir="libs" failonerror="false"/>
  16. <delete dir="obj" failonerror="false"/>
  17. </target>
  18. <target name="build_java">
  19. <echo message="os.name = ${os.name}"/>
  20. <echo message="os.arch = ${os.arch}"/>
  21. <echo message="ant.java.version = ${ant.java.version}"/>
  22. <echo message="java.version = ${java.version}"/>
  23. <echo message="ndk.loc = ${env.NDK_BUILD_LOC}"/>
  24. <echo message="sdk.loc = ${env.ANDROID_PLATFORM}"/>
  25. <echo message="user.dir = ${user.dir}"/>
  26. <echo message="zt1.dir = ${env.ZT}"/>
  27. <mkdir dir="bin"/>
  28. <mkdir dir="classes"/>
  29. <javac srcdir="src"
  30. destdir="classes"
  31. source="1.7"
  32. target="1.7"
  33. classpath="${env.ANDROID_PLATFORM}/android.jar"
  34. includeantruntime="false"/>
  35. </target>
  36. <target name="build_android">
  37. <exec dir="jni" executable="${env.NDK_BUILD_LOC}" failonerror="true">
  38. <arg value="ZT1=${env.ZT}"/>
  39. <arg value="V=1"/>
  40. <!-- <arg value="NDK_DEBUG=1"/> -->
  41. </exec>
  42. <copy file="libs/arm64-v8a/libZeroTierOneJNI.so"
  43. tofile="classes/lib/arm64-v8a/libZeroTierOneJNI.so"
  44. overwrite="true"/>
  45. <copy file="libs/armeabi/libZeroTierOneJNI.so"
  46. tofile="classes/lib/armeabi/libZeroTierOneJNI.so"
  47. overwrite="true"/>
  48. <copy file="libs/armeabi-v7a/libZeroTierOneJNI.so"
  49. tofile="classes/lib/armeabi-v7a/libZeroTierOneJNI.so"
  50. overwrite="true"/>
  51. <copy file="libs/mips/libZeroTierOneJNI.so"
  52. tofile="classes/lib/mips/libZeroTierOneJNI.so"
  53. overwrite="true"/>
  54. <copy file="libs/mips64/libZeroTierOneJNI.so"
  55. tofile="classes/lib/mips64/libZeroTierOne.so"
  56. overwrite="true"/>
  57. <copy file="libs/x86/libZeroTierOneJNI.so"
  58. tofile="classes/lib/x86/libZeroTierOneJNI.so"
  59. overwrite="true"/>
  60. <copy file="libs/x86_64/libZeroTierOneJNI.so"
  61. tofile="classes/lib/x86_64/libZeroTierOneJNI.so"
  62. overwrite="true"/>
  63. </target>
  64. <target name="windows" if="isWindows">
  65. <mkdir dir="build_win32"/>
  66. <exec dir="build_win32/" executable="cmake" failonerror="true">
  67. <arg line=".. -G&quot;Visual Studio 11 2012&quot; -DCMAKE_BUILD_TYPE=Release"/>
  68. </exec>
  69. <exec dir="build_win32/" executable="cmake" failonerror="true">
  70. <arg line="--build . --config Release"/>
  71. </exec>
  72. <copy file="build_win32/Release/ZeroTierOneJNI.dll"
  73. tofile="classes/lib/ZeroTierOneJNI_win32.dll"
  74. overwrite="true"/>
  75. <mkdir dir="build_win64"/>
  76. <exec dir="build_win64/" executable="cmake" failonerror="true">
  77. <arg line=".. -G&quot;Visual Studio 11 2012 Win64&quot; -DCMAKE_BUILD_TYPE=Release"/>
  78. </exec>
  79. <exec dir="build_win64/" executable="cmake" failonerror="true">
  80. <arg line="--build . --config Release"/>
  81. </exec>
  82. <copy file="build_win64/Release/ZeroTierOneJNI.dll"
  83. tofile="classes/lib/ZeroTierOneJNI_win64.dll"
  84. overwrite="true"/>
  85. </target>
  86. <target name="mac" if="isMac">
  87. <mkdir dir="mac32_64"/>
  88. <exec dir="mac32_64/" executable="cmake" failonerror="true">
  89. <arg line=".. -DCMAKE_BUILD_TYPE=Release"/>
  90. </exec>
  91. <exec dir="mac32_64/" executable="cmake" failonerror="true">
  92. <arg line="--build . --config Release"/>
  93. </exec>
  94. <copy file="mac32_64/libZeroTierOneJNI.jnilib"
  95. tofile="classes/lib/libZeroTierOneJNI.jnilib"
  96. overwrite="true"/>
  97. </target>
  98. <target name="build_jar" depends="build_java,build_android,windows,mac">
  99. <jar destfile="bin/ZeroTierOneSDK.jar" basedir="classes"/>
  100. </target>
  101. <target name="docs">
  102. <echo message="Generating Javadocs"/>
  103. <mkdir dir="doc/"/>
  104. <javadoc sourcepath="src/"
  105. destdir="doc/"/>
  106. </target>
  107. </project>