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"/>
95 <class name="projectkyoto.jme3.mmd.nativelib.SkinUtil"/>
99 <!-- compares the API of native bullet and java version-->
100 <target name="bullet-api-diff">
101 <echo message="Comparing bullet and jbullet API"/>
102 <property name="dependencyfinder.home" value="lib/antlibs/depfinder"/>
103 <path id="dependencyfinder">
104 <pathelement location="${dependencyfinder.home}/classes"/>
105 <pathelement location="${dependencyfinder.home}/lib/DependencyFinder.jar"/>
106 <pathelement location="${dependencyfinder.home}/lib/jakarta-oro.jar"/>
107 <pathelement location="${dependencyfinder.home}/lib/log4j.jar"/>
108 <pathelement location="${dependencyfinder.home}/lib/guava.jar"/>
110 <taskdef resource="dependencyfindertasks.properties">
111 <classpath refid="dependencyfinder"/>
113 <jarjardiff destfile="bullet-api-diff.xml"
114 name="jMonkeyEngine3 Bullet Physics API Comparison"
115 oldlabel="Java Version"
116 newlabel="Native Version"
117 level="incompatible">
119 <pathelement location="build/jME3-jbullet.jar"/>
122 <pathelement location="build/jME3-bullet.jar"/>
125 <xslt style="${dependencyfinder.home}/etc/DiffToHTML.xsl"
126 in="bullet-api-diff.xml"
127 out="bullet-api-diff.html" force="true"/>
128 <delete file="bullet-api-diff.xml"/>
131 <target name="-create-folders" description="creates the native headers">
132 <mkdir dir="${bullet.source.dir}"/>
133 <mkdir dir="${bullet.build.dir}"/>
134 <mkdir dir="${bullet.output.dir}"/>
137 <target name="-nativelib-osx" if="isMac">
138 <echo message="Building MacOSX version of native bullet"/>
139 <mkdir dir="${bullet.output.dir}/macosx"/>
140 <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}">
141 <fileset dir="${bullet.source.dir}">
142 <include name="*.cpp">
145 <includepath path="${bullet.osx.java.include}"/>
146 <includepath path="${bullet.bullet.include}"/>
147 <compilerarg value="-syslibroot ${bullet.osx.syslibroot}"/>
148 <!-- <compilerarg value="-arch"/>-->
149 <!-- <compilerarg value="ppc"/>-->
150 <compilerarg value="-arch"/>
151 <compilerarg value="i386"/>
152 <compilerarg value="-arch"/>
153 <compilerarg value="x86_64"/>
154 <linker name="${bullet.osx.compiler}">
155 <libset dir="${bullet.folder}/src/BulletSoftBody" libs="BulletSoftBody"/>
156 <libset dir="${bullet.folder}/src/BulletMultiThreaded" libs="BulletMultiThreaded"/>
157 <libset dir="${bullet.folder}/src/BulletDynamics" libs="BulletDynamics"/>
158 <libset dir="${bullet.folder}/src/BulletCollision" libs="BulletCollision"/>
159 <libset dir="${bullet.folder}/src/LinearMath" libs="LinearMath"/>
160 <!-- <linkerarg value="-arch"/>-->
161 <!-- <linkerarg value="ppc"/>-->
162 <linkerarg value="-arch"/>
163 <linkerarg value="i386"/>
164 <linkerarg value="-arch"/>
165 <linkerarg value="x86_64"/>
168 <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"/>
169 <delete file="${bullet.output.dir}/macosx/history.xml"/>
172 <target name="-nativelib-linux" if="isLinux">
173 <echo message="Building Linux version of native bullet"/>
174 <mkdir dir="${bullet.output.dir}/linux"/>
175 <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}">
176 <fileset dir="${bullet.source.dir}">
177 <include name="*.cpp">
180 <includepath path="${bullet.java.include}"/>
181 <includepath path="${bullet.java.include}/linux"/>
182 <includepath path="${bullet.bullet.include}"/>
183 <!--compilerarg value="-m32"/-->
184 <compilerarg value="-m32"/>
185 <compilerarg value="-static-libgcc"/>
186 <linker name="${bullet.linux.compiler}">
187 <!-- linkerarg value="-static-libgcc"/ -->
188 <libset dir="${bullet.folder}/src/BulletMultiThreaded" libs="BulletMultiThreaded"/>
189 <libset dir="${bullet.folder}/src/BulletDynamics" libs="BulletDynamics"/>
190 <libset dir="${bullet.folder}/src/BulletCollision" libs="BulletCollision"/>
191 <libset dir="${bullet.folder}/src/LinearMath" libs="LinearMath"/>
194 <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="-m64"/>
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 <linkerarg value="-m64"/>
219 <libset dir="${bullet.folder}/src/BulletMultiThreaded" libs="BulletMultiThreaded"/>
220 <libset dir="${bullet.folder}/src/BulletDynamics" libs="BulletDynamics"/>
221 <libset dir="${bullet.folder}/src/BulletCollision" libs="BulletCollision"/>
222 <libset dir="${bullet.folder}/src/LinearMath" libs="LinearMath"/>
225 <delete file="${bullet.output.dir}/solaris/history.xml"/>
228 <target name="-nativelib-windows" if="isWindows">
229 <echo message="Building Windows version of native bullet"/>
230 <mkdir dir="${bullet.output.dir}/windows"/>
231 <cc multithreaded="true" name="${bullet.windows.compiler}" warnings="none" debug="${bullet.compile.debug}" outtype="shared" outfile="${bullet.output.dir}/windows/${bullet.library.name}" objdir="${bullet.build.dir}">
232 <fileset dir="${bullet.source.dir}">
233 <include name="*.cpp">
236 <includepath path="${bullet.java.include}"/>
237 <includepath path="${bullet.java.include}/win32"/>
238 <includepath path="${bullet.bullet.include}"/>
239 <includepath path="src/bullet/native"/>
240 <!--compilerarg value="-m32"/-->
241 <!-- compilerarg value="-static-libgcc -static-libstdc++"/ -->
242 <linker name="${bullet.windows.compiler}" debug="${bullet.compile.debug}" >
243 <linkerarg value="-o${bullet.library.name}.dll" />
244 <linkerarg value="--kill-at" />
245 <linkerarg value="-static"/>
246 <libset dir="${bullet.folder}/lib/Release" libs="BulletMultiThreaded,BulletDynamics,BulletCollision,LinearMath"/>
249 <delete file="${bullet.output.dir}/windows/history.xml"/>