You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

105 lines
3.4 KiB

  1. <?xml version="1.0"?>
  2. <project name="Ticketing System."
  3. default="targets" basedir="."
  4. xmlns:dn="antlib:org.apache.ant.dotnet"
  5. xmlns="antlib:org.apache.tools.ant"
  6. xmlns:cpptasks="antlib:net.sf.antcontrib.cpptasks">
  7. <taskdef resource="cpptasks.tasks"/>
  8. <taskdef resource="net/sf/antcontrib/antcontrib.properties"/>
  9. <property name="src" value="src/"/>
  10. <property name="obj.dir" value="obj"/>
  11. <property name="lib" value="./lib" />
  12. <property name="dist.dir" value="bin"/>
  13. <property environment="env"/>
  14. <property name="user" value="${env.USERNAME}"/>
  15. <path id="compile.classpath">
  16. <pathelement location="${build}"/>
  17. <pathelement path="${lib}/json.jar"/>
  18. </path>
  19. <target name="targets">
  20. <echo message="Targets are clean, build, targets, test"/>
  21. </target>
  22. <target name="build">
  23. <tstamp/>
  24. <!-- Create the build directory structure used by compile -->
  25. <mkdir dir="${dist.dir}" />
  26. <mkdir dir="${obj.dir}" />
  27. <condition property="build.host.islinux">
  28. <and>
  29. <os family="unix" />
  30. <not>
  31. <contains string="${os.name}" substring="mac"
  32. casesensitive="false"/>
  33. </not>
  34. </and>
  35. </condition>
  36. <condition property="build.host.platform" value="linux">
  37. <isset property="build.host.islinux" />
  38. </condition>
  39. <condition property="build.host.ismac">
  40. <and>
  41. <os family="unix" />
  42. <contains string="${os.name}" substring="mac" casesensitive="false"/>
  43. </and>
  44. </condition>
  45. <condition property="build.host.platform" value="mac">
  46. <isset property="build.host.ismac" />
  47. </condition>
  48. <fail unless="build.host.platform"
  49. message="Building on ${os.name} is not supported" />
  50. <echo message="build.host.platform is: ${build.host.platform}"/>
  51. <if>
  52. <isset property="build.host.ismac"/>
  53. <then>
  54. <echo message="detected a mac host"/>
  55. <property name="includepath" value="/opt/local/include:/usr/local/include"/>
  56. <property name="client.lib.path" value="/usr/local/lib"/>
  57. <property name="client.lib.list" value="c++,jsoncpp,stdc++"/>
  58. </then>
  59. <elseif>
  60. <isset property="build.host.islinux"/>
  61. <then>
  62. <echo message="detected a linux host"/>
  63. <property name="includepath" value="/usr/include/jsoncpp"/>
  64. <property name="client.lib.path" value="/usr/local/lib"/>
  65. <property name="client.lib.list" value="jsoncpp,stdc++"/>
  66. </then>
  67. </elseif>
  68. <else>
  69. <echo message="failed to detect a host I know how to build on"/>
  70. </else>
  71. </if>
  72. <echo message="includepath is ${includepath}"/>
  73. <cc name="g++" outtype="executable" subsystem="console"
  74. outfile="${dist.dir}/main"
  75. objdir="${obj.dir}">
  76. <compilerarg location="start" value="-std=c++0x"/>
  77. <includepath>
  78. <pathelement path="${includepath}"/>
  79. </includepath>
  80. <libset dir="${client.lib.path}" libs="${client.lib.list}"/>
  81. <fileset dir="${src}" includes="Person.cpp,LogInSystem.cpp,Vehicle.cpp,VehicleManager.cpp,main.cpp"/>
  82. </cc>
  83. <echo message="To run the program, input './bin/main' into the command line."/>
  84. </target>
  85. <target name="test" depends="build, clean">
  86. </target>
  87. <target name="clean">
  88. <delete dir="${obj.dir}" failonerror="false"/>
  89. <delete dir="${dist.dir}" failonerror="false"/>
  90. </target>
  91. </project>