1 <?xml version="1.0" encoding="UTF-8"?>
2 <project name="build bullet 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="src/bullet/native/bullet.properties"/>
7 <!-- condition for mac platform check -->
8 <condition property="isSolaris">
11 <condition property="isMac">
17 <!-- condition for windows platform check -->
18 <condition property="isWindows">
19 <os family="windows" />
21 <!-- condition for linux platform check -->
22 <condition property="isLinux">
33 <!-- condition for x86_64 check -->
34 <condition property="isx86_64">
38 <fileset id="lib.jars" dir="${bullet.lib.dir}">
39 <include name="**/*.jar"/>
41 <fileset id="lib.jme.jars" dir="${bullet.jme.dir}">
42 <include name="**/*.jar"/>
45 <pathconvert property="lib.importpath">
46 <fileset refid="lib.jars"/>
47 <fileset refid="lib.jme.jars"/>
50 <target name="build-bullet-natives" description="builds the native bullet library for the platform being run on" depends="-create-folders, create-native-headers, -nativelib-osx, -nativelib-windows, -nativelib-linux, -nativelib-solaris">
51 <echo message="Updating native jME3-bullet-natives.jar"/>
52 <zip basedir="${bullet.output.base}/jarcontent" file="${bullet.output.base}/jME3-bullet-natives.jar" compress="true"/>
53 <copy file="${bullet.output.base}/jME3-bullet-natives.jar" todir="dist/lib"/>
56 <target name="create-native-headers" description="creates the native headers">
57 <javah destdir="${bullet.source.dir}" classpath="${bullet.build.dir}${path.separator}${lib.importpath}" force="yes">
58 <class name="com.jme3.bullet.PhysicsSpace"/>
60 <class name="com.jme3.bullet.collision.PhysicsCollisionEvent"/>
61 <class name="com.jme3.bullet.collision.PhysicsCollisionObject"/>
62 <class name="com.jme3.bullet.objects.PhysicsCharacter"/>
63 <class name="com.jme3.bullet.objects.PhysicsGhostObject"/>
64 <class name="com.jme3.bullet.objects.PhysicsRigidBody"/>
65 <class name="com.jme3.bullet.objects.PhysicsVehicle"/>
66 <class name="com.jme3.bullet.objects.VehicleWheel"/>
67 <class name="com.jme3.bullet.objects.infos.RigidBodyMotionState"/>
69 <class name="com.jme3.bullet.collision.shapes.CollisionShape"/>
70 <class name="com.jme3.bullet.collision.shapes.BoxCollisionShape"/>
71 <class name="com.jme3.bullet.collision.shapes.CapsuleCollisionShape"/>
72 <class name="com.jme3.bullet.collision.shapes.CompoundCollisionShape"/>
73 <class name="com.jme3.bullet.collision.shapes.ConeCollisionShape"/>
74 <class name="com.jme3.bullet.collision.shapes.CylinderCollisionShape"/>
75 <class name="com.jme3.bullet.collision.shapes.GImpactCollisionShape"/>
76 <class name="com.jme3.bullet.collision.shapes.HeightfieldCollisionShape"/>
77 <class name="com.jme3.bullet.collision.shapes.HullCollisionShape"/>
78 <class name="com.jme3.bullet.collision.shapes.MeshCollisionShape"/>
79 <class name="com.jme3.bullet.collision.shapes.PlaneCollisionShape"/>
80 <class name="com.jme3.bullet.collision.shapes.SimplexCollisionShape"/>
81 <class name="com.jme3.bullet.collision.shapes.SphereCollisionShape"/>
83 <class name="com.jme3.bullet.joints.PhysicsJoint"/>
84 <class name="com.jme3.bullet.joints.ConeJoint"/>
85 <class name="com.jme3.bullet.joints.HingeJoint"/>
86 <class name="com.jme3.bullet.joints.Point2PointJoint"/>
87 <class name="com.jme3.bullet.joints.SixDofJoint"/>
88 <class name="com.jme3.bullet.joints.SixDofSpringJoint"/>
89 <class name="com.jme3.bullet.joints.SliderJoint"/>
90 <class name="com.jme3.bullet.joints.motors.RotationalLimitMotor"/>
91 <class name="com.jme3.bullet.joints.motors.TranslationalLimitMotor"/>
93 <class name="com.jme3.bullet.util.NativeMeshUtil"/>
94 <class name="com.jme3.bullet.util.DebugShapeFactory"/>
98 <!-- compares the API of native bullet and java version-->
99 <target name="bullet-api-diff">
100 <echo message="Comparing bullet and jbullet API"/>
101 <property name="dependencyfinder.home" value="lib/antlibs/depfinder"/>
102 <path id="dependencyfinder">
103 <pathelement location="${dependencyfinder.home}/classes"/>
104 <pathelement location="${dependencyfinder.home}/lib/DependencyFinder.jar"/>
105 <pathelement location="${dependencyfinder.home}/lib/jakarta-oro.jar"/>
106 <pathelement location="${dependencyfinder.home}/lib/log4j.jar"/>
107 <pathelement location="${dependencyfinder.home}/lib/guava.jar"/>
109 <taskdef resource="dependencyfindertasks.properties">
110 <classpath refid="dependencyfinder"/>
112 <jarjardiff destfile="bullet-api-diff.xml"
113 name="jMonkeyEngine3 Bullet Physics API Comparison"
114 oldlabel="Java Version"
115 newlabel="Native Version"
116 level="incompatible">
118 <pathelement location="build/jME3-jbullet.jar"/>
121 <pathelement location="build/jME3-bullet.jar"/>
124 <xslt style="${dependencyfinder.home}/etc/DiffToHTML.xsl"
125 in="bullet-api-diff.xml"
126 out="bullet-api-diff.html" force="true"/>
127 <delete file="bullet-api-diff.xml"/>
130 <target name="-create-folders" description="creates the native headers">
131 <mkdir dir="${bullet.source.dir}"/>
132 <mkdir dir="${bullet.build.dir}"/>
133 <mkdir dir="${bullet.output.dir}"/>
136 <target name="-nativelib-osx" if="isMac">
137 <echo message="Building MacOSX version of native bullet"/>
138 <mkdir dir="${bullet.output.dir}/macosx"/>
139 <cc name="${bullet.osx.compiler}" warnings="none" debug="${bullet.compile.debug}" link="shared" outfile="${bullet.output.dir}/macosx/${bullet.library.name}" objdir="${bullet.build.dir}">
140 <fileset dir="${bullet.source.dir}">
141 <include name="*.cpp">
144 <includepath path="${bullet.osx.java.include}"/>
145 <includepath path="${bullet.bullet.include}"/>
146 <compilerarg value="-syslibroot ${bullet.osx.syslibroot}"/>
147 <compilerarg value="-arch"/>
148 <compilerarg value="ppc"/>
149 <compilerarg value="-arch"/>
150 <compilerarg value="i386"/>
151 <compilerarg value="-arch"/>
152 <compilerarg value="x86_64"/>
153 <linker name="${bullet.osx.compiler}">
154 <!--libset dir="${bullet.folder}/src/BulletSoftBody" libs="BulletSoftBody"/-->
155 <libset dir="${bullet.folder}/src/BulletMultiThreaded" libs="BulletMultiThreaded"/>
156 <libset dir="${bullet.folder}/src/BulletDynamics" libs="BulletDynamics"/>
157 <libset dir="${bullet.folder}/src/BulletCollision" libs="BulletCollision"/>
158 <libset dir="${bullet.folder}/src/LinearMath" libs="LinearMath"/>
159 <linkerarg value="-arch"/>
160 <linkerarg value="ppc"/>
161 <linkerarg value="-arch"/>
162 <linkerarg value="i386"/>
163 <linkerarg value="-arch"/>
164 <linkerarg value="x86_64"/>
167 <move file="${bullet.output.dir}/macosx/lib${bullet.library.name}.dylib" tofile="${bullet.output.dir}/macosx/lib${bullet.library.name}.jnilib" failonerror="true" verbose="true"/>
168 <delete file="${bullet.output.dir}/macosx/history.xml"/>
171 <target name="-nativelib-linux" if="isLinux">
172 <echo message="Building Linux version of native bullet"/>
173 <mkdir dir="${bullet.output.dir}/linux"/>
174 <cc name="${bullet.linux.compiler}" warnings="severe" debug="${bullet.compile.debug}" link="shared" outfile="${bullet.output.dir}/linux/${bullet.library.name}" objdir="${bullet.build.dir}">
175 <fileset dir="${bullet.source.dir}">
176 <include name="*.cpp">
179 <includepath path="${bullet.java.include}"/>
180 <includepath path="${bullet.java.include}/linux"/>
181 <includepath path="${bullet.bullet.include}"/>
182 <!--compilerarg value="-m32"/-->
183 <!--compilerarg value="-static-libgcc"/-->
184 <compilerarg value="-fPIC"/>
185 <linker name="${bullet.linux.compiler}">
186 <!-- linkerarg value="-static-libgcc"/ -->
187 <libset dir="${bullet.folder}/src/BulletMultiThreaded" libs="BulletMultiThreaded"/>
188 <libset dir="${bullet.folder}/src/BulletDynamics" libs="BulletDynamics"/>
189 <libset dir="${bullet.folder}/src/BulletCollision" libs="BulletCollision"/>
190 <libset dir="${bullet.folder}/src/LinearMath" libs="LinearMath"/>
193 <delete file="${bullet.output.dir}/linux/history.xml"/>
196 <target name="-nativelib-solaris" if="isSolaris">
197 <echo message="Building Solaris version of native bullet"/>
198 <mkdir dir="${bullet.output.dir}/linux"/>
199 <cc name="${bullet.solaris.compiler}" warnings="severe" debug="${bullet.compile.debug}" link="shared" outfile="${bullet.output.dir}/solaris/${bullet.library.name}" objdir="${bullet.build.dir}">
200 <fileset dir="${bullet.source.dir}">
201 <include name="*.cpp">
204 <includepath path="${bullet.java.include}"/>
205 <includepath path="${bullet.java.include}/solaris"/>
206 <includepath path="${bullet.bullet.include}"/>
207 <!--compilerarg value="-m32"/-->
208 <compilerarg value="-m32"/>
209 <compilerarg value="-fno-strict-aliasing"/>
210 <compilerarg value="-pthread"/>
211 <compilerarg value="-fPIC"/>
212 <compilerarg value="-D_REENTRANT"/>
213 <compilerarg value="-static-libstdc++"/>
214 <compilerarg value="-static-libgcc"/>
215 <compilerarg value="-D_REENTRANT"/>
216 <linker name="${bullet.solaris.compiler}">
217 <linkerarg value="-R/usr/sfw/lib"/>
218 <libset dir="${bullet.folder}/src/BulletMultiThreaded" libs="BulletMultiThreaded"/>
219 <libset dir="${bullet.folder}/src/BulletDynamics" libs="BulletDynamics"/>
220 <libset dir="${bullet.folder}/src/BulletCollision" libs="BulletCollision"/>
221 <libset dir="${bullet.folder}/src/LinearMath" libs="LinearMath"/>
224 <delete file="${bullet.output.dir}/solaris/history.xml"/>
227 <target name="-nativelib-windows" if="isWindows">
228 <echo message="Building Windows version of native bullet"/>
229 <mkdir dir="${bullet.output.dir}/windows"/>
230 <cc multithreaded="" name="${bullet.windows.compiler}" warnings="none" debug="${bullet.compile.debug}" outtype="shared" outfile="${bullet.output.dir}/windows/${bullet.library.name}" objdir="${bullet.build.dir}">
231 <fileset dir="${bullet.source.dir}">
232 <include name="*.cpp">
235 <includepath path="${bullet.java.include}"/>
236 <includepath path="${bullet.java.include}/win32"/>
237 <includepath path="${bullet.bullet.include}"/>
238 <!--compilerarg value="-m32"/-->
239 <linker name="${bullet.windows.compiler}" debug="${bullet.compile.debug}" >
240 <linkerarg value="-o${bullet.library.name}.dll" />
241 <linkerarg value="--kill-at" />
242 <linkerarg value="-static"/>
243 <libset dir="${bullet.folder}/lib" libs="BulletMultiThreaded,BulletDynamics,BulletCollision,LinearMath"/>
246 <delete file="${bullet.output.dir}/windows/history.xml"/>