Imported Upstream version 2.4.2+dfsg2
Gabriele Giacone
13 years ago
0 | <project name="LWJGL" default="all" basedir="."> | |
1 | ||
2 | <property name="build.sysclasspath" value="last" /> | |
3 | ||
4 | <import file="platform_build/build-definitions.xml"/> | |
5 | <import file="platform_build/build-generator.xml"/> | |
6 | <import file="platform_build/build-applet.xml"/> | |
7 | <import file="platform_build/build-webstart.xml"/> | |
8 | ||
9 | <!-- ================================================================== --> | |
10 | <!-- Everything below this line is targets. --> | |
11 | <!-- Do not modify, unless you know what you're doing --> | |
12 | <!-- ================================================================== --> | |
13 | ||
14 | <!-- ================================================================== --> | |
15 | <!-- Initialize build --> | |
16 | <!-- ================================================================== --> | |
17 | <target name="-initialize"> | |
18 | <mkdir dir="${lwjgl.bin}" taskname="initialiazing bin folder" /> | |
19 | <mkdir dir="${lwjgl.bin}/lwjgl" taskname="initialiazing bin folder" /> | |
20 | <mkdir dir="${lwjgl.lib}" taskname="initialiazing lib folder" /> | |
21 | <mkdir dir="${lwjgl.dist}" taskname="initialiazing dist folder" /> | |
22 | <mkdir dir="${lwjgl.docs}/javadoc" taskname="initialiazing docs folder" /> | |
23 | <mkdir dir="${lwjgl.res}" taskname="initialiazing res folder" /> | |
24 | <mkdir dir="${lwjgl.temp}" taskname="initialiazing temp folder" /> | |
25 | <mkdir dir="${lwjgl.temp}/jar" taskname="initialiazing temp/jar folder" /> | |
26 | <mkdir dir="${lwjgl.temp}/doc" taskname="initialiazing temp/doc folder" /> | |
27 | <mkdir dir="${lwjgl.temp}/res" taskname="initialiazing temp/res folder" /> | |
28 | <mkdir dir="${lwjgl.temp}/native" taskname="initialiazing temp/native folder" /> | |
29 | <mkdir dir="${lwjgl.temp}/native/windows" taskname="initialiazing temp/windows folder" /> | |
30 | <mkdir dir="${lwjgl.temp}/native/linux" taskname="initialiazing temp/linux folder" /> | |
31 | <mkdir dir="${lwjgl.temp}/native/macosx" taskname="initialiazing temp/macosx folder" /> | |
32 | <mkdir dir="${lwjgl.temp}/native/solaris" taskname="initialiazing temp/solaris folder" /> | |
33 | </target> | |
34 | ||
35 | <!-- Cleans up any files created during the execution of this script --> | |
36 | <target name="clean" description="Cleans the diectories controlled by this ant script" depends="clean-generated"> | |
37 | <delete dir="${lwjgl.temp}" quiet="true" failonerror="false" taskname="cleaning temp folder" /> | |
38 | <delete dir="${lwjgl.docs}/javadoc" quiet="true" failonerror="false" taskname="cleaning javadoc folder" /> | |
39 | <delete dir="${lwjgl.bin}" quiet="true" failonerror="false" taskname="cleaning bin folder" /> | |
40 | </target> | |
41 | ||
42 | <!-- Creates a distribution of LWJGL --> | |
43 | <target name="release" description="Creates a distribution of LWJGL using supplied native binaries"> | |
44 | <!-- Warn user --> | |
45 | <echo message="Before running the release target, please manually compile all platforms and place required files in ${lwjgl.lib}/windows, ${lwjgl.lib}/linux and ${lwjgl.lib}/macosx${line.separator}Missing files will result in a successfull built, but with incomplete release zips"/> | |
46 | <input | |
47 | message="All data in the ${lwjgl.dist} folder will be deleted. Continue? " | |
48 | validargs="yes,no" | |
49 | addproperty="do.delete" | |
50 | /> | |
51 | <condition property="do.abort"> | |
52 | <equals arg1="no" arg2="${do.delete}"/> | |
53 | </condition> | |
54 | <fail if="do.abort">Build aborted by user.</fail> | |
55 | ||
56 | <!-- prepare --> | |
57 | <delete dir="${lwjgl.dist}" quiet="true" failonerror="false" /> | |
58 | <antcall target="clean" /> | |
59 | <antcall target="-initialize" /> | |
60 | ||
61 | <!-- compile and create jars --> | |
62 | <antcall target="generate-debug"/> | |
63 | <antcall target="compile" /> | |
64 | <antcall target="-createdebugjars" /> | |
65 | <!-- Generator will skip all templates if we don't clean --> | |
66 | <delete dir="${lwjgl.bin}" quiet="true" failonerror="false" taskname="cleaning bin folder" /> | |
67 | <mkdir dir="${lwjgl.bin}" taskname="initialiazing bin folder" /> | |
68 | <antcall target="generate-all"/> | |
69 | <antcall target="compile" /> | |
70 | <antcall target="-createjars" /> | |
71 | <antcall target="-jars_NoDEP" /> | |
72 | <antcall target="javadoc" /> | |
73 | <antcall target="applet-release" /> | |
74 | ||
75 | <!-- copy resources to res folder --> | |
76 | <copy todir="${lwjgl.temp}/res"> | |
77 | <fileset dir="res"/> | |
78 | </copy> | |
79 | ||
80 | <!-- copy docs --> | |
81 | <copy todir="${lwjgl.temp}/doc"> | |
82 | <fileset dir="${lwjgl.docs}"> | |
83 | <patternset refid="lwjgl-docs.fileset" /> | |
84 | </fileset> | |
85 | </copy> | |
86 | ||
87 | <!-- create distribution from files in libs/ and temp/ --> | |
88 | <antcall target="-distribution_javadoc" /> | |
89 | <antcall target="-distribution_source" /> | |
90 | <antcall target="-distribute" /> | |
91 | </target> | |
92 | ||
93 | <target name="all" description="Creates the Java archives and the natives for the current platform" depends="jars, compile_native"/> | |
94 | ||
95 | <!-- Create ONLY the jar archives --> | |
96 | <target name="jars" description="Creates the Java archives ONLY and places them in libs/" depends="-initialize, generate-all, compile, -createjars"> | |
97 | <antcall target="-jars_NoDEP" /> | |
98 | </target> | |
99 | ||
100 | <target name="-jars_NoDEP"> | |
101 | <move todir="libs/"> | |
102 | <fileset dir="${lwjgl.temp}/jar"> | |
103 | <include name="*.jar"/> | |
104 | </fileset> | |
105 | </move> | |
106 | </target> | |
107 | ||
108 | <!-- Packages the java files --> | |
109 | <target name="-createdebugjars"> | |
110 | <!-- Create lwjgl.jar --> | |
111 | <jar destfile="${lwjgl.temp}/jar/lwjgl-debug.jar" taskname="lwjgl-debug.jar"> | |
112 | <fileset refid="lwjgl.fileset" /> | |
113 | <manifest> | |
114 | <attribute name="Sealed" value="true"/> | |
115 | </manifest> | |
116 | </jar> | |
117 | </target> | |
118 | ||
119 | <!-- Packages the java files --> | |
120 | <target name="-createjars"> | |
121 | <!-- Create lwjgl.jar --> | |
122 | <jar destfile="${lwjgl.temp}/jar/lwjgl.jar" taskname="lwjgl.jar"> | |
123 | <fileset refid="lwjgl.fileset" /> | |
124 | <manifest> | |
125 | <attribute name="Sealed" value="true"/> | |
126 | <attribute name="Trusted-Library" value="true"/> | |
127 | </manifest> | |
128 | </jar> | |
129 | ||
130 | <!-- Create lwjgl_util_applet.jar --> | |
131 | <jar destfile="${lwjgl.temp}/jar/lwjgl_util_applet.jar" taskname="lwjgl_util_applet.jar"> | |
132 | <fileset refid="lwjgl_util_applet.fileset" /> | |
133 | <manifest> | |
134 | <attribute name="Sealed" value="true"/> | |
135 | <attribute name="Trusted-Library" value="true"/> | |
136 | </manifest> | |
137 | </jar> | |
138 | ||
139 | <!-- Create lwjgl_test.jar --> | |
140 | <jar destfile="${lwjgl.temp}/jar/lwjgl_test.jar" taskname="lwjgl_test.jar"> | |
141 | <fileset refid="lwjgl_test.fileset" /> | |
142 | <fileset refid="lwjgl_test_extra.fileset" /> | |
143 | </jar> | |
144 | ||
145 | <!-- Create lwjgl_util.jar --> | |
146 | <jar destfile="${lwjgl.temp}/jar/lwjgl_util.jar" taskname="lwjgl_util.jar"> | |
147 | <fileset refid="lwjgl_util.fileset" /> | |
148 | </jar> | |
149 | </target> | |
150 | ||
151 | <!-- Distributes files --> | |
152 | <target name="-distribute"> | |
153 | <delete> | |
154 | <fileset dir="${lwjgl.temp}/native/" includes="**/*"/> | |
155 | </delete> | |
156 | ||
157 | <copy todir="${lwjgl.temp}/jar"> | |
158 | <fileset dir="${lwjgl.lib}/" includes="*.jar"/> | |
159 | </copy> | |
160 | <copy todir="${lwjgl.temp}/native/windows"> | |
161 | <fileset dir="${lwjgl.lib}/windows"> | |
162 | <patternset refid="lwjgl-windows.fileset" /> | |
163 | </fileset> | |
164 | </copy> | |
165 | <copy todir="${lwjgl.temp}/native/linux"> | |
166 | <fileset dir="${lwjgl.lib}/linux"> | |
167 | <patternset refid="lwjgl-linux.fileset" /> | |
168 | </fileset> | |
169 | </copy> | |
170 | <copy todir="${lwjgl.temp}/native/macosx"> | |
171 | <fileset dir="${lwjgl.lib}/macosx"> | |
172 | <patternset refid="lwjgl-macosx.fileset" /> | |
173 | </fileset> | |
174 | </copy> | |
175 | <copy todir="${lwjgl.temp}/native/solaris"> | |
176 | <fileset dir="${lwjgl.lib}/solaris"> | |
177 | <patternset refid="lwjgl-solaris.fileset" /> | |
178 | </fileset> | |
179 | </copy> | |
180 | ||
181 | <!-- create base package --> | |
182 | <zip destfile="${lwjgl.dist}/lwjgl-${lwjgl.version}.zip"> | |
183 | <zipfileset dir="${lwjgl.temp}" prefix="lwjgl-${lwjgl.version}/"> | |
184 | <patternset refid="lwjgl_base"/> | |
185 | </zipfileset> | |
186 | </zip> | |
187 | ||
188 | <!-- create applet package --> | |
189 | <zip destfile="${lwjgl.dist}/lwjgl_applet-${lwjgl.version}.zip"> | |
190 | <zipfileset dir="." prefix="lwjgl_applet-${lwjgl.version}/"> | |
191 | <patternset refid="lwjgl_applet"/> | |
192 | </zipfileset> | |
193 | </zip> | |
194 | </target> | |
195 | ||
196 | <!-- Creates a versioned distribution of javadocs --> | |
197 | <target name="-distribution_javadoc"> | |
198 | <zip destfile="${lwjgl.dist}/lwjgl-docs-${lwjgl.version}.zip" basedir="${lwjgl.docs}" includes="javadoc/**" /> | |
199 | </target> | |
200 | ||
201 | <!-- Creates a versioned distribution of the source code --> | |
202 | <target name="-distribution_source"> | |
203 | <zip destfile="${lwjgl.dist}/lwjgl-source-${lwjgl.version}.zip"> | |
204 | <fileset refid="lwjgl.source.fileset" /> | |
205 | </zip> | |
206 | </target> | |
207 | ||
208 | <!-- Generates the native headers from source files --> | |
209 | <target name="headers" description="invokes javah on java classes" depends="compile"> | |
210 | <javah classpath="${lwjgl.bin}" destdir="${lwjgl.src.native}/linux" force="yes"> | |
211 | <class name="org.lwjgl.LinuxSysImplementation" /> | |
212 | <class name="org.lwjgl.opengl.LinuxEvent" /> | |
213 | <class name="org.lwjgl.opengl.LinuxMouse" /> | |
214 | <class name="org.lwjgl.opengl.LinuxKeyboard" /> | |
215 | <class name="org.lwjgl.opengl.LinuxDisplay" /> | |
216 | <class name="org.lwjgl.opengl.LinuxPeerInfo" /> | |
217 | <class name="org.lwjgl.opengl.LinuxPbufferPeerInfo" /> | |
218 | <class name="org.lwjgl.opengl.LinuxDisplayPeerInfo" /> | |
219 | <class name="org.lwjgl.opengl.LinuxAWTGLCanvasPeerInfo" /> | |
220 | <class name="org.lwjgl.opengl.LinuxContextImplementation" /> | |
221 | <class name="org.lwjgl.opengl.LinuxCanvasImplementation" /> | |
222 | </javah> | |
223 | ||
224 | <javah classpath="${lwjgl.bin}" destdir="${lwjgl.src.native}/windows" force="yes"> | |
225 | <class name="org.lwjgl.opengl.WindowsKeyboard" /> | |
226 | <class name="org.lwjgl.opengl.WindowsPbufferPeerInfo" /> | |
227 | <class name="org.lwjgl.opengl.WindowsDisplay" /> | |
228 | <class name="org.lwjgl.opengl.WindowsRegistry" /> | |
229 | <class name="org.lwjgl.WindowsSysImplementation" /> | |
230 | <class name="org.lwjgl.opengl.WindowsAWTGLCanvasPeerInfo" /> | |
231 | <class name="org.lwjgl.opengl.WindowsPeerInfo" /> | |
232 | <class name="org.lwjgl.opengl.WindowsDisplayPeerInfo" /> | |
233 | <class name="org.lwjgl.opengl.WindowsContextImplementation" /> | |
234 | </javah> | |
235 | ||
236 | <javah classpath="${lwjgl.bin}" destdir="${lwjgl.src.native}/macosx" force="yes"> | |
237 | <class name="org.lwjgl.MacOSXSysImplementation" /> | |
238 | <class name="org.lwjgl.opengl.MacOSXMouseEventQueue" /> | |
239 | <class name="org.lwjgl.opengl.MacOSXCanvasPeerInfo" /> | |
240 | <class name="org.lwjgl.opengl.MacOSXPeerInfo" /> | |
241 | <class name="org.lwjgl.opengl.MacOSXPbufferPeerInfo" /> | |
242 | <class name="org.lwjgl.opengl.MacOSXDisplay" /> | |
243 | <class name="org.lwjgl.opengl.MacOSXContextImplementation" /> | |
244 | </javah> | |
245 | ||
246 | <javah classpath="${lwjgl.bin}" destdir="${lwjgl.src.headers}" force="yes"> | |
247 | <class name="org.lwjgl.opengl.AWTSurfaceLock" /> | |
248 | <class name="org.lwjgl.DefaultSysImplementation" /> | |
249 | <class name="org.lwjgl.input.Cursor" /> | |
250 | <class name="org.lwjgl.input.Keyboard" /> | |
251 | <class name="org.lwjgl.input.Mouse" /> | |
252 | <class name="org.lwjgl.openal.AL" /> | |
253 | <class name="org.lwjgl.opengl.GLContext" /> | |
254 | <class name="org.lwjgl.opengl.Pbuffer" /> | |
255 | </javah> | |
256 | </target> | |
257 | ||
258 | <target name="touch-version"> | |
259 | <touch file="${lwjgl.src.native}/windows/org_lwjgl_opengl_Display.c"/> | |
260 | <touch file="${lwjgl.src.native}/linux/org_lwjgl_opengl_Display.c"/> | |
261 | <touch file="${lwjgl.src.native}/macosx/org_lwjgl_opengl_Display.m"/> | |
262 | </target> | |
263 | ||
264 | <target name="version-mismatch"> | |
265 | <loadfile srcfile="${lwjgl.src}/java/org/lwjgl/WindowsSysImplementation.java" property="lwjgl.java.windows.version"> | |
266 | <filterchain> | |
267 | <tokenfilter> | |
268 | <containsstring contains="JNI_VERSION ="/> | |
269 | </tokenfilter> | |
270 | </filterchain> | |
271 | </loadfile> | |
272 | <loadfile srcfile="${lwjgl.src}/java/org/lwjgl/LinuxSysImplementation.java" property="lwjgl.java.linux.version"> | |
273 | <filterchain> | |
274 | <tokenfilter> | |
275 | <containsstring contains="JNI_VERSION ="/> | |
276 | </tokenfilter> | |
277 | </filterchain> | |
278 | </loadfile> | |
279 | <loadfile srcfile="${lwjgl.src}/java/org/lwjgl/MacOSXSysImplementation.java" property="lwjgl.java.macosx.version"> | |
280 | <filterchain> | |
281 | <tokenfilter> | |
282 | <containsstring contains="JNI_VERSION ="/> | |
283 | </tokenfilter> | |
284 | </filterchain> | |
285 | </loadfile> | |
286 | <loadfile srcfile="${lwjgl.src.native}/windows/org_lwjgl_WindowsSysImplementation.h" property="lwjgl.native.windows.version"> | |
287 | <filterchain> | |
288 | <tokenfilter> | |
289 | <containsstring contains="#define org_lwjgl_WindowsSysImplementation_JNI_VERSION"/> | |
290 | </tokenfilter> | |
291 | </filterchain> | |
292 | </loadfile> | |
293 | <loadfile srcfile="${lwjgl.src.native}/linux/org_lwjgl_LinuxSysImplementation.h" property="lwjgl.native.linux.version"> | |
294 | <filterchain> | |
295 | <tokenfilter> | |
296 | <containsstring contains="#define org_lwjgl_LinuxSysImplementation_JNI_VERSION"/> | |
297 | </tokenfilter> | |
298 | </filterchain> | |
299 | </loadfile> | |
300 | <loadfile srcfile="${lwjgl.src.native}/macosx/org_lwjgl_MacOSXSysImplementation.h" property="lwjgl.native.macosx.version"> | |
301 | <filterchain> | |
302 | <tokenfilter> | |
303 | <containsstring contains="#define org_lwjgl_MacOSXSysImplementation_JNI_VERSION"/> | |
304 | </tokenfilter> | |
305 | </filterchain> | |
306 | </loadfile> | |
307 | <echo> | |
308 | lwjgl.java.windows.version = ${lwjgl.java.windows.version} | |
309 | lwjgl.native.windows.version = ${lwjgl.native.windows.version} | |
310 | lwjgl.java.linux.version = ${lwjgl.java.linux.version} | |
311 | lwjgl.native.linux.version = ${lwjgl.native.linux.version} | |
312 | lwjgl.java.macosx.version = ${lwjgl.java.macosx.version} | |
313 | lwjgl.native.macosx.version = ${lwjgl.native.macosx.version} | |
314 | </echo> | |
315 | </target> | |
316 | ||
317 | <macrodef name="version-check"> | |
318 | <attribute name="platform"/> | |
319 | <sequential> | |
320 | <java classname="org.lwjgl.test.NativeTest" logError="false" resultproperty="nativetest.res" outputproperty="nativetest.out" errorproperty="nativetest.err" fork="true"> | |
321 | <jvmarg value="-Djava.library.path=libs/@{platform}"/> | |
322 | <classpath> | |
323 | <pathelement path="${lwjgl.bin}"/> | |
324 | <pathelement path="${java.class.path}"/> | |
325 | </classpath> | |
326 | </java> | |
327 | ||
328 | <fail message="Unable to load native library: ${nativetest.err}"> | |
329 | <condition> | |
330 | <not> | |
331 | <equals arg1="OK" arg2="${nativetest.out}"/> | |
332 | </not> | |
333 | </condition> | |
334 | </fail> | |
335 | ||
336 | <echo message="Successfully executed NativeTest"/> | |
337 | </sequential> | |
338 | </macrodef> | |
339 | ||
340 | <!-- Compiles the Java source code --> | |
341 | <target name="compile" description="Compiles the java source code" depends="-initialize"> | |
342 | <javac debug="yes" destdir="${lwjgl.bin}" source="1.4" target="1.4" classpath="${lwjgl.lib}/jinput.jar:${lwjgl.lib}/AppleJavaExtensions.jar" taskname="core"> | |
343 | <src path="${lwjgl.src}/java/"/> | |
344 | <src path="${lwjgl.src}/generated/"/> | |
345 | <include name="org/lwjgl/*.java"/> | |
346 | <include name="org/lwjgl/input/**"/> | |
347 | <include name="org/lwjgl/opengl/**"/> | |
348 | <include name="org/lwjgl/openal/**"/> | |
349 | <include name="org/lwjgl/util/**"/> | |
350 | <exclude name="org/lwjgl/util/generator/**"/> | |
351 | </javac> | |
352 | <javac debug="yes" srcdir="${lwjgl.src}/java/" destdir="${lwjgl.bin}" includes="org/lwjgl/test/**" source="1.4" target="1.4" taskname="test" /> | |
353 | <javac debug="yes" srcdir="${lwjgl.src}/java/" destdir="${lwjgl.bin}" includes="org/lwjgl/examples/**" source="1.4" target="1.4" taskname="examples" /> | |
354 | </target> | |
355 | ||
356 | <target name="compile_native" depends="headers, touch-version, version-mismatch" description="Compiles the native files"> | |
357 | <condition property="lwjgl.platform.windows"> | |
358 | <os family="windows" /> | |
359 | </condition> | |
360 | <antcall target="-compile_native_win32" /> | |
361 | ||
362 | <condition property="lwjgl.platform.linux"> | |
363 | <os name="Linux" /> | |
364 | </condition> | |
365 | <antcall target="-compile_native_linux" /> | |
366 | ||
367 | <condition property="lwjgl.platform.solaris"> | |
368 | <os name="SunOS" /> | |
369 | </condition> | |
370 | <antcall target="-compile_native_solaris" /> | |
371 | ||
372 | <condition property="lwjgl.platform.macosx"> | |
373 | <os name="Mac OS X" /> | |
374 | </condition> | |
375 | <antcall target="-compile_native_macosx" /> | |
376 | </target> | |
377 | ||
378 | <!-- Compiles LWJGL on Win32 platforms --> | |
379 | <target name="-compile_native_win32" if="lwjgl.platform.windows"> | |
380 | <ant antfile="platform_build/windows_ant/build.xml" inheritAll="false"/> | |
381 | <copy todir="${lwjgl.lib}/windows"> | |
382 | <fileset dir="${lwjgl.bin}/lwjgl" includes="lwjgl*.dll"/> | |
383 | </copy> | |
384 | <version-check platform="windows"/> | |
385 | </target> | |
386 | ||
387 | <!-- Compiles LWJGL on Linux platforms --> | |
388 | <target name="-compile_native_linux" if="lwjgl.platform.linux"> | |
389 | <ant antfile="platform_build/linux_ant/build.xml" inheritAll="false"/> | |
390 | <copy todir="${lwjgl.lib}/linux"> | |
391 | <fileset dir="${lwjgl.bin}/lwjgl" includes="liblwjgl*.so"/> | |
392 | </copy> | |
393 | <!-- headless issues <version-check platform="linux"/> --> | |
394 | </target> | |
395 | ||
396 | <!-- Compiles LWJGL on solaris platforms --> | |
397 | <target name="-compile_native_solaris" if="lwjgl.platform.solaris"> | |
398 | <!-- Reusing the linux ant task, but copy the output to solaris --> | |
399 | <ant antfile="platform_build/linux_ant/build.xml" inheritAll="false"/> | |
400 | <copy todir="${lwjgl.lib}/solaris"> | |
401 | <fileset dir="${lwjgl.bin}/lwjgl" includes="liblwjgl*.so"/> | |
402 | </copy> | |
403 | <version-check platform="solaris"/> | |
404 | </target> | |
405 | ||
406 | <!-- Compiles LWJGL on Mac platforms --> | |
407 | <target name="-compile_native_macosx" if="lwjgl.platform.macosx"> | |
408 | <ant antfile="platform_build/macosx_ant/build.xml" inheritAll="false"/> | |
409 | <copy file="${lwjgl.bin}/lwjgl/liblwjgl.jnilib" todir="${lwjgl.lib}/macosx"/> | |
410 | <version-check platform="macosx"/> | |
411 | </target> | |
412 | ||
413 | <target name="repack200" description="Pack200-repack a jar file"> | |
414 | <pack200 src="${input}" destfile="${output}" repack="true"/> | |
415 | </target> | |
416 | ||
417 | <target name="pack200" description="Pack200 a jar file"> | |
418 | <pack200 src="${input}" destfile="${output}"/> | |
419 | </target> | |
420 | ||
421 | <target name="lzma" description="LZMA compress a file"> | |
422 | <java fork="true" classname="SevenZip.LzmaAlone"> | |
423 | <classpath> | |
424 | <pathelement location="platform_build/JLzma.jar"/> | |
425 | </classpath> | |
426 | <jvmarg value="-Xmx512m"/> | |
427 | <arg value="e"/> | |
428 | <arg value="${input}"/> | |
429 | <arg value="${output}"/> | |
430 | </java> | |
431 | </target> | |
432 | ||
433 | <target name="compress-sign-class"> | |
434 | <antcall target="repack200"> | |
435 | <param name="input" value="${dir}${jarfile}.jar"/> | |
436 | <param name="output" value="${dir}${jarfile}-repack.jar"/> | |
437 | </antcall> | |
438 | <signjar jar="${dir}${jarfile}-repack.jar" alias="${alias}" keystore="${keystore}" storepass="${password}"/> | |
439 | <antcall target="pack200"> | |
440 | <param name="input" value="${dir}${jarfile}-repack.jar"/> | |
441 | <param name="output" value="${dir}${jarfile}.jar.pack"/> | |
442 | </antcall> | |
443 | <antcall target="lzma"> | |
444 | <param name="input" value="${dir}${jarfile}.jar.pack"/> | |
445 | <param name="output" value="${dir}${jarfile}.jar.pack.lzma"/> | |
446 | </antcall> | |
447 | <delete file="${dir}${jarfile}-repack.jar"/> | |
448 | <delete file="${dir}${jarfile}.jar.pack"/> | |
449 | <delete file="${dir}${jarfile}.jar"/> | |
450 | </target> | |
451 | ||
452 | <target name="compress-resource"> | |
453 | <antcall target="lzma"> | |
454 | <param name="input" value="${input}"/> | |
455 | <param name="output" value="${output}"/> | |
456 | </antcall> | |
457 | </target> | |
458 | ||
459 | <target name="applettest" depends="applet"> | |
460 | <exec executable="appletviewer"> | |
461 | <arg value="-J-Djava.security.policy=applet/appletviewer.policy"/> | |
462 | <arg path="applet/applet.html"/> | |
463 | </exec> | |
464 | </target> | |
465 | ||
466 | <target name="runtest" depends="all"> | |
467 | <fail message="test.mainclass is not set. Use 'ant -Dtest.mainclass=<main-class> runtest'" unless="test.mainclass"/> | |
468 | <condition property="native_path" value="libs/windows"> | |
469 | <os family="windows" /> | |
470 | </condition> | |
471 | ||
472 | <condition property="native_path" value="libs/linux"> | |
473 | <or> | |
474 | <os name="Linux" /> | |
475 | <os name="SunOS" /> | |
476 | </or> | |
477 | </condition> | |
478 | ||
479 | <condition property="native_path" value="libs/macosx"> | |
480 | <os name="Mac OS X" /> | |
481 | </condition> | |
482 | <property name="native_path_expanded" location="${native_path}"/> | |
483 | <java classname="${test.mainclass}" classpath="res:${lwjgl.lib}/lwjgl.jar:${lwjgl.lib}/lwjgl_util.jar:${lwjgl.lib}/lwjgl_test.jar:${lwjgl.lib}/jinput.jar" fork="true"> | |
484 | <sysproperty key="org.lwjgl.util.Debug" value="true"/> | |
485 | <sysproperty key="java.library.path" value="${native_path_expanded}"/> | |
486 | <arg line="${args}"/> | |
487 | </java> | |
488 | </target> | |
489 | ||
490 | <!-- Creates the Javadoc --> | |
491 | <target name="javadoc" description="Creates javadoc from java source code"> | |
492 | <javadoc destdir="${lwjgl.docs}/javadoc" classpath="${lwjgl.lib}/jinput.jar" author="true" version="true" use="true" source="1.4" windowtitle="LWJGL API" useexternalfile="true"> | |
493 | <fileset refid="lwjgl.javadoc.fileset" /> | |
494 | <doctitle><![CDATA[<h1>Lightweight Java Game Toolkit</h1>]]></doctitle> | |
495 | <bottom><![CDATA[<i>Copyright © 2002-2009 lwjgl.org. All Rights Reserved.</i>]]></bottom> | |
496 | </javadoc> | |
497 | </target> | |
498 | </project> | |
0 | <project name="LWJGL" default="all" basedir="."> | |
1 | ||
2 | <property name="build.sysclasspath" value="last" /> | |
3 | ||
4 | <import file="platform_build/build-definitions.xml"/> | |
5 | <import file="platform_build/build-generator.xml"/> | |
6 | <import file="platform_build/build-applet.xml"/> | |
7 | <import file="platform_build/build-webstart.xml"/> | |
8 | ||
9 | <!-- ================================================================== --> | |
10 | <!-- Everything below this line is targets. --> | |
11 | <!-- Do not modify, unless you know what you're doing --> | |
12 | <!-- ================================================================== --> | |
13 | ||
14 | <!-- ================================================================== --> | |
15 | <!-- Initialize build --> | |
16 | <!-- ================================================================== --> | |
17 | <target name="-initialize"> | |
18 | <mkdir dir="${lwjgl.bin}" taskname="initialiazing bin folder" /> | |
19 | <mkdir dir="${lwjgl.bin}/lwjgl" taskname="initialiazing bin folder" /> | |
20 | <mkdir dir="${lwjgl.lib}" taskname="initialiazing lib folder" /> | |
21 | <mkdir dir="${lwjgl.dist}" taskname="initialiazing dist folder" /> | |
22 | <mkdir dir="${lwjgl.docs}/javadoc" taskname="initialiazing docs folder" /> | |
23 | <mkdir dir="${lwjgl.res}" taskname="initialiazing res folder" /> | |
24 | <mkdir dir="${lwjgl.temp}" taskname="initialiazing temp folder" /> | |
25 | <mkdir dir="${lwjgl.temp}/jar" taskname="initialiazing temp/jar folder" /> | |
26 | <mkdir dir="${lwjgl.temp}/doc" taskname="initialiazing temp/doc folder" /> | |
27 | <mkdir dir="${lwjgl.temp}/res" taskname="initialiazing temp/res folder" /> | |
28 | <mkdir dir="${lwjgl.temp}/native" taskname="initialiazing temp/native folder" /> | |
29 | <mkdir dir="${lwjgl.temp}/native/windows" taskname="initialiazing temp/windows folder" /> | |
30 | <mkdir dir="${lwjgl.temp}/native/linux" taskname="initialiazing temp/linux folder" /> | |
31 | <mkdir dir="${lwjgl.temp}/native/macosx" taskname="initialiazing temp/macosx folder" /> | |
32 | <mkdir dir="${lwjgl.temp}/native/solaris" taskname="initialiazing temp/solaris folder" /> | |
33 | </target> | |
34 | ||
35 | <!-- Cleans up any files created during the execution of this script --> | |
36 | <target name="clean" description="Cleans the diectories controlled by this ant script" depends="clean-generated"> | |
37 | <delete dir="${lwjgl.temp}" quiet="true" failonerror="false" taskname="cleaning temp folder" /> | |
38 | <delete dir="${lwjgl.docs}/javadoc" quiet="true" failonerror="false" taskname="cleaning javadoc folder" /> | |
39 | <delete dir="${lwjgl.bin}" quiet="true" failonerror="false" taskname="cleaning bin folder" /> | |
40 | </target> | |
41 | ||
42 | <!-- Creates a distribution of LWJGL --> | |
43 | <target name="release" description="Creates a distribution of LWJGL using supplied native binaries"> | |
44 | <!-- Warn user --> | |
45 | <echo message="Before running the release target, please manually compile all platforms and place required files in ${lwjgl.lib}/windows, ${lwjgl.lib}/linux and ${lwjgl.lib}/macosx${line.separator}Missing files will result in a successfull built, but with incomplete release zips"/> | |
46 | <input | |
47 | message="All data in the ${lwjgl.dist} folder will be deleted. Continue? " | |
48 | validargs="yes,no" | |
49 | addproperty="do.delete" | |
50 | /> | |
51 | <condition property="do.abort"> | |
52 | <equals arg1="no" arg2="${do.delete}"/> | |
53 | </condition> | |
54 | <fail if="do.abort">Build aborted by user.</fail> | |
55 | ||
56 | <!-- prepare --> | |
57 | <delete dir="${lwjgl.dist}" quiet="true" failonerror="false" /> | |
58 | <antcall target="clean" /> | |
59 | <antcall target="-initialize" /> | |
60 | ||
61 | <!-- compile and create jars --> | |
62 | <antcall target="generate-debug"/> | |
63 | <antcall target="compile" /> | |
64 | <antcall target="-createdebugjars" /> | |
65 | <!-- Generator will skip all templates if we don't clean --> | |
66 | <delete dir="${lwjgl.bin}" quiet="true" failonerror="false" taskname="cleaning bin folder" /> | |
67 | <mkdir dir="${lwjgl.bin}" taskname="initialiazing bin folder" /> | |
68 | <antcall target="generate-all"/> | |
69 | <antcall target="compile" /> | |
70 | <antcall target="-createjars" /> | |
71 | <antcall target="-jars_NoDEP" /> | |
72 | <antcall target="javadoc" /> | |
73 | <antcall target="applet-release" /> | |
74 | ||
75 | <!-- copy resources to res folder --> | |
76 | <copy todir="${lwjgl.temp}/res"> | |
77 | <fileset dir="res"/> | |
78 | </copy> | |
79 | ||
80 | <!-- copy docs --> | |
81 | <copy todir="${lwjgl.temp}/doc"> | |
82 | <fileset dir="${lwjgl.docs}"> | |
83 | <patternset refid="lwjgl-docs.fileset" /> | |
84 | </fileset> | |
85 | </copy> | |
86 | ||
87 | <!-- create distribution from files in libs/ and temp/ --> | |
88 | <antcall target="-distribution_javadoc" /> | |
89 | <antcall target="-distribution_source" /> | |
90 | <antcall target="-distribute" /> | |
91 | </target> | |
92 | ||
93 | <target name="all" description="Creates the Java archives and the natives for the current platform" depends="jars, compile_native"/> | |
94 | ||
95 | <!-- Create ONLY the jar archives --> | |
96 | <target name="jars" description="Creates the Java archives ONLY and places them in libs/" depends="-initialize, generate-all, compile, -createjars"> | |
97 | <antcall target="-jars_NoDEP" /> | |
98 | </target> | |
99 | ||
100 | <target name="-jars_NoDEP"> | |
101 | <move todir="libs/"> | |
102 | <fileset dir="${lwjgl.temp}/jar"> | |
103 | <include name="*.jar"/> | |
104 | </fileset> | |
105 | </move> | |
106 | </target> | |
107 | ||
108 | <!-- Packages the java files --> | |
109 | <target name="-createdebugjars"> | |
110 | <!-- Create lwjgl.jar --> | |
111 | <jar destfile="${lwjgl.temp}/jar/lwjgl-debug.jar" taskname="lwjgl-debug.jar"> | |
112 | <fileset refid="lwjgl.fileset" /> | |
113 | <manifest> | |
114 | <attribute name="Sealed" value="true"/> | |
115 | </manifest> | |
116 | </jar> | |
117 | </target> | |
118 | ||
119 | <!-- Packages the java files --> | |
120 | <target name="-createjars"> | |
121 | <!-- Create lwjgl.jar --> | |
122 | <jar destfile="${lwjgl.temp}/jar/lwjgl.jar" taskname="lwjgl.jar"> | |
123 | <fileset refid="lwjgl.fileset" /> | |
124 | <manifest> | |
125 | <attribute name="Sealed" value="true"/> | |
126 | <attribute name="Trusted-Library" value="true"/> | |
127 | </manifest> | |
128 | </jar> | |
129 | ||
130 | <!-- Create lwjgl_util_applet.jar --> | |
131 | <jar destfile="${lwjgl.temp}/jar/lwjgl_util_applet.jar" taskname="lwjgl_util_applet.jar"> | |
132 | <fileset refid="lwjgl_util_applet.fileset" /> | |
133 | <manifest> | |
134 | <attribute name="Sealed" value="true"/> | |
135 | <attribute name="Trusted-Library" value="true"/> | |
136 | </manifest> | |
137 | </jar> | |
138 | ||
139 | <!-- Create lwjgl_test.jar --> | |
140 | <jar destfile="${lwjgl.temp}/jar/lwjgl_test.jar" taskname="lwjgl_test.jar"> | |
141 | <fileset refid="lwjgl_test.fileset" /> | |
142 | <fileset refid="lwjgl_test_extra.fileset" /> | |
143 | </jar> | |
144 | ||
145 | <!-- Create lwjgl_util.jar --> | |
146 | <jar destfile="${lwjgl.temp}/jar/lwjgl_util.jar" taskname="lwjgl_util.jar"> | |
147 | <fileset refid="lwjgl_util.fileset" /> | |
148 | </jar> | |
149 | </target> | |
150 | ||
151 | <!-- Distributes files --> | |
152 | <target name="-distribute"> | |
153 | <delete> | |
154 | <fileset dir="${lwjgl.temp}/native/" includes="**/*"/> | |
155 | </delete> | |
156 | ||
157 | <copy todir="${lwjgl.temp}/jar"> | |
158 | <fileset dir="${lwjgl.lib}/" includes="*.jar"/> | |
159 | </copy> | |
160 | <copy todir="${lwjgl.temp}/native/windows"> | |
161 | <fileset dir="${lwjgl.lib}/windows"> | |
162 | <patternset refid="lwjgl-windows.fileset" /> | |
163 | </fileset> | |
164 | </copy> | |
165 | <copy todir="${lwjgl.temp}/native/linux"> | |
166 | <fileset dir="${lwjgl.lib}/linux"> | |
167 | <patternset refid="lwjgl-linux.fileset" /> | |
168 | </fileset> | |
169 | </copy> | |
170 | <copy todir="${lwjgl.temp}/native/macosx"> | |
171 | <fileset dir="${lwjgl.lib}/macosx"> | |
172 | <patternset refid="lwjgl-macosx.fileset" /> | |
173 | </fileset> | |
174 | </copy> | |
175 | <copy todir="${lwjgl.temp}/native/solaris"> | |
176 | <fileset dir="${lwjgl.lib}/solaris"> | |
177 | <patternset refid="lwjgl-solaris.fileset" /> | |
178 | </fileset> | |
179 | </copy> | |
180 | ||
181 | <!-- create base package --> | |
182 | <zip destfile="${lwjgl.dist}/lwjgl-${lwjgl.version}.zip"> | |
183 | <zipfileset dir="${lwjgl.temp}" prefix="lwjgl-${lwjgl.version}/"> | |
184 | <patternset refid="lwjgl_base"/> | |
185 | </zipfileset> | |
186 | </zip> | |
187 | ||
188 | <!-- create applet package --> | |
189 | <zip destfile="${lwjgl.dist}/lwjgl_applet-${lwjgl.version}.zip"> | |
190 | <zipfileset dir="." prefix="lwjgl_applet-${lwjgl.version}/"> | |
191 | <patternset refid="lwjgl_applet"/> | |
192 | </zipfileset> | |
193 | </zip> | |
194 | </target> | |
195 | ||
196 | <!-- Creates a versioned distribution of javadocs --> | |
197 | <target name="-distribution_javadoc"> | |
198 | <zip destfile="${lwjgl.dist}/lwjgl-docs-${lwjgl.version}.zip" basedir="${lwjgl.docs}" includes="javadoc/**" /> | |
199 | </target> | |
200 | ||
201 | <!-- Creates a versioned distribution of the source code --> | |
202 | <target name="-distribution_source"> | |
203 | <zip destfile="${lwjgl.dist}/lwjgl-source-${lwjgl.version}.zip"> | |
204 | <fileset refid="lwjgl.source.fileset" /> | |
205 | </zip> | |
206 | </target> | |
207 | ||
208 | <!-- Generates the native headers from source files --> | |
209 | <target name="headers" description="invokes javah on java classes" depends="compile"> | |
210 | <javah classpath="${lwjgl.bin}" destdir="${lwjgl.src.native}/linux" force="yes"> | |
211 | <class name="org.lwjgl.LinuxSysImplementation" /> | |
212 | <class name="org.lwjgl.opengl.LinuxEvent" /> | |
213 | <class name="org.lwjgl.opengl.LinuxMouse" /> | |
214 | <class name="org.lwjgl.opengl.LinuxKeyboard" /> | |
215 | <class name="org.lwjgl.opengl.LinuxDisplay" /> | |
216 | <class name="org.lwjgl.opengl.LinuxPeerInfo" /> | |
217 | <class name="org.lwjgl.opengl.LinuxPbufferPeerInfo" /> | |
218 | <class name="org.lwjgl.opengl.LinuxDisplayPeerInfo" /> | |
219 | <class name="org.lwjgl.opengl.LinuxAWTGLCanvasPeerInfo" /> | |
220 | <class name="org.lwjgl.opengl.LinuxContextImplementation" /> | |
221 | <class name="org.lwjgl.opengl.LinuxCanvasImplementation" /> | |
222 | </javah> | |
223 | ||
224 | <javah classpath="${lwjgl.bin}" destdir="${lwjgl.src.native}/windows" force="yes"> | |
225 | <class name="org.lwjgl.opengl.WindowsKeyboard" /> | |
226 | <class name="org.lwjgl.opengl.WindowsPbufferPeerInfo" /> | |
227 | <class name="org.lwjgl.opengl.WindowsDisplay" /> | |
228 | <class name="org.lwjgl.opengl.WindowsRegistry" /> | |
229 | <class name="org.lwjgl.WindowsSysImplementation" /> | |
230 | <class name="org.lwjgl.opengl.WindowsAWTGLCanvasPeerInfo" /> | |
231 | <class name="org.lwjgl.opengl.WindowsPeerInfo" /> | |
232 | <class name="org.lwjgl.opengl.WindowsDisplayPeerInfo" /> | |
233 | <class name="org.lwjgl.opengl.WindowsContextImplementation" /> | |
234 | </javah> | |
235 | ||
236 | <javah classpath="${lwjgl.bin}" destdir="${lwjgl.src.native}/macosx" force="yes"> | |
237 | <class name="org.lwjgl.MacOSXSysImplementation" /> | |
238 | <class name="org.lwjgl.opengl.MacOSXMouseEventQueue" /> | |
239 | <class name="org.lwjgl.opengl.MacOSXCanvasPeerInfo" /> | |
240 | <class name="org.lwjgl.opengl.MacOSXPeerInfo" /> | |
241 | <class name="org.lwjgl.opengl.MacOSXPbufferPeerInfo" /> | |
242 | <class name="org.lwjgl.opengl.MacOSXDisplay" /> | |
243 | <class name="org.lwjgl.opengl.MacOSXContextImplementation" /> | |
244 | </javah> | |
245 | ||
246 | <javah classpath="${lwjgl.bin}" destdir="${lwjgl.src.headers}" force="yes"> | |
247 | <class name="org.lwjgl.opengl.AWTSurfaceLock" /> | |
248 | <class name="org.lwjgl.DefaultSysImplementation" /> | |
249 | <class name="org.lwjgl.input.Cursor" /> | |
250 | <class name="org.lwjgl.input.Keyboard" /> | |
251 | <class name="org.lwjgl.input.Mouse" /> | |
252 | <class name="org.lwjgl.openal.AL" /> | |
253 | <class name="org.lwjgl.opengl.GLContext" /> | |
254 | <class name="org.lwjgl.opengl.Pbuffer" /> | |
255 | </javah> | |
256 | </target> | |
257 | ||
258 | <target name="touch-version"> | |
259 | <touch file="${lwjgl.src.native}/windows/org_lwjgl_opengl_Display.c"/> | |
260 | <touch file="${lwjgl.src.native}/linux/org_lwjgl_opengl_Display.c"/> | |
261 | <touch file="${lwjgl.src.native}/macosx/org_lwjgl_opengl_Display.m"/> | |
262 | </target> | |
263 | ||
264 | <target name="version-mismatch"> | |
265 | <loadfile srcfile="${lwjgl.src}/java/org/lwjgl/WindowsSysImplementation.java" property="lwjgl.java.windows.version"> | |
266 | <filterchain> | |
267 | <tokenfilter> | |
268 | <containsstring contains="JNI_VERSION ="/> | |
269 | </tokenfilter> | |
270 | </filterchain> | |
271 | </loadfile> | |
272 | <loadfile srcfile="${lwjgl.src}/java/org/lwjgl/LinuxSysImplementation.java" property="lwjgl.java.linux.version"> | |
273 | <filterchain> | |
274 | <tokenfilter> | |
275 | <containsstring contains="JNI_VERSION ="/> | |
276 | </tokenfilter> | |
277 | </filterchain> | |
278 | </loadfile> | |
279 | <loadfile srcfile="${lwjgl.src}/java/org/lwjgl/MacOSXSysImplementation.java" property="lwjgl.java.macosx.version"> | |
280 | <filterchain> | |
281 | <tokenfilter> | |
282 | <containsstring contains="JNI_VERSION ="/> | |
283 | </tokenfilter> | |
284 | </filterchain> | |
285 | </loadfile> | |
286 | <loadfile srcfile="${lwjgl.src.native}/windows/org_lwjgl_WindowsSysImplementation.h" property="lwjgl.native.windows.version"> | |
287 | <filterchain> | |
288 | <tokenfilter> | |
289 | <containsstring contains="#define org_lwjgl_WindowsSysImplementation_JNI_VERSION"/> | |
290 | </tokenfilter> | |
291 | </filterchain> | |
292 | </loadfile> | |
293 | <loadfile srcfile="${lwjgl.src.native}/linux/org_lwjgl_LinuxSysImplementation.h" property="lwjgl.native.linux.version"> | |
294 | <filterchain> | |
295 | <tokenfilter> | |
296 | <containsstring contains="#define org_lwjgl_LinuxSysImplementation_JNI_VERSION"/> | |
297 | </tokenfilter> | |
298 | </filterchain> | |
299 | </loadfile> | |
300 | <loadfile srcfile="${lwjgl.src.native}/macosx/org_lwjgl_MacOSXSysImplementation.h" property="lwjgl.native.macosx.version"> | |
301 | <filterchain> | |
302 | <tokenfilter> | |
303 | <containsstring contains="#define org_lwjgl_MacOSXSysImplementation_JNI_VERSION"/> | |
304 | </tokenfilter> | |
305 | </filterchain> | |
306 | </loadfile> | |
307 | <echo> | |
308 | lwjgl.java.windows.version = ${lwjgl.java.windows.version} | |
309 | lwjgl.native.windows.version = ${lwjgl.native.windows.version} | |
310 | lwjgl.java.linux.version = ${lwjgl.java.linux.version} | |
311 | lwjgl.native.linux.version = ${lwjgl.native.linux.version} | |
312 | lwjgl.java.macosx.version = ${lwjgl.java.macosx.version} | |
313 | lwjgl.native.macosx.version = ${lwjgl.native.macosx.version} | |
314 | </echo> | |
315 | </target> | |
316 | ||
317 | <macrodef name="version-check"> | |
318 | <attribute name="platform"/> | |
319 | <sequential> | |
320 | <java classname="org.lwjgl.test.NativeTest" logError="false" resultproperty="nativetest.res" outputproperty="nativetest.out" errorproperty="nativetest.err" fork="true"> | |
321 | <jvmarg value="-Djava.library.path=libs/@{platform}"/> | |
322 | <classpath> | |
323 | <pathelement path="${lwjgl.bin}"/> | |
324 | <pathelement path="${java.class.path}"/> | |
325 | </classpath> | |
326 | </java> | |
327 | ||
328 | <fail message="Unable to load native library: ${nativetest.err}"> | |
329 | <condition> | |
330 | <not> | |
331 | <equals arg1="OK" arg2="${nativetest.out}"/> | |
332 | </not> | |
333 | </condition> | |
334 | </fail> | |
335 | ||
336 | <echo message="Successfully executed NativeTest"/> | |
337 | </sequential> | |
338 | </macrodef> | |
339 | ||
340 | <!-- Compiles the Java source code --> | |
341 | <target name="compile" description="Compiles the java source code" depends="-initialize"> | |
342 | <javac debug="yes" destdir="${lwjgl.bin}" source="1.4" target="1.4" classpath="${lwjgl.lib}/jinput.jar:${lwjgl.lib}/AppleJavaExtensions.jar" taskname="core"> | |
343 | <src path="${lwjgl.src}/java/"/> | |
344 | <src path="${lwjgl.src}/generated/"/> | |
345 | <include name="org/lwjgl/*.java"/> | |
346 | <include name="org/lwjgl/input/**"/> | |
347 | <include name="org/lwjgl/opengl/**"/> | |
348 | <include name="org/lwjgl/openal/**"/> | |
349 | <include name="org/lwjgl/util/**"/> | |
350 | <exclude name="org/lwjgl/util/generator/**"/> | |
351 | </javac> | |
352 | <javac debug="yes" srcdir="${lwjgl.src}/java/" destdir="${lwjgl.bin}" includes="org/lwjgl/test/**" source="1.4" target="1.4" taskname="test" /> | |
353 | <javac debug="yes" srcdir="${lwjgl.src}/java/" destdir="${lwjgl.bin}" includes="org/lwjgl/examples/**" source="1.4" target="1.4" taskname="examples" /> | |
354 | </target> | |
355 | ||
356 | <target name="compile_native" depends="headers, touch-version, version-mismatch" description="Compiles the native files"> | |
357 | <condition property="lwjgl.platform.windows"> | |
358 | <os family="windows" /> | |
359 | </condition> | |
360 | <antcall target="-compile_native_win32" /> | |
361 | ||
362 | <condition property="lwjgl.platform.linux"> | |
363 | <os name="Linux" /> | |
364 | </condition> | |
365 | <antcall target="-compile_native_linux" /> | |
366 | ||
367 | <condition property="lwjgl.platform.solaris"> | |
368 | <os name="SunOS" /> | |
369 | </condition> | |
370 | <antcall target="-compile_native_solaris" /> | |
371 | ||
372 | <condition property="lwjgl.platform.macosx"> | |
373 | <os name="Mac OS X" /> | |
374 | </condition> | |
375 | <antcall target="-compile_native_macosx" /> | |
376 | </target> | |
377 | ||
378 | <!-- Compiles LWJGL on Win32 platforms --> | |
379 | <target name="-compile_native_win32" if="lwjgl.platform.windows"> | |
380 | <ant antfile="platform_build/windows_ant/build.xml" inheritAll="false"/> | |
381 | <copy todir="${lwjgl.lib}/windows"> | |
382 | <fileset dir="${lwjgl.bin}/lwjgl" includes="lwjgl*.dll"/> | |
383 | </copy> | |
384 | <version-check platform="windows"/> | |
385 | </target> | |
386 | ||
387 | <!-- Compiles LWJGL on Linux platforms --> | |
388 | <target name="-compile_native_linux" if="lwjgl.platform.linux"> | |
389 | <ant antfile="platform_build/linux_ant/build.xml" inheritAll="false"/> | |
390 | <copy todir="${lwjgl.lib}/linux"> | |
391 | <fileset dir="${lwjgl.bin}/lwjgl" includes="liblwjgl*.so"/> | |
392 | </copy> | |
393 | <!-- headless issues <version-check platform="linux"/> --> | |
394 | </target> | |
395 | ||
396 | <!-- Compiles LWJGL on solaris platforms --> | |
397 | <target name="-compile_native_solaris" if="lwjgl.platform.solaris"> | |
398 | <!-- Reusing the linux ant task, but copy the output to solaris --> | |
399 | <ant antfile="platform_build/linux_ant/build.xml" inheritAll="false"/> | |
400 | <copy todir="${lwjgl.lib}/solaris"> | |
401 | <fileset dir="${lwjgl.bin}/lwjgl" includes="liblwjgl*.so"/> | |
402 | </copy> | |
403 | <version-check platform="solaris"/> | |
404 | </target> | |
405 | ||
406 | <!-- Compiles LWJGL on Mac platforms --> | |
407 | <target name="-compile_native_macosx" if="lwjgl.platform.macosx"> | |
408 | <ant antfile="platform_build/macosx_ant/build.xml" inheritAll="false"/> | |
409 | <copy file="${lwjgl.bin}/lwjgl/liblwjgl.jnilib" todir="${lwjgl.lib}/macosx"/> | |
410 | <version-check platform="macosx"/> | |
411 | </target> | |
412 | ||
413 | <target name="repack200" description="Pack200-repack a jar file"> | |
414 | <pack200 src="${input}" destfile="${output}" repack="true"/> | |
415 | </target> | |
416 | ||
417 | <target name="pack200" description="Pack200 a jar file"> | |
418 | <pack200 src="${input}" destfile="${output}"/> | |
419 | </target> | |
420 | ||
421 | <target name="lzma" description="LZMA compress a file"> | |
422 | <java fork="true" classname="SevenZip.LzmaAlone"> | |
423 | <classpath> | |
424 | <pathelement location="platform_build/JLzma.jar"/> | |
425 | </classpath> | |
426 | <jvmarg value="-Xmx512m"/> | |
427 | <arg value="e"/> | |
428 | <arg value="${input}"/> | |
429 | <arg value="${output}"/> | |
430 | </java> | |
431 | </target> | |
432 | ||
433 | <target name="compress-sign-class"> | |
434 | <antcall target="repack200"> | |
435 | <param name="input" value="${dir}${jarfile}.jar"/> | |
436 | <param name="output" value="${dir}${jarfile}-repack.jar"/> | |
437 | </antcall> | |
438 | <signjar jar="${dir}${jarfile}-repack.jar" alias="${alias}" keystore="${keystore}" storepass="${password}"/> | |
439 | <antcall target="pack200"> | |
440 | <param name="input" value="${dir}${jarfile}-repack.jar"/> | |
441 | <param name="output" value="${dir}${jarfile}.jar.pack"/> | |
442 | </antcall> | |
443 | <antcall target="lzma"> | |
444 | <param name="input" value="${dir}${jarfile}.jar.pack"/> | |
445 | <param name="output" value="${dir}${jarfile}.jar.pack.lzma"/> | |
446 | </antcall> | |
447 | <delete file="${dir}${jarfile}-repack.jar"/> | |
448 | <delete file="${dir}${jarfile}.jar.pack"/> | |
449 | <delete file="${dir}${jarfile}.jar"/> | |
450 | </target> | |
451 | ||
452 | <target name="compress-resource"> | |
453 | <antcall target="lzma"> | |
454 | <param name="input" value="${input}"/> | |
455 | <param name="output" value="${output}"/> | |
456 | </antcall> | |
457 | </target> | |
458 | ||
459 | <target name="applettest" depends="applet"> | |
460 | <exec executable="appletviewer"> | |
461 | <arg value="-J-Djava.security.policy=applet/appletviewer.policy"/> | |
462 | <arg path="applet/applet.html"/> | |
463 | </exec> | |
464 | </target> | |
465 | ||
466 | <target name="runtest" depends="all"> | |
467 | <fail message="test.mainclass is not set. Use 'ant -Dtest.mainclass=<main-class> runtest'" unless="test.mainclass"/> | |
468 | <condition property="native_path" value="libs/windows"> | |
469 | <os family="windows" /> | |
470 | </condition> | |
471 | ||
472 | <condition property="native_path" value="libs/linux"> | |
473 | <or> | |
474 | <os name="Linux" /> | |
475 | <os name="SunOS" /> | |
476 | </or> | |
477 | </condition> | |
478 | ||
479 | <condition property="native_path" value="libs/macosx"> | |
480 | <os name="Mac OS X" /> | |
481 | </condition> | |
482 | <property name="native_path_expanded" location="${native_path}"/> | |
483 | <java classname="${test.mainclass}" classpath="res:${lwjgl.lib}/lwjgl.jar:${lwjgl.lib}/lwjgl_util.jar:${lwjgl.lib}/lwjgl_test.jar:${lwjgl.lib}/jinput.jar" fork="true"> | |
484 | <sysproperty key="org.lwjgl.util.Debug" value="true"/> | |
485 | <sysproperty key="java.library.path" value="${native_path_expanded}"/> | |
486 | <arg line="${args}"/> | |
487 | </java> | |
488 | </target> | |
489 | ||
490 | <!-- Creates the Javadoc --> | |
491 | <target name="javadoc" description="Creates javadoc from java source code"> | |
492 | <javadoc destdir="${lwjgl.docs}/javadoc" classpath="${lwjgl.lib}/jinput.jar" author="true" version="true" use="true" source="1.4" windowtitle="LWJGL API" useexternalfile="true"> | |
493 | <fileset refid="lwjgl.javadoc.fileset" /> | |
494 | <doctitle><![CDATA[<h1>Lightweight Java Game Toolkit</h1>]]></doctitle> | |
495 | <bottom><![CDATA[<i>Copyright © 2002-2009 lwjgl.org. All Rights Reserved.</i>]]></bottom> | |
496 | </javadoc> | |
497 | </target> | |
498 | </project> |
0 | <project name="applet"> | |
1 | ||
2 | <!-- Create our packer task --> | |
3 | <taskdef name="pack200" classname="com.sun.tools.apache.ant.pack200.Pack200Task" classpath="platform_build/Pack200Task.jar"/> | |
4 | ||
5 | <target name="applet" depends="all"> | |
6 | <antcall target="-applet"> | |
7 | <param name="keystore" value="applet/lwjglkeystore"/> | |
8 | <param name="alias" value="lwjgl"/> | |
9 | <param name="password" value="123456"/> | |
10 | </antcall> | |
11 | </target> | |
12 | ||
13 | <target name="applet-release"> | |
14 | <input message="Please enter the keystore" addproperty="keystore.location" defaultvalue="applet/lwjglkeystore"/> | |
15 | <input message="Please enter the keystore alias" addproperty="keystore.alias" defaultvalue="lwjgl"/> | |
16 | <input message="Please type the password for the keystore" addproperty="sign.pwd" defaultvalue="123456"/> | |
17 | ||
18 | <antcall target="-applet"> | |
19 | <!-- | |
20 | <param name="keystore" value="signing/matzon_java_code_signing.keystore"/> | |
21 | <param name="alias" value="oddlabs_java_code_signing"/> | |
22 | <param name="password" value="${sign.pwd}"/> | |
23 | --> | |
24 | <param name="keystore" value="${keystore.location}"/> | |
25 | <param name="alias" value="${keystore.alias}"/> | |
26 | <param name="password" value="${sign.pwd}"/> | |
27 | </antcall> | |
28 | </target> | |
29 | ||
30 | <target name="-applet"> | |
31 | ||
32 | <!-- Create lwjgl_applet.jar --> | |
33 | <jar destfile="applet/lwjgl_applet.jar" taskname="lwjgl_applet.jar"> | |
34 | <fileset refid="lwjgl_applet.fileset" /> | |
35 | </jar> | |
36 | ||
37 | <!-- create each of the native jars --> | |
38 | <jar destfile="applet/windows_natives.jar" taskname="windows_natives.jar"> | |
39 | <fileset dir="${lwjgl.lib}/windows"> | |
40 | <patternset refid="lwjgl-windows.fileset"/> | |
41 | </fileset> | |
42 | </jar> | |
43 | <signjar jar="applet/windows_natives.jar" alias="${alias}" keystore="${keystore}" storepass="${password}"/> | |
44 | ||
45 | <jar destfile="applet/linux_natives.jar" taskname="linux_natives.jar"> | |
46 | <fileset dir="${lwjgl.lib}/linux"> | |
47 | <patternset refid="lwjgl-linux.fileset"/> | |
48 | </fileset> | |
49 | </jar> | |
50 | <signjar jar="applet/linux_natives.jar" alias="${alias}" keystore="${keystore}" storepass="${password}"/> | |
51 | ||
52 | <jar destfile="applet/macosx_natives.jar" taskname="macosx_natives.jar"> | |
53 | <fileset dir="${lwjgl.lib}/macosx"> | |
54 | <patternset refid="lwjgl-macosx.fileset"/> | |
55 | </fileset> | |
56 | </jar> | |
57 | <signjar jar="applet/macosx_natives.jar" alias="${alias}" keystore="${keystore}" storepass="${password}"/> | |
58 | ||
59 | <jar destfile="applet/solaris_natives.jar" taskname="solaris_natives.jar"> | |
60 | <fileset dir="${lwjgl.lib}/solaris"> | |
61 | <patternset refid="lwjgl-solaris.fileset"/> | |
62 | </fileset> | |
63 | </jar> | |
64 | <signjar jar="applet/solaris_natives.jar" alias="${alias}" keystore="${keystore}" storepass="${password}"/> | |
65 | ||
66 | <jar destfile="${lwjgl.lib}/lwjgl_util_applet.jar" update="true"> | |
67 | <fileset dir="${lwjgl.res}" includes="applet*"/> | |
68 | </jar> | |
69 | ||
70 | <copy file="${lwjgl.lib}/lwjgl.jar" todir="applet" overwrite="true"/> | |
71 | <copy file="${lwjgl.lib}/lwjgl-debug.jar" todir="applet" overwrite="true"/> | |
72 | <copy file="${lwjgl.lib}/lwjgl_util_applet.jar" todir="applet" overwrite="true"/> | |
73 | <copy file="${lwjgl.lib}/lwjgl_util.jar" todir="applet" overwrite="true"/> | |
74 | <copy file="${lwjgl.lib}/jinput.jar" todir="applet" overwrite="true"/> | |
75 | <copy file="${lwjgl.lib}/lzma.jar" todir="applet" overwrite="true"/> | |
76 | <zip destfile="applet/res.jar"> | |
77 | <zipfileset dir="${lwjgl.res}" includes="Footsteps.wav, ILtest.tga, Missing_you.mod"/> | |
78 | </zip> | |
79 | <signjar jar="applet/lwjgl_util_applet.jar" alias="${alias}" keystore="${keystore}" storepass="${password}"/> | |
80 | <signjar jar="applet/lzma.jar" alias="${alias}" keystore="${keystore}" storepass="${password}"/> | |
81 | ||
82 | <!-- LZMA only, for 1.4 only clients --> | |
83 | <antcall target="compress-resource"> | |
84 | <param name="input" value="applet/lwjgl.jar"/> | |
85 | <param name="output" value="applet/lwjgl.jar.lzma"/> | |
86 | </antcall> | |
87 | <antcall target="compress-resource"> | |
88 | <param name="input" value="applet/lwjgl-debug.jar"/> | |
89 | <param name="output" value="applet/lwjgl-debug.jar.lzma"/> | |
90 | </antcall> | |
91 | ||
92 | <antcall target="compress-resource"> | |
93 | <param name="input" value="applet/lwjgl_util.jar"/> | |
94 | <param name="output" value="applet/lwjgl_util.jar.lzma"/> | |
95 | </antcall> | |
96 | <antcall target="compress-resource"> | |
97 | <param name="input" value="applet/jinput.jar"/> | |
98 | <param name="output" value="applet/jinput.jar.lzma"/> | |
99 | </antcall> | |
100 | <antcall target="compress-resource"> | |
101 | <param name="input" value="applet/lwjgl_applet.jar"/> | |
102 | <param name="output" value="applet/lwjgl_applet.jar.lzma"/> | |
103 | </antcall> | |
104 | <antcall target="compress-resource"> | |
105 | <param name="input" value="applet/windows_natives.jar"/> | |
106 | <param name="output" value="applet/windows_natives.jar.lzma"/> | |
107 | </antcall> | |
108 | <antcall target="compress-sign-class"> | |
109 | <param name="dir" value="applet/"/> | |
110 | <param name="jarfile" value="lwjgl"/> | |
111 | </antcall> | |
112 | <antcall target="compress-sign-class"> | |
113 | <param name="dir" value="applet/"/> | |
114 | <param name="jarfile" value="lwjgl-debug"/> | |
115 | </antcall> | |
116 | <antcall target="compress-sign-class"> | |
117 | <param name="dir" value="applet/"/> | |
118 | <param name="jarfile" value="lwjgl_util"/> | |
119 | </antcall> | |
120 | <antcall target="compress-sign-class"> | |
121 | <param name="dir" value="applet/"/> | |
122 | <param name="jarfile" value="jinput"/> | |
123 | </antcall> | |
124 | <antcall target="compress-sign-class"> | |
125 | <param name="dir" value="applet/"/> | |
126 | <param name="jarfile" value="lwjgl_applet"/> | |
127 | </antcall> | |
128 | <antcall target="compress-resource"> | |
129 | <param name="input" value="applet/windows_natives.jar"/> | |
130 | <param name="output" value="applet/windows_natives.jar.lzma"/> | |
131 | </antcall> | |
132 | <antcall target="compress-resource"> | |
133 | <param name="input" value="applet/macosx_natives.jar"/> | |
134 | <param name="output" value="applet/macosx_natives.jar.lzma"/> | |
135 | </antcall> | |
136 | <antcall target="compress-resource"> | |
137 | <param name="input" value="applet/linux_natives.jar"/> | |
138 | <param name="output" value="applet/linux_natives.jar.lzma"/> | |
139 | </antcall> | |
140 | <antcall target="compress-resource"> | |
141 | <param name="input" value="applet/solaris_natives.jar"/> | |
142 | <param name="output" value="applet/solaris_natives.jar.lzma"/> | |
143 | </antcall> | |
144 | ||
145 | <antcall target="compress-resource"> | |
146 | <param name="input" value="applet/res.jar"/> | |
147 | <param name="output" value="applet/res.jar.lzma"/> | |
148 | </antcall> | |
149 | </target> | |
0 | <project name="applet"> | |
1 | ||
2 | <!-- Create our packer task --> | |
3 | <taskdef name="pack200" classname="com.sun.tools.apache.ant.pack200.Pack200Task" classpath="platform_build/Pack200Task.jar"/> | |
4 | ||
5 | <target name="applet" depends="all"> | |
6 | <antcall target="-applet"> | |
7 | <param name="keystore" value="applet/lwjglkeystore"/> | |
8 | <param name="alias" value="lwjgl"/> | |
9 | <param name="password" value="123456"/> | |
10 | </antcall> | |
11 | </target> | |
12 | ||
13 | <target name="applet-release"> | |
14 | <input message="Please enter the keystore" addproperty="keystore.location" defaultvalue="applet/lwjglkeystore"/> | |
15 | <input message="Please enter the keystore alias" addproperty="keystore.alias" defaultvalue="lwjgl"/> | |
16 | <input message="Please type the password for the keystore" addproperty="sign.pwd" defaultvalue="123456"/> | |
17 | ||
18 | <antcall target="-applet"> | |
19 | <!-- | |
20 | <param name="keystore" value="signing/matzon_java_code_signing.keystore"/> | |
21 | <param name="alias" value="oddlabs_java_code_signing"/> | |
22 | <param name="password" value="${sign.pwd}"/> | |
23 | --> | |
24 | <param name="keystore" value="${keystore.location}"/> | |
25 | <param name="alias" value="${keystore.alias}"/> | |
26 | <param name="password" value="${sign.pwd}"/> | |
27 | </antcall> | |
28 | </target> | |
29 | ||
30 | <target name="-applet"> | |
31 | ||
32 | <!-- Create lwjgl_applet.jar --> | |
33 | <jar destfile="applet/lwjgl_applet.jar" taskname="lwjgl_applet.jar"> | |
34 | <fileset refid="lwjgl_applet.fileset" /> | |
35 | </jar> | |
36 | ||
37 | <!-- create each of the native jars --> | |
38 | <jar destfile="applet/windows_natives.jar" taskname="windows_natives.jar"> | |
39 | <fileset dir="${lwjgl.lib}/windows"> | |
40 | <patternset refid="lwjgl-windows.fileset"/> | |
41 | </fileset> | |
42 | </jar> | |
43 | <signjar jar="applet/windows_natives.jar" alias="${alias}" keystore="${keystore}" storepass="${password}"/> | |
44 | ||
45 | <jar destfile="applet/linux_natives.jar" taskname="linux_natives.jar"> | |
46 | <fileset dir="${lwjgl.lib}/linux"> | |
47 | <patternset refid="lwjgl-linux.fileset"/> | |
48 | </fileset> | |
49 | </jar> | |
50 | <signjar jar="applet/linux_natives.jar" alias="${alias}" keystore="${keystore}" storepass="${password}"/> | |
51 | ||
52 | <jar destfile="applet/macosx_natives.jar" taskname="macosx_natives.jar"> | |
53 | <fileset dir="${lwjgl.lib}/macosx"> | |
54 | <patternset refid="lwjgl-macosx.fileset"/> | |
55 | </fileset> | |
56 | </jar> | |
57 | <signjar jar="applet/macosx_natives.jar" alias="${alias}" keystore="${keystore}" storepass="${password}"/> | |
58 | ||
59 | <jar destfile="applet/solaris_natives.jar" taskname="solaris_natives.jar"> | |
60 | <fileset dir="${lwjgl.lib}/solaris"> | |
61 | <patternset refid="lwjgl-solaris.fileset"/> | |
62 | </fileset> | |
63 | </jar> | |
64 | <signjar jar="applet/solaris_natives.jar" alias="${alias}" keystore="${keystore}" storepass="${password}"/> | |
65 | ||
66 | <jar destfile="${lwjgl.lib}/lwjgl_util_applet.jar" update="true"> | |
67 | <fileset dir="${lwjgl.res}" includes="applet*"/> | |
68 | </jar> | |
69 | ||
70 | <copy file="${lwjgl.lib}/lwjgl.jar" todir="applet" overwrite="true"/> | |
71 | <copy file="${lwjgl.lib}/lwjgl-debug.jar" todir="applet" overwrite="true"/> | |
72 | <copy file="${lwjgl.lib}/lwjgl_util_applet.jar" todir="applet" overwrite="true"/> | |
73 | <copy file="${lwjgl.lib}/lwjgl_util.jar" todir="applet" overwrite="true"/> | |
74 | <copy file="${lwjgl.lib}/jinput.jar" todir="applet" overwrite="true"/> | |
75 | <copy file="${lwjgl.lib}/lzma.jar" todir="applet" overwrite="true"/> | |
76 | <zip destfile="applet/res.jar"> | |
77 | <zipfileset dir="${lwjgl.res}" includes="Footsteps.wav, ILtest.tga, Missing_you.mod"/> | |
78 | </zip> | |
79 | <signjar jar="applet/lwjgl_util_applet.jar" alias="${alias}" keystore="${keystore}" storepass="${password}"/> | |
80 | <signjar jar="applet/lzma.jar" alias="${alias}" keystore="${keystore}" storepass="${password}"/> | |
81 | ||
82 | <!-- LZMA only, for 1.4 only clients --> | |
83 | <antcall target="compress-resource"> | |
84 | <param name="input" value="applet/lwjgl.jar"/> | |
85 | <param name="output" value="applet/lwjgl.jar.lzma"/> | |
86 | </antcall> | |
87 | <antcall target="compress-resource"> | |
88 | <param name="input" value="applet/lwjgl-debug.jar"/> | |
89 | <param name="output" value="applet/lwjgl-debug.jar.lzma"/> | |
90 | </antcall> | |
91 | ||
92 | <antcall target="compress-resource"> | |
93 | <param name="input" value="applet/lwjgl_util.jar"/> | |
94 | <param name="output" value="applet/lwjgl_util.jar.lzma"/> | |
95 | </antcall> | |
96 | <antcall target="compress-resource"> | |
97 | <param name="input" value="applet/jinput.jar"/> | |
98 | <param name="output" value="applet/jinput.jar.lzma"/> | |
99 | </antcall> | |
100 | <antcall target="compress-resource"> | |
101 | <param name="input" value="applet/lwjgl_applet.jar"/> | |
102 | <param name="output" value="applet/lwjgl_applet.jar.lzma"/> | |
103 | </antcall> | |
104 | <antcall target="compress-resource"> | |
105 | <param name="input" value="applet/windows_natives.jar"/> | |
106 | <param name="output" value="applet/windows_natives.jar.lzma"/> | |
107 | </antcall> | |
108 | <antcall target="compress-sign-class"> | |
109 | <param name="dir" value="applet/"/> | |
110 | <param name="jarfile" value="lwjgl"/> | |
111 | </antcall> | |
112 | <antcall target="compress-sign-class"> | |
113 | <param name="dir" value="applet/"/> | |
114 | <param name="jarfile" value="lwjgl-debug"/> | |
115 | </antcall> | |
116 | <antcall target="compress-sign-class"> | |
117 | <param name="dir" value="applet/"/> | |
118 | <param name="jarfile" value="lwjgl_util"/> | |
119 | </antcall> | |
120 | <antcall target="compress-sign-class"> | |
121 | <param name="dir" value="applet/"/> | |
122 | <param name="jarfile" value="jinput"/> | |
123 | </antcall> | |
124 | <antcall target="compress-sign-class"> | |
125 | <param name="dir" value="applet/"/> | |
126 | <param name="jarfile" value="lwjgl_applet"/> | |
127 | </antcall> | |
128 | <antcall target="compress-resource"> | |
129 | <param name="input" value="applet/windows_natives.jar"/> | |
130 | <param name="output" value="applet/windows_natives.jar.lzma"/> | |
131 | </antcall> | |
132 | <antcall target="compress-resource"> | |
133 | <param name="input" value="applet/macosx_natives.jar"/> | |
134 | <param name="output" value="applet/macosx_natives.jar.lzma"/> | |
135 | </antcall> | |
136 | <antcall target="compress-resource"> | |
137 | <param name="input" value="applet/linux_natives.jar"/> | |
138 | <param name="output" value="applet/linux_natives.jar.lzma"/> | |
139 | </antcall> | |
140 | <antcall target="compress-resource"> | |
141 | <param name="input" value="applet/solaris_natives.jar"/> | |
142 | <param name="output" value="applet/solaris_natives.jar.lzma"/> | |
143 | </antcall> | |
144 | ||
145 | <antcall target="compress-resource"> | |
146 | <param name="input" value="applet/res.jar"/> | |
147 | <param name="output" value="applet/res.jar.lzma"/> | |
148 | </antcall> | |
149 | </target> | |
150 | 150 | </project>⏎ |
0 | <project name="definitions"> | |
1 | <!-- ================================================================== --> | |
2 | <!-- Global properties for build --> | |
3 | <!-- ================================================================== --> | |
4 | <property name="lwjgl.src" location="src" /> | |
5 | <property name="lwjgl.src.native" location="${lwjgl.src}/native" /> | |
6 | <property name="lwjgl.src.headers" location="${lwjgl.src.native}/common" /> | |
7 | <property name="lwjgl.src.templates" location="${lwjgl.src}/templates" /> | |
8 | <property name="lwjgl.bin" location="bin" /> | |
9 | <property name="lwjgl.lib" location="libs" /> | |
10 | <property name="lwjgl.dist" location="dist" /> | |
11 | <property name="lwjgl.docs" location="doc" /> | |
12 | <property name="lwjgl.temp" location="temp" /> | |
13 | <property name="lwjgl.res" location="res" /> | |
14 | <property name="lwjgl.version" value="2.4.2" /> | |
15 | ||
16 | <property name="opengl-template-pattern" value="org/lwjgl/opengl/GL*.java,org/lwjgl/opengl/ARB*.java,org/lwjgl/opengl/AMD*.java,org/lwjgl/opengl/APPLE*.java,org/lwjgl/opengl/ATI*.java,org/lwjgl/opengl/EXT*.java,org/lwjgl/opengl/NV*.java,org/lwjgl/opengl/NVX*.java,org/lwjgl/opengl/HP*.java,org/lwjgl/opengl/IBM*.java,org/lwjgl/opengl/SUN*.java,org/lwjgl/opengl/SGIS*.java,org/lwjgl/opengl/GREMEDY*.java"/> | |
17 | <!-- ================================================================== --> | |
18 | <!-- Filesets used for targets --> | |
19 | <!-- ================================================================== --> | |
20 | ||
21 | <!-- Files to include in the lwjgl.jar file --> | |
22 | <fileset id="lwjgl.fileset" dir="${lwjgl.bin}"> | |
23 | <include name="org/**/*" /> | |
24 | <exclude name="org/lwjgl/d3d/**" /> | |
25 | <exclude name="org/lwjgl/test/**" /> | |
26 | <exclude name="org/lwjgl/util/**" /> | |
27 | <exclude name="org/lwjgl/examples/**" /> | |
28 | </fileset> | |
29 | ||
30 | <fileset id="lwjgl_util_applet.fileset" dir="${lwjgl.bin}"> | |
31 | <exclude name="**.*"/> | |
32 | <include name="org/lwjgl/util/applet/**"/> | |
33 | </fileset> | |
34 | ||
35 | <!-- Files to include in the lwjgl_test.jar file --> | |
36 | <fileset id="lwjgl_test.fileset" dir="${lwjgl.bin}"> | |
37 | <exclude name="**.*" /> | |
38 | <include name="org/lwjgl/test/**" /> | |
39 | <include name="org/lwjgl/examples/**" /> | |
40 | </fileset> | |
41 | ||
42 | <!-- More files to include in the lwjgl_test.jar file --> | |
43 | <fileset id="lwjgl_test_extra.fileset" dir="${lwjgl.src}/java"> | |
44 | <exclude name="**.*" /> | |
45 | <include name="org/lwjgl/test/opengl/shaders/shaderFP.fp" /> | |
46 | <include name="org/lwjgl/test/opengl/shaders/shaderFP.vp" /> | |
47 | <include name="org/lwjgl/test/opengl/shaders/shaderFSH.fsh" /> | |
48 | <include name="org/lwjgl/test/opengl/shaders/shaderFSH.vsh" /> | |
49 | <include name="org/lwjgl/test/opengl/shaders/shaderVP.vp" /> | |
50 | <include name="org/lwjgl/test/opengl/shaders/shaderVSH.vsh" /> | |
51 | <include name="org/lwjgl/test/opengl/shaders/shaderUNI.vsh" /> | |
52 | </fileset> | |
53 | ||
54 | <!-- Files to include in the lwjgl_util.jar file --> | |
55 | <fileset id="lwjgl_util.fileset" dir="${lwjgl.bin}"> | |
56 | <exclude name="**.*" /> | |
57 | <exclude name="org/lwjgl/util/generator/**" /> | |
58 | <exclude name="org/lwjgl/util/applet/**" /> | |
59 | <include name="org/lwjgl/util/**" /> | |
60 | </fileset> | |
61 | ||
62 | <!-- Files to include in the lwjgl_applet.jar file --> | |
63 | <fileset id="lwjgl_applet.fileset" dir="${lwjgl.bin}"> | |
64 | <exclude name="**.*"/> | |
65 | <include name="org/lwjgl/test/applet/**"/> | |
66 | <include name="org/lwjgl/test/opengl/awt/AWTGearsCanvas.class"/> | |
67 | </fileset> | |
68 | ||
69 | <!-- Files to make Javadoc from --> | |
70 | <fileset id="lwjgl.javadoc.fileset" dir="${lwjgl.src}"> | |
71 | <include name="**/*.java" /> | |
72 | <exclude name="native/**" /> | |
73 | <exclude name="templates/**" /> | |
74 | <exclude name="java/org/lwjgl/test/**" /> | |
75 | <exclude name="java/org/lwjgl/examples/**" /> | |
76 | <exclude name="java/org/lwjgl/util/generator/**" /> | |
77 | </fileset> | |
78 | ||
79 | <!-- Files to include in doc package --> | |
80 | <patternset id="lwjgl-docs.fileset"> | |
81 | <include name="CREDITS" /> | |
82 | <include name="LICENSE" /> | |
83 | <include name="README" /> | |
84 | <include name="lwjgl_hidden_switches.text" /> | |
85 | <include name="3rdparty/*" /> | |
86 | </patternset> | |
87 | ||
88 | <!-- Files to include in windows package --> | |
89 | <patternset id="lwjgl-windows.fileset"> | |
90 | <include name="lwjgl.dll" /> | |
91 | <include name="lwjgl64.dll" /> | |
92 | <include name="OpenAL32.dll" /> | |
93 | <include name="OpenAL64.dll" /> | |
94 | <include name="jinput-dx8*.dll" /> | |
95 | <include name="jinput-raw*.dll" /> | |
96 | </patternset> | |
97 | ||
98 | <!-- Files to include in linux, glibc2.3 package --> | |
99 | <patternset id="lwjgl-linux.fileset"> | |
100 | <include name="liblwjgl*.so" /> | |
101 | <include name="libopenal*.so" /> | |
102 | <include name="libjinput-linux.so" /> | |
103 | <include name="libjinput-linux64.so" /> | |
104 | </patternset> | |
105 | ||
106 | <!-- Files to include in mac os x package --> | |
107 | <patternset id="lwjgl-macosx.fileset"> | |
108 | <include name="liblwjgl.jnilib" /> | |
109 | <include name="openal.dylib" /> | |
110 | <include name="libjinput-osx.jnilib" /> | |
111 | <include name="libjinput-osx-legacy.jnilib" /> | |
112 | </patternset> | |
113 | ||
114 | <!-- Files to include in solaris package --> | |
115 | <patternset id="lwjgl-solaris.fileset"> | |
116 | <include name="liblwjgl*.so" /> | |
117 | <include name="libopenal.so" /> | |
118 | </patternset> | |
119 | ||
120 | <!-- Files to include in source distribution --> | |
121 | <fileset id="lwjgl.source.fileset" dir="."> | |
122 | <include name="build.xml" /> | |
123 | <include name="src/**" /> | |
124 | <include name="platform_build/**/*" /> | |
125 | </fileset> | |
126 | ||
127 | <!-- files in the base package --> | |
128 | <patternset id="lwjgl_base"> | |
129 | <include name="**" /> | |
130 | <exclude name="res/ILtest.*" /> | |
131 | <exclude name="res/Missing_you.mod" /> | |
132 | <exclude name="res/phero*.*" /> | |
133 | </patternset> | |
134 | ||
135 | <!-- files in the optional package --> | |
136 | <patternset id="lwjgl_optional"> | |
137 | <include name="res/**" /> | |
138 | <exclude name="res/logo/**" /> | |
139 | <exclude name="res/spaceinvaders/**" /> | |
140 | <exclude name="res/*.wav" /> | |
141 | <exclude name="res/*.xpm" /> | |
142 | <include name="doc/CREDITS" /> | |
143 | <include name="doc/LICENSE" /> | |
144 | <include name="doc/README" /> | |
145 | </patternset> | |
146 | ||
147 | <!-- files in the lwjgl_applet package --> | |
148 | <patternset id="lwjgl_applet"> | |
149 | <include name="applet/**" /> | |
150 | <exclude name="applet/appletviewer.policy" /> | |
151 | <exclude name="applet/lwjglkeystore" /> | |
152 | </patternset> | |
153 | ||
154 | <uptodate property="lwjgl.main.built" targetfile="${lwjgl.lib}/windows/lwjgl.dll" > | |
155 | <srcfiles dir= "${lwjgl.src.native}/common" includes="*.c*"/> | |
156 | <srcfiles dir= "${lwjgl.src.native}/windows" includes="*.c"/> | |
157 | </uptodate> | |
0 | <project name="definitions"> | |
1 | <!-- ================================================================== --> | |
2 | <!-- Global properties for build --> | |
3 | <!-- ================================================================== --> | |
4 | <property name="lwjgl.src" location="src" /> | |
5 | <property name="lwjgl.src.native" location="${lwjgl.src}/native" /> | |
6 | <property name="lwjgl.src.headers" location="${lwjgl.src.native}/common" /> | |
7 | <property name="lwjgl.src.templates" location="${lwjgl.src}/templates" /> | |
8 | <property name="lwjgl.bin" location="bin" /> | |
9 | <property name="lwjgl.lib" location="libs" /> | |
10 | <property name="lwjgl.dist" location="dist" /> | |
11 | <property name="lwjgl.docs" location="doc" /> | |
12 | <property name="lwjgl.temp" location="temp" /> | |
13 | <property name="lwjgl.res" location="res" /> | |
14 | <property name="lwjgl.version" value="2.4.2" /> | |
15 | ||
16 | <property name="opengl-template-pattern" value="org/lwjgl/opengl/GL*.java,org/lwjgl/opengl/ARB*.java,org/lwjgl/opengl/AMD*.java,org/lwjgl/opengl/APPLE*.java,org/lwjgl/opengl/ATI*.java,org/lwjgl/opengl/EXT*.java,org/lwjgl/opengl/NV*.java,org/lwjgl/opengl/NVX*.java,org/lwjgl/opengl/HP*.java,org/lwjgl/opengl/IBM*.java,org/lwjgl/opengl/SUN*.java,org/lwjgl/opengl/SGIS*.java,org/lwjgl/opengl/GREMEDY*.java"/> | |
17 | <!-- ================================================================== --> | |
18 | <!-- Filesets used for targets --> | |
19 | <!-- ================================================================== --> | |
20 | ||
21 | <!-- Files to include in the lwjgl.jar file --> | |
22 | <fileset id="lwjgl.fileset" dir="${lwjgl.bin}"> | |
23 | <include name="org/**/*" /> | |
24 | <exclude name="org/lwjgl/d3d/**" /> | |
25 | <exclude name="org/lwjgl/test/**" /> | |
26 | <exclude name="org/lwjgl/util/**" /> | |
27 | <exclude name="org/lwjgl/examples/**" /> | |
28 | </fileset> | |
29 | ||
30 | <fileset id="lwjgl_util_applet.fileset" dir="${lwjgl.bin}"> | |
31 | <exclude name="**.*"/> | |
32 | <include name="org/lwjgl/util/applet/**"/> | |
33 | </fileset> | |
34 | ||
35 | <!-- Files to include in the lwjgl_test.jar file --> | |
36 | <fileset id="lwjgl_test.fileset" dir="${lwjgl.bin}"> | |
37 | <exclude name="**.*" /> | |
38 | <include name="org/lwjgl/test/**" /> | |
39 | <include name="org/lwjgl/examples/**" /> | |
40 | </fileset> | |
41 | ||
42 | <!-- More files to include in the lwjgl_test.jar file --> | |
43 | <fileset id="lwjgl_test_extra.fileset" dir="${lwjgl.src}/java"> | |
44 | <exclude name="**.*" /> | |
45 | <include name="org/lwjgl/test/opengl/shaders/shaderFP.fp" /> | |
46 | <include name="org/lwjgl/test/opengl/shaders/shaderFP.vp" /> | |
47 | <include name="org/lwjgl/test/opengl/shaders/shaderFSH.fsh" /> | |
48 | <include name="org/lwjgl/test/opengl/shaders/shaderFSH.vsh" /> | |
49 | <include name="org/lwjgl/test/opengl/shaders/shaderVP.vp" /> | |
50 | <include name="org/lwjgl/test/opengl/shaders/shaderVSH.vsh" /> | |
51 | <include name="org/lwjgl/test/opengl/shaders/shaderUNI.vsh" /> | |
52 | </fileset> | |
53 | ||
54 | <!-- Files to include in the lwjgl_util.jar file --> | |
55 | <fileset id="lwjgl_util.fileset" dir="${lwjgl.bin}"> | |
56 | <exclude name="**.*" /> | |
57 | <exclude name="org/lwjgl/util/generator/**" /> | |
58 | <exclude name="org/lwjgl/util/applet/**" /> | |
59 | <include name="org/lwjgl/util/**" /> | |
60 | </fileset> | |
61 | ||
62 | <!-- Files to include in the lwjgl_applet.jar file --> | |
63 | <fileset id="lwjgl_applet.fileset" dir="${lwjgl.bin}"> | |
64 | <exclude name="**.*"/> | |
65 | <include name="org/lwjgl/test/applet/**"/> | |
66 | <include name="org/lwjgl/test/opengl/awt/AWTGearsCanvas.class"/> | |
67 | </fileset> | |
68 | ||
69 | <!-- Files to make Javadoc from --> | |
70 | <fileset id="lwjgl.javadoc.fileset" dir="${lwjgl.src}"> | |
71 | <include name="**/*.java" /> | |
72 | <exclude name="native/**" /> | |
73 | <exclude name="templates/**" /> | |
74 | <exclude name="java/org/lwjgl/test/**" /> | |
75 | <exclude name="java/org/lwjgl/examples/**" /> | |
76 | <exclude name="java/org/lwjgl/util/generator/**" /> | |
77 | </fileset> | |
78 | ||
79 | <!-- Files to include in doc package --> | |
80 | <patternset id="lwjgl-docs.fileset"> | |
81 | <include name="CREDITS" /> | |
82 | <include name="LICENSE" /> | |
83 | <include name="README" /> | |
84 | <include name="lwjgl_hidden_switches.text" /> | |
85 | <include name="3rdparty/*" /> | |
86 | </patternset> | |
87 | ||
88 | <!-- Files to include in windows package --> | |
89 | <patternset id="lwjgl-windows.fileset"> | |
90 | <include name="lwjgl.dll" /> | |
91 | <include name="lwjgl64.dll" /> | |
92 | <include name="OpenAL32.dll" /> | |
93 | <include name="OpenAL64.dll" /> | |
94 | <include name="jinput-dx8*.dll" /> | |
95 | <include name="jinput-raw*.dll" /> | |
96 | </patternset> | |
97 | ||
98 | <!-- Files to include in linux, glibc2.3 package --> | |
99 | <patternset id="lwjgl-linux.fileset"> | |
100 | <include name="liblwjgl*.so" /> | |
101 | <include name="libopenal*.so" /> | |
102 | <include name="libjinput-linux.so" /> | |
103 | <include name="libjinput-linux64.so" /> | |
104 | </patternset> | |
105 | ||
106 | <!-- Files to include in mac os x package --> | |
107 | <patternset id="lwjgl-macosx.fileset"> | |
108 | <include name="liblwjgl.jnilib" /> | |
109 | <include name="openal.dylib" /> | |
110 | <include name="libjinput-osx.jnilib" /> | |
111 | <include name="libjinput-osx-legacy.jnilib" /> | |
112 | </patternset> | |
113 | ||
114 | <!-- Files to include in solaris package --> | |
115 | <patternset id="lwjgl-solaris.fileset"> | |
116 | <include name="liblwjgl*.so" /> | |
117 | <include name="libopenal.so" /> | |
118 | </patternset> | |
119 | ||
120 | <!-- Files to include in source distribution --> | |
121 | <fileset id="lwjgl.source.fileset" dir="."> | |
122 | <include name="build.xml" /> | |
123 | <include name="src/**" /> | |
124 | <include name="platform_build/**/*" /> | |
125 | </fileset> | |
126 | ||
127 | <!-- files in the base package --> | |
128 | <patternset id="lwjgl_base"> | |
129 | <include name="**" /> | |
130 | <exclude name="res/ILtest.*" /> | |
131 | <exclude name="res/Missing_you.mod" /> | |
132 | <exclude name="res/phero*.*" /> | |
133 | </patternset> | |
134 | ||
135 | <!-- files in the optional package --> | |
136 | <patternset id="lwjgl_optional"> | |
137 | <include name="res/**" /> | |
138 | <exclude name="res/logo/**" /> | |
139 | <exclude name="res/spaceinvaders/**" /> | |
140 | <exclude name="res/*.wav" /> | |
141 | <exclude name="res/*.xpm" /> | |
142 | <include name="doc/CREDITS" /> | |
143 | <include name="doc/LICENSE" /> | |
144 | <include name="doc/README" /> | |
145 | </patternset> | |
146 | ||
147 | <!-- files in the lwjgl_applet package --> | |
148 | <patternset id="lwjgl_applet"> | |
149 | <include name="applet/**" /> | |
150 | <exclude name="applet/appletviewer.policy" /> | |
151 | <exclude name="applet/lwjglkeystore" /> | |
152 | </patternset> | |
153 | ||
154 | <uptodate property="lwjgl.main.built" targetfile="${lwjgl.lib}/windows/lwjgl.dll" > | |
155 | <srcfiles dir= "${lwjgl.src.native}/common" includes="*.c*"/> | |
156 | <srcfiles dir= "${lwjgl.src.native}/windows" includes="*.c"/> | |
157 | </uptodate> | |
158 | 158 | </project>⏎ |
0 | <project name="generator"> | |
1 | ||
2 | <!-- clean the generated files --> | |
3 | <target name="clean-generated" description="Deletes the generated java and native source"> | |
4 | <delete quiet="true" failonerror="false"> | |
5 | <fileset dir="${lwjgl.src}/generated" includes="**"/> | |
6 | <fileset dir="${lwjgl.src.native}/generated" includes="**"/> | |
7 | </delete> | |
8 | </target> | |
9 | ||
10 | <!-- Compiles the Java generator source code --> | |
11 | <target name="generators" description="Compiles the native method generators"> | |
12 | <javac debug="yes" srcdir="${lwjgl.src}/java/" destdir="${lwjgl.bin}" includes="org/lwjgl/util/generator/**.java" source="1.5" target="1.5" taskname="generator"> | |
13 | <compilerarg value="-Xlint:all"/> | |
14 | </javac> | |
15 | <javac debug="yes" srcdir="${lwjgl.src}/java/" destdir="${lwjgl.bin}" source="1.4" target="1.4" taskname="generator"> | |
16 | <include name="org/lwjgl/opengl/GLSync.java"/> | |
17 | <include name="org/lwjgl/opengl/PointerWrapper.java"/> | |
18 | </javac> | |
19 | </target> | |
20 | ||
21 | <!-- Proxy target to generate it all --> | |
22 | <target name="generate-all" depends="generate-openal, generate-opengl, generate-opengl-capabilities, generate-opengl-references" description="Generates java and native source"/> | |
23 | ||
24 | <target name="generate-debug" depends="generate-openal-debug, generate-opengl-debug, generate-opengl-capabilities-debug, generate-opengl-references" description="Generates java and native source"/> | |
25 | ||
26 | <!-- Generate OpenAL --> | |
27 | <target name="generate-openal" depends="generators" description="Generates java and native source for AL"> | |
28 | <apply executable="apt" parallel="true"> | |
29 | <arg value="-nocompile"/> | |
30 | <arg value="-factory"/> | |
31 | <arg value="org.lwjgl.util.generator.GeneratorProcessorFactory"/> | |
32 | <arg value="-cp"/> | |
33 | <arg path="${lwjgl.src}/java:${lwjgl.src.templates}:${lwjgl.bin}:${java.class.path}"/> | |
34 | <arg value="-s"/> | |
35 | <arg path="${lwjgl.src}/generated"/> | |
36 | <arg value="-d"/> | |
37 | <arg path="${lwjgl.src.native}/generated"/> | |
38 | <arg value="-Atypemap=org.lwjgl.util.generator.ALTypeMap"/> | |
39 | <fileset dir="${lwjgl.src.templates}" includes="org/lwjgl/openal/AL10.java, org/lwjgl/openal/AL11.java"/> | |
40 | </apply> | |
41 | </target> | |
42 | ||
43 | <!-- Generate OpenAL [DEBUG] --> | |
44 | <target name="generate-openal-debug" depends="generators" description="Generates java and native source for AL"> | |
45 | <apply executable="apt" parallel="true"> | |
46 | <arg value="-nocompile"/> | |
47 | <arg value="-factory"/> | |
48 | <arg value="org.lwjgl.util.generator.GeneratorProcessorFactory"/> | |
49 | <arg value="-cp"/> | |
50 | <arg path="${lwjgl.src}/java:${lwjgl.src.templates}:${lwjgl.bin}:${java.class.path}"/> | |
51 | <arg value="-s"/> | |
52 | <arg path="${lwjgl.src}/generated"/> | |
53 | <arg value="-d"/> | |
54 | <arg path="${lwjgl.src.native}/generated"/> | |
55 | <arg value="-Atypemap=org.lwjgl.util.generator.ALTypeMap"/> | |
56 | <arg value="-Ageneratechecks"/> | |
57 | <fileset dir="${lwjgl.src.templates}" includes="org/lwjgl/openal/AL10.java, org/lwjgl/openal/AL11.java"/> | |
58 | </apply> | |
59 | </target> | |
60 | ||
61 | <!-- Generate OpenGL --> | |
62 | <target name="generate-opengl" depends="generators" description="Generates java and native source for GL"> | |
63 | <apply executable="apt" parallel="true"> | |
64 | <arg value="-nocompile"/> | |
65 | <arg value="-factory"/> | |
66 | <arg value="org.lwjgl.util.generator.GeneratorProcessorFactory"/> | |
67 | <arg value="-cp"/> | |
68 | <arg path="${lwjgl.src}/java:${lwjgl.src.templates}:${lwjgl.bin}:${java.class.path}"/> | |
69 | <arg value="-s"/> | |
70 | <arg path="${lwjgl.src}/generated"/> | |
71 | <arg value="-d"/> | |
72 | <arg path="${lwjgl.src.native}/generated"/> | |
73 | <arg value="-Acontextspecific"/> | |
74 | <arg value="-Atypemap=org.lwjgl.util.generator.GLTypeMap"/> | |
75 | <fileset dir="${lwjgl.src.templates}" includes="${opengl-template-pattern}"/> | |
76 | </apply> | |
77 | </target> | |
78 | ||
79 | <!-- Generate OpenGL [DEBUG] --> | |
80 | <target name="generate-opengl-debug" depends="generators" description="Generates java and native source for GL"> | |
81 | <apply executable="apt" parallel="true"> | |
82 | <arg value="-nocompile"/> | |
83 | <arg value="-factory"/> | |
84 | <arg value="org.lwjgl.util.generator.GeneratorProcessorFactory"/> | |
85 | <arg value="-cp"/> | |
86 | <arg path="${lwjgl.src}/java:${lwjgl.src.templates}:${lwjgl.bin}:${java.class.path}"/> | |
87 | <arg value="-s"/> | |
88 | <arg path="${lwjgl.src}/generated"/> | |
89 | <arg value="-d"/> | |
90 | <arg path="${lwjgl.src.native}/generated"/> | |
91 | <arg value="-Ageneratechecks"/> | |
92 | <arg value="-Acontextspecific"/> | |
93 | <arg value="-Atypemap=org.lwjgl.util.generator.GLTypeMap"/> | |
94 | <fileset dir="${lwjgl.src.templates}" includes="${opengl-template-pattern}"/> | |
95 | </apply> | |
96 | </target> | |
97 | ||
98 | <!-- Generate references --> | |
99 | <target name="generate-opengl-references" depends="generators" description="Generates java and native source for GL"> | |
100 | <apply executable="apt" parallel="true"> | |
101 | <arg value="-nocompile"/> | |
102 | <arg value="-factory"/> | |
103 | <arg value="org.lwjgl.util.generator.ReferencesGeneratorProcessorFactory"/> | |
104 | <arg value="-cp"/> | |
105 | <arg path="${lwjgl.src}/java:${lwjgl.src.templates}:${lwjgl.bin}:${java.class.path}"/> | |
106 | <arg value="-s"/> | |
107 | <arg path="${lwjgl.src}/generated"/> | |
108 | <fileset dir="${lwjgl.src.templates}" includes="${opengl-template-pattern}"/> | |
109 | </apply> | |
110 | </target> | |
111 | ||
112 | <!-- Generate context capabilities --> | |
113 | <target name="generate-opengl-capabilities" depends="generators" description="Generates java and native source for GL"> | |
114 | <apply executable="apt" parallel="true"> | |
115 | <arg value="-nocompile"/> | |
116 | <arg value="-factory"/> | |
117 | <arg value="org.lwjgl.util.generator.ContextGeneratorProcessorFactory"/> | |
118 | <arg value="-cp"/> | |
119 | <arg path="${lwjgl.src}/java:${lwjgl.src.templates}:${lwjgl.bin}:${java.class.path}"/> | |
120 | <arg value="-s"/> | |
121 | <arg path="${lwjgl.src}/generated"/> | |
122 | <arg value="-Acontextspecific"/> | |
123 | <fileset dir="${lwjgl.src.templates}" includes="${opengl-template-pattern}"/> | |
124 | </apply> | |
125 | </target> | |
126 | ||
127 | <!-- Generate context capabilities [DEBUG] --> | |
128 | <target name="generate-opengl-capabilities-debug" depends="generators" description="Generates java and native source for GL"> | |
129 | <apply executable="apt" parallel="true"> | |
130 | <arg value="-nocompile"/> | |
131 | <arg value="-factory"/> | |
132 | <arg value="org.lwjgl.util.generator.ContextGeneratorProcessorFactory"/> | |
133 | <arg value="-cp"/> | |
134 | <arg path="${lwjgl.src}/java:${lwjgl.src.templates}:${lwjgl.bin}:${java.class.path}"/> | |
135 | <arg value="-s"/> | |
136 | <arg path="${lwjgl.src}/generated"/> | |
137 | <arg value="-Ageneratechecks"/> | |
138 | <arg value="-Acontextspecific"/> | |
139 | <fileset dir="${lwjgl.src.templates}" includes="${opengl-template-pattern}"/> | |
140 | </apply> | |
141 | </target> | |
142 | </project> | |
0 | <project name="generator"> | |
1 | ||
2 | <!-- clean the generated files --> | |
3 | <target name="clean-generated" description="Deletes the generated java and native source"> | |
4 | <delete quiet="true" failonerror="false"> | |
5 | <fileset dir="${lwjgl.src}/generated" includes="**"/> | |
6 | <fileset dir="${lwjgl.src.native}/generated" includes="**"/> | |
7 | </delete> | |
8 | </target> | |
9 | ||
10 | <!-- Compiles the Java generator source code --> | |
11 | <target name="generators" description="Compiles the native method generators"> | |
12 | <javac debug="yes" srcdir="${lwjgl.src}/java/" destdir="${lwjgl.bin}" includes="org/lwjgl/util/generator/**.java" source="1.5" target="1.5" taskname="generator"> | |
13 | <compilerarg value="-Xlint:all"/> | |
14 | </javac> | |
15 | <javac debug="yes" srcdir="${lwjgl.src}/java/" destdir="${lwjgl.bin}" source="1.4" target="1.4" taskname="generator"> | |
16 | <include name="org/lwjgl/opengl/GLSync.java"/> | |
17 | <include name="org/lwjgl/opengl/PointerWrapper.java"/> | |
18 | </javac> | |
19 | </target> | |
20 | ||
21 | <!-- Proxy target to generate it all --> | |
22 | <target name="generate-all" depends="generate-openal, generate-opengl, generate-opengl-capabilities, generate-opengl-references" description="Generates java and native source"/> | |
23 | ||
24 | <target name="generate-debug" depends="generate-openal-debug, generate-opengl-debug, generate-opengl-capabilities-debug, generate-opengl-references" description="Generates java and native source"/> | |
25 | ||
26 | <!-- Generate OpenAL --> | |
27 | <target name="generate-openal" depends="generators" description="Generates java and native source for AL"> | |
28 | <apply executable="apt" parallel="true"> | |
29 | <arg value="-nocompile"/> | |
30 | <arg value="-factory"/> | |
31 | <arg value="org.lwjgl.util.generator.GeneratorProcessorFactory"/> | |
32 | <arg value="-cp"/> | |
33 | <arg path="${lwjgl.src}/java:${lwjgl.src.templates}:${lwjgl.bin}:${java.class.path}"/> | |
34 | <arg value="-s"/> | |
35 | <arg path="${lwjgl.src}/generated"/> | |
36 | <arg value="-d"/> | |
37 | <arg path="${lwjgl.src.native}/generated"/> | |
38 | <arg value="-Atypemap=org.lwjgl.util.generator.ALTypeMap"/> | |
39 | <fileset dir="${lwjgl.src.templates}" includes="org/lwjgl/openal/AL10.java, org/lwjgl/openal/AL11.java"/> | |
40 | </apply> | |
41 | </target> | |
42 | ||
43 | <!-- Generate OpenAL [DEBUG] --> | |
44 | <target name="generate-openal-debug" depends="generators" description="Generates java and native source for AL"> | |
45 | <apply executable="apt" parallel="true"> | |
46 | <arg value="-nocompile"/> | |
47 | <arg value="-factory"/> | |
48 | <arg value="org.lwjgl.util.generator.GeneratorProcessorFactory"/> | |
49 | <arg value="-cp"/> | |
50 | <arg path="${lwjgl.src}/java:${lwjgl.src.templates}:${lwjgl.bin}:${java.class.path}"/> | |
51 | <arg value="-s"/> | |
52 | <arg path="${lwjgl.src}/generated"/> | |
53 | <arg value="-d"/> | |
54 | <arg path="${lwjgl.src.native}/generated"/> | |
55 | <arg value="-Atypemap=org.lwjgl.util.generator.ALTypeMap"/> | |
56 | <arg value="-Ageneratechecks"/> | |
57 | <fileset dir="${lwjgl.src.templates}" includes="org/lwjgl/openal/AL10.java, org/lwjgl/openal/AL11.java"/> | |
58 | </apply> | |
59 | </target> | |
60 | ||
61 | <!-- Generate OpenGL --> | |
62 | <target name="generate-opengl" depends="generators" description="Generates java and native source for GL"> | |
63 | <apply executable="apt" parallel="true"> | |
64 | <arg value="-nocompile"/> | |
65 | <arg value="-factory"/> | |
66 | <arg value="org.lwjgl.util.generator.GeneratorProcessorFactory"/> | |
67 | <arg value="-cp"/> | |
68 | <arg path="${lwjgl.src}/java:${lwjgl.src.templates}:${lwjgl.bin}:${java.class.path}"/> | |
69 | <arg value="-s"/> | |
70 | <arg path="${lwjgl.src}/generated"/> | |
71 | <arg value="-d"/> | |
72 | <arg path="${lwjgl.src.native}/generated"/> | |
73 | <arg value="-Acontextspecific"/> | |
74 | <arg value="-Atypemap=org.lwjgl.util.generator.GLTypeMap"/> | |
75 | <fileset dir="${lwjgl.src.templates}" includes="${opengl-template-pattern}"/> | |
76 | </apply> | |
77 | </target> | |
78 | ||
79 | <!-- Generate OpenGL [DEBUG] --> | |
80 | <target name="generate-opengl-debug" depends="generators" description="Generates java and native source for GL"> | |
81 | <apply executable="apt" parallel="true"> | |
82 | <arg value="-nocompile"/> | |
83 | <arg value="-factory"/> | |
84 | <arg value="org.lwjgl.util.generator.GeneratorProcessorFactory"/> | |
85 | <arg value="-cp"/> | |
86 | <arg path="${lwjgl.src}/java:${lwjgl.src.templates}:${lwjgl.bin}:${java.class.path}"/> | |
87 | <arg value="-s"/> | |
88 | <arg path="${lwjgl.src}/generated"/> | |
89 | <arg value="-d"/> | |
90 | <arg path="${lwjgl.src.native}/generated"/> | |
91 | <arg value="-Ageneratechecks"/> | |
92 | <arg value="-Acontextspecific"/> | |
93 | <arg value="-Atypemap=org.lwjgl.util.generator.GLTypeMap"/> | |
94 | <fileset dir="${lwjgl.src.templates}" includes="${opengl-template-pattern}"/> | |
95 | </apply> | |
96 | </target> | |
97 | ||
98 | <!-- Generate references --> | |
99 | <target name="generate-opengl-references" depends="generators" description="Generates java and native source for GL"> | |
100 | <apply executable="apt" parallel="true"> | |
101 | <arg value="-nocompile"/> | |
102 | <arg value="-factory"/> | |
103 | <arg value="org.lwjgl.util.generator.ReferencesGeneratorProcessorFactory"/> | |
104 | <arg value="-cp"/> | |
105 | <arg path="${lwjgl.src}/java:${lwjgl.src.templates}:${lwjgl.bin}:${java.class.path}"/> | |
106 | <arg value="-s"/> | |
107 | <arg path="${lwjgl.src}/generated"/> | |
108 | <fileset dir="${lwjgl.src.templates}" includes="${opengl-template-pattern}"/> | |
109 | </apply> | |
110 | </target> | |
111 | ||
112 | <!-- Generate context capabilities --> | |
113 | <target name="generate-opengl-capabilities" depends="generators" description="Generates java and native source for GL"> | |
114 | <apply executable="apt" parallel="true"> | |
115 | <arg value="-nocompile"/> | |
116 | <arg value="-factory"/> | |
117 | <arg value="org.lwjgl.util.generator.ContextGeneratorProcessorFactory"/> | |
118 | <arg value="-cp"/> | |
119 | <arg path="${lwjgl.src}/java:${lwjgl.src.templates}:${lwjgl.bin}:${java.class.path}"/> | |
120 | <arg value="-s"/> | |
121 | <arg path="${lwjgl.src}/generated"/> | |
122 | <arg value="-Acontextspecific"/> | |
123 | <fileset dir="${lwjgl.src.templates}" includes="${opengl-template-pattern}"/> | |
124 | </apply> | |
125 | </target> | |
126 | ||
127 | <!-- Generate context capabilities [DEBUG] --> | |
128 | <target name="generate-opengl-capabilities-debug" depends="generators" description="Generates java and native source for GL"> | |
129 | <apply executable="apt" parallel="true"> | |
130 | <arg value="-nocompile"/> | |
131 | <arg value="-factory"/> | |
132 | <arg value="org.lwjgl.util.generator.ContextGeneratorProcessorFactory"/> | |
133 | <arg value="-cp"/> | |
134 | <arg path="${lwjgl.src}/java:${lwjgl.src.templates}:${lwjgl.bin}:${java.class.path}"/> | |
135 | <arg value="-s"/> | |
136 | <arg path="${lwjgl.src}/generated"/> | |
137 | <arg value="-Ageneratechecks"/> | |
138 | <arg value="-Acontextspecific"/> | |
139 | <fileset dir="${lwjgl.src.templates}" includes="${opengl-template-pattern}"/> | |
140 | </apply> | |
141 | </target> | |
142 | </project> |
0 | <project name="webstart"> | |
1 | <target name="webstart_demo" depends="jars"> | |
2 | <antcall target="-webstart_demo"> | |
3 | <param name="keystore" value="applet/lwjglkeystore"/> | |
4 | <param name="alias" value="lwjgl"/> | |
5 | <param name="password" value="123456"/> | |
6 | </antcall> | |
7 | </target> | |
8 | ||
9 | <target name="webstart_demo-release" depends="jars"> | |
10 | <input message="Please type the password for the keystore" addproperty="sign.pwd"/> | |
11 | ||
12 | <antcall target="-webstart_demo"> | |
13 | <param name="keystore" value="signing/matzon_java_code_signing.keystore"/> | |
14 | <param name="alias" value="oddlabs_java_code_signing"/> | |
15 | <param name="password" value="${sign.pwd}"/> | |
16 | </antcall> | |
17 | </target> | |
18 | ||
19 | <!-- --> | |
20 | <target name="-webstart_demo" description="Using released files, creates the necessary files used for jnlp demos"> | |
21 | ||
22 | <!-- delete existing temp --> | |
23 | <delete dir="${lwjgl.temp}"/> | |
24 | ||
25 | <!-- unzip common files --> | |
26 | <unzip src="${lwjgl.dist}/lwjgl-${lwjgl.version}.zip" dest="${lwjgl.temp}/jnlp/temp" overwrite="true"/> | |
27 | ||
28 | <!-- move files to unified structure --> | |
29 | <move todir="${lwjgl.temp}/jnlp/temp"> | |
30 | <fileset dir="${lwjgl.temp}/jnlp/temp/lwjgl-${lwjgl.version}/"> | |
31 | <include name="**"/> | |
32 | </fileset> | |
33 | </move> | |
34 | ||
35 | <!-- move relevant files to root --> | |
36 | <move todir="${lwjgl.temp}/jnlp/" flatten="true"> | |
37 | <fileset dir="${lwjgl.temp}/jnlp/temp"> | |
38 | <include name="**/**.jar"/> | |
39 | </fileset> | |
40 | </move> | |
41 | ||
42 | <!-- create native jars --> | |
43 | <jar destfile="${lwjgl.temp}/jnlp/native_windows.jar" basedir="${lwjgl.temp}/jnlp/temp/native/windows"/> | |
44 | <jar destfile="${lwjgl.temp}/jnlp/native_linux.jar" basedir="${lwjgl.temp}/jnlp/temp/native/linux"/> | |
45 | <jar destfile="${lwjgl.temp}/jnlp/native_macosx.jar" basedir="${lwjgl.temp}/jnlp/temp/native/macosx"/> | |
46 | <jar destfile="${lwjgl.temp}/jnlp/native_solaris.jar" basedir="${lwjgl.temp}/jnlp/temp/native/solaris"/> | |
47 | ||
48 | <!-- create media jar --> | |
49 | <jar destfile="${lwjgl.temp}/jnlp/media.jar" basedir="${lwjgl.res}"/> | |
50 | ||
51 | <!-- sign 'em --> | |
52 | <signjar jar="${lwjgl.temp}/jnlp/lwjgl.jar" alias="${alias}" keystore="${keystore}" storepass="${password}"/> | |
53 | <signjar jar="${lwjgl.temp}/jnlp/lwjgl_util.jar" alias="${alias}" keystore="${keystore}" storepass="${password}"/> | |
54 | <signjar jar="${lwjgl.temp}/jnlp/native_solaris.jar" alias="${alias}" keystore="${keystore}" storepass="${password}"/> | |
55 | <signjar jar="${lwjgl.temp}/jnlp/native_linux.jar" alias="${alias}" keystore="${keystore}" storepass="${password}"/> | |
56 | <signjar jar="${lwjgl.temp}/jnlp/native_macosx.jar" alias="${alias}" keystore="${keystore}" storepass="${password}"/> | |
57 | <signjar jar="${lwjgl.temp}/jnlp/native_windows.jar" alias="${alias}" keystore="${keystore}" storepass="${password}"/> | |
58 | <signjar jar="${lwjgl.temp}/jnlp/jinput.jar" alias="${alias}" keystore="${keystore}" storepass="${password}"/> | |
59 | </target> | |
0 | <project name="webstart"> | |
1 | <target name="webstart_demo" depends="jars"> | |
2 | <antcall target="-webstart_demo"> | |
3 | <param name="keystore" value="applet/lwjglkeystore"/> | |
4 | <param name="alias" value="lwjgl"/> | |
5 | <param name="password" value="123456"/> | |
6 | </antcall> | |
7 | </target> | |
8 | ||
9 | <target name="webstart_demo-release" depends="jars"> | |
10 | <input message="Please type the password for the keystore" addproperty="sign.pwd"/> | |
11 | ||
12 | <antcall target="-webstart_demo"> | |
13 | <param name="keystore" value="signing/matzon_java_code_signing.keystore"/> | |
14 | <param name="alias" value="oddlabs_java_code_signing"/> | |
15 | <param name="password" value="${sign.pwd}"/> | |
16 | </antcall> | |
17 | </target> | |
18 | ||
19 | <!-- --> | |
20 | <target name="-webstart_demo" description="Using released files, creates the necessary files used for jnlp demos"> | |
21 | ||
22 | <!-- delete existing temp --> | |
23 | <delete dir="${lwjgl.temp}"/> | |
24 | ||
25 | <!-- unzip common files --> | |
26 | <unzip src="${lwjgl.dist}/lwjgl-${lwjgl.version}.zip" dest="${lwjgl.temp}/jnlp/temp" overwrite="true"/> | |
27 | ||
28 | <!-- move files to unified structure --> | |
29 | <move todir="${lwjgl.temp}/jnlp/temp"> | |
30 | <fileset dir="${lwjgl.temp}/jnlp/temp/lwjgl-${lwjgl.version}/"> | |
31 | <include name="**"/> | |
32 | </fileset> | |
33 | </move> | |
34 | ||
35 | <!-- move relevant files to root --> | |
36 | <move todir="${lwjgl.temp}/jnlp/" flatten="true"> | |
37 | <fileset dir="${lwjgl.temp}/jnlp/temp"> | |
38 | <include name="**/**.jar"/> | |
39 | </fileset> | |
40 | </move> | |
41 | ||
42 | <!-- create native jars --> | |
43 | <jar destfile="${lwjgl.temp}/jnlp/native_windows.jar" basedir="${lwjgl.temp}/jnlp/temp/native/windows"/> | |
44 | <jar destfile="${lwjgl.temp}/jnlp/native_linux.jar" basedir="${lwjgl.temp}/jnlp/temp/native/linux"/> | |
45 | <jar destfile="${lwjgl.temp}/jnlp/native_macosx.jar" basedir="${lwjgl.temp}/jnlp/temp/native/macosx"/> | |
46 | <jar destfile="${lwjgl.temp}/jnlp/native_solaris.jar" basedir="${lwjgl.temp}/jnlp/temp/native/solaris"/> | |
47 | ||
48 | <!-- create media jar --> | |
49 | <jar destfile="${lwjgl.temp}/jnlp/media.jar" basedir="${lwjgl.res}"/> | |
50 | ||
51 | <!-- sign 'em --> | |
52 | <signjar jar="${lwjgl.temp}/jnlp/lwjgl.jar" alias="${alias}" keystore="${keystore}" storepass="${password}"/> | |
53 | <signjar jar="${lwjgl.temp}/jnlp/lwjgl_util.jar" alias="${alias}" keystore="${keystore}" storepass="${password}"/> | |
54 | <signjar jar="${lwjgl.temp}/jnlp/native_solaris.jar" alias="${alias}" keystore="${keystore}" storepass="${password}"/> | |
55 | <signjar jar="${lwjgl.temp}/jnlp/native_linux.jar" alias="${alias}" keystore="${keystore}" storepass="${password}"/> | |
56 | <signjar jar="${lwjgl.temp}/jnlp/native_macosx.jar" alias="${alias}" keystore="${keystore}" storepass="${password}"/> | |
57 | <signjar jar="${lwjgl.temp}/jnlp/native_windows.jar" alias="${alias}" keystore="${keystore}" storepass="${password}"/> | |
58 | <signjar jar="${lwjgl.temp}/jnlp/jinput.jar" alias="${alias}" keystore="${keystore}" storepass="${password}"/> | |
59 | </target> | |
60 | 60 | </project>⏎ |
0 | <project name="webstart"> | |
1 | <target name="webstart_demo" depends="jars"> | |
2 | <antcall target="-webstart_demo"> | |
3 | <param name="keystore" value="applet/lwjglkeystore"/> | |
4 | <param name="alias" value="lwjgl"/> | |
5 | <param name="password" value="123456"/> | |
6 | </antcall> | |
7 | </target> | |
8 | ||
9 | <target name="webstart_demo-release"> | |
10 | <input message="Please type the password for the keystore" addproperty="sign.pwd"/> | |
11 | ||
12 | <antcall target="-webstart_demo"> | |
13 | <param name="keystore" value="signing/matzon_java_code_signing.keystore"/> | |
14 | <param name="alias" value="oddlabs_java_code_signing"/> | |
15 | <param name="password" value="${sign.pwd}"/> | |
16 | </antcall> | |
17 | </target> | |
18 | ||
19 | <!-- --> | |
20 | <target name="-webstart_demo" description="Using released files, creates the necessary files used for jnlp demos"> | |
21 | ||
22 | <!-- delete existing temp --> | |
23 | <delete dir="${lwjgl.temp}"/> | |
24 | ||
25 | <!-- unzip common files --> | |
26 | <unzip src="${lwjgl.dist}/lwjgl-${lwjgl.version}.zip" dest="${lwjgl.temp}/jnlp/temp" overwrite="true"/> | |
27 | ||
28 | <!-- move files to unified structure --> | |
29 | <move todir="${lwjgl.temp}/jnlp/temp"> | |
30 | <fileset dir="${lwjgl.temp}/jnlp/temp/lwjgl-${lwjgl.version}/"> | |
31 | <include name="**"/> | |
32 | </fileset> | |
33 | </move> | |
34 | ||
35 | <!-- move relevant files to root --> | |
36 | <move todir="${lwjgl.temp}/jnlp/" flatten="true"> | |
37 | <fileset dir="${lwjgl.temp}/jnlp/temp"> | |
38 | <include name="**/**.jar"/> | |
39 | </fileset> | |
40 | </move> | |
41 | ||
42 | <!-- create native jars --> | |
43 | <jar destfile="${lwjgl.temp}/jnlp/native_windows.jar" basedir="${lwjgl.temp}/jnlp/temp/native/windows"/> | |
44 | <jar destfile="${lwjgl.temp}/jnlp/native_linux.jar" basedir="${lwjgl.temp}/jnlp/temp/native/linux"/> | |
45 | <jar destfile="${lwjgl.temp}/jnlp/native_macosx.jar" basedir="${lwjgl.temp}/jnlp/temp/native/macosx"/> | |
46 | <jar destfile="${lwjgl.temp}/jnlp/native_solaris.jar" basedir="${lwjgl.temp}/jnlp/temp/native/solaris"/> | |
47 | ||
48 | <!-- add media and trusted info --> | |
49 | <jar destfile="${lwjgl.temp}/jnlp/lwjgl_test.jar" update="true"> | |
50 | <manifest> | |
51 | <attribute name="Sealed" value="true"/> | |
52 | <attribute name="Trusted-Only" value="true"/> | |
53 | </manifest> | |
54 | </jar> | |
55 | ||
56 | <jar destfile="${lwjgl.temp}/jnlp/lwjgl_util.jar" update="true"> | |
57 | <fileset dir="${lwjgl.res}"/> | |
58 | <manifest> | |
59 | <attribute name="Sealed" value="true"/> | |
60 | <attribute name="Trusted-Library" value="true"/> | |
61 | </manifest> | |
62 | </jar> | |
63 | ||
64 | <jar destfile="${lwjgl.temp}/jnlp/jinput.jar" update="true"> | |
65 | <manifest> | |
66 | <attribute name="Sealed" value="true"/> | |
67 | <attribute name="Trusted-Library" value="true"/> | |
68 | </manifest> | |
69 | </jar> | |
70 | ||
71 | <!-- sign 'em --> | |
72 | <signjar jar="${lwjgl.temp}/jnlp/lwjgl.jar" alias="${alias}" keystore="${keystore}" storepass="${password}"/> | |
73 | <signjar jar="${lwjgl.temp}/jnlp/lwjgl_util.jar" alias="${alias}" keystore="${keystore}" storepass="${password}"/> | |
74 | <signjar jar="${lwjgl.temp}/jnlp/jinput.jar" alias="${alias}" keystore="${keystore}" storepass="${password}"/> | |
75 | ||
76 | <signjar jar="${lwjgl.temp}/jnlp/native_solaris.jar" alias="${alias}" keystore="${keystore}" storepass="${password}"/> | |
77 | <signjar jar="${lwjgl.temp}/jnlp/native_linux.jar" alias="${alias}" keystore="${keystore}" storepass="${password}"/> | |
78 | <signjar jar="${lwjgl.temp}/jnlp/native_macosx.jar" alias="${alias}" keystore="${keystore}" storepass="${password}"/> | |
79 | <signjar jar="${lwjgl.temp}/jnlp/native_windows.jar" alias="${alias}" keystore="${keystore}" storepass="${password}"/> | |
80 | ||
81 | <signjar jar="${lwjgl.temp}/jnlp/lwjgl_test.jar" alias="${alias}" keystore="${keystore}" storepass="${password}"/> | |
82 | ||
83 | </target> | |
0 | <project name="webstart"> | |
1 | <target name="webstart_demo" depends="jars"> | |
2 | <antcall target="-webstart_demo"> | |
3 | <param name="keystore" value="applet/lwjglkeystore"/> | |
4 | <param name="alias" value="lwjgl"/> | |
5 | <param name="password" value="123456"/> | |
6 | </antcall> | |
7 | </target> | |
8 | ||
9 | <target name="webstart_demo-release"> | |
10 | <input message="Please type the password for the keystore" addproperty="sign.pwd"/> | |
11 | ||
12 | <antcall target="-webstart_demo"> | |
13 | <param name="keystore" value="signing/matzon_java_code_signing.keystore"/> | |
14 | <param name="alias" value="oddlabs_java_code_signing"/> | |
15 | <param name="password" value="${sign.pwd}"/> | |
16 | </antcall> | |
17 | </target> | |
18 | ||
19 | <!-- --> | |
20 | <target name="-webstart_demo" description="Using released files, creates the necessary files used for jnlp demos"> | |
21 | ||
22 | <!-- delete existing temp --> | |
23 | <delete dir="${lwjgl.temp}"/> | |
24 | ||
25 | <!-- unzip common files --> | |
26 | <unzip src="${lwjgl.dist}/lwjgl-${lwjgl.version}.zip" dest="${lwjgl.temp}/jnlp/temp" overwrite="true"/> | |
27 | ||
28 | <!-- move files to unified structure --> | |
29 | <move todir="${lwjgl.temp}/jnlp/temp"> | |
30 | <fileset dir="${lwjgl.temp}/jnlp/temp/lwjgl-${lwjgl.version}/"> | |
31 | <include name="**"/> | |
32 | </fileset> | |
33 | </move> | |
34 | ||
35 | <!-- move relevant files to root --> | |
36 | <move todir="${lwjgl.temp}/jnlp/" flatten="true"> | |
37 | <fileset dir="${lwjgl.temp}/jnlp/temp"> | |
38 | <include name="**/**.jar"/> | |
39 | </fileset> | |
40 | </move> | |
41 | ||
42 | <!-- create native jars --> | |
43 | <jar destfile="${lwjgl.temp}/jnlp/native_windows.jar" basedir="${lwjgl.temp}/jnlp/temp/native/windows"/> | |
44 | <jar destfile="${lwjgl.temp}/jnlp/native_linux.jar" basedir="${lwjgl.temp}/jnlp/temp/native/linux"/> | |
45 | <jar destfile="${lwjgl.temp}/jnlp/native_macosx.jar" basedir="${lwjgl.temp}/jnlp/temp/native/macosx"/> | |
46 | <jar destfile="${lwjgl.temp}/jnlp/native_solaris.jar" basedir="${lwjgl.temp}/jnlp/temp/native/solaris"/> | |
47 | ||
48 | <!-- add media and trusted info --> | |
49 | <jar destfile="${lwjgl.temp}/jnlp/lwjgl_test.jar" update="true"> | |
50 | <manifest> | |
51 | <attribute name="Sealed" value="true"/> | |
52 | <attribute name="Trusted-Only" value="true"/> | |
53 | </manifest> | |
54 | </jar> | |
55 | ||
56 | <jar destfile="${lwjgl.temp}/jnlp/lwjgl_util.jar" update="true"> | |
57 | <fileset dir="${lwjgl.res}"/> | |
58 | <manifest> | |
59 | <attribute name="Sealed" value="true"/> | |
60 | <attribute name="Trusted-Library" value="true"/> | |
61 | </manifest> | |
62 | </jar> | |
63 | ||
64 | <jar destfile="${lwjgl.temp}/jnlp/jinput.jar" update="true"> | |
65 | <manifest> | |
66 | <attribute name="Sealed" value="true"/> | |
67 | <attribute name="Trusted-Library" value="true"/> | |
68 | </manifest> | |
69 | </jar> | |
70 | ||
71 | <!-- sign 'em --> | |
72 | <signjar jar="${lwjgl.temp}/jnlp/lwjgl.jar" alias="${alias}" keystore="${keystore}" storepass="${password}"/> | |
73 | <signjar jar="${lwjgl.temp}/jnlp/lwjgl_util.jar" alias="${alias}" keystore="${keystore}" storepass="${password}"/> | |
74 | <signjar jar="${lwjgl.temp}/jnlp/jinput.jar" alias="${alias}" keystore="${keystore}" storepass="${password}"/> | |
75 | ||
76 | <signjar jar="${lwjgl.temp}/jnlp/native_solaris.jar" alias="${alias}" keystore="${keystore}" storepass="${password}"/> | |
77 | <signjar jar="${lwjgl.temp}/jnlp/native_linux.jar" alias="${alias}" keystore="${keystore}" storepass="${password}"/> | |
78 | <signjar jar="${lwjgl.temp}/jnlp/native_macosx.jar" alias="${alias}" keystore="${keystore}" storepass="${password}"/> | |
79 | <signjar jar="${lwjgl.temp}/jnlp/native_windows.jar" alias="${alias}" keystore="${keystore}" storepass="${password}"/> | |
80 | ||
81 | <signjar jar="${lwjgl.temp}/jnlp/lwjgl_test.jar" alias="${alias}" keystore="${keystore}" storepass="${password}"/> | |
82 | ||
83 | </target> | |
84 | 84 | </project>⏎ |
0 | <?xml version="1.0"?> | |
1 | ||
2 | <project name="lwjgl native code, native code" basedir="../../bin/lwjgl" default="compile"> | |
3 | <property name="native" location="../../src/native"/> | |
4 | <property environment="env"/> | |
5 | <property name="mingwprefix" location="x86_64-pc-mingw32-"/> | |
6 | <property name="mingwhome" location="c:/MinGW64"/> | |
7 | <property name="strip" location="${mingwhome}/${mingwprefix}strip"/> | |
8 | <property name="gcc" location="${mingwhome}/${mingwprefix}gcc"/> | |
9 | <property name="dlltool" location="${mingwhome}/${mingwprefix}dlltool"/> | |
10 | <property name="dllname" value="lwjgl64.dll"/> | |
11 | ||
12 | <target name="compile_dir"> | |
13 | <apply dir="." failonerror="true" executable="${gcc}" dest="." skipemptyfilesets="true"> | |
14 | <arg line="-c -Wall -O2 -std=gnu99 -D_JNI_IMPLEMENTATION_"/> | |
15 | <arg value="-I${dxhome}/include"/> | |
16 | <arg value="-I${alhome}/include"/> | |
17 | <arg value="-I${jdkhome}/include"/> | |
18 | <arg value="-I${jdkhome}/include/win32"/> | |
19 | <arg value="-I${native}/common"/> | |
20 | <arg value="-I${native}/windows"/> | |
21 | <srcfile/> | |
22 | <fileset dir="${native}/windows" includes="*.c"/> | |
23 | <fileset dir="${native}/common" includes="*.c"/> | |
24 | <fileset dir="${native}/generated" includes="*.c"/> | |
25 | <mapper type="glob" from="*.c" to="*.o"/> | |
26 | </apply> | |
27 | </target> | |
28 | ||
29 | <target name="link"> | |
30 | <echo file="jawt.def"> | |
31 | EXPORTS | |
32 | JAWT_GetAWT | |
33 | </echo> | |
34 | <exec dir="." executable="${dlltool}" failonerror="true"> | |
35 | <arg line="--def jawt.def --kill-at --dllname jawt.dll --output-lib libjawt.a"/> | |
36 | </exec> | |
37 | <apply dir="." parallel="true" executable="${gcc}" failonerror="true"> | |
38 | <arg value="-Wl,--kill-at"/> | |
39 | <arg line="-shared -o ${dllname}"/> | |
40 | <srcfile/> | |
41 | <arg line="libjawt.a"/> | |
42 | <arg value="-L${java.home}/../lib"/> | |
43 | <arg value="-L${alhome}/libs"/> | |
44 | <arg line="${libs}"/> | |
45 | <fileset dir="." includes="*.o"/> | |
46 | </apply> | |
47 | </target> | |
48 | ||
49 | <target name="clean"> | |
50 | <delete> | |
51 | <fileset dir="." includes="*.o"/> | |
52 | <fileset dir="." includes="*.dll"/> | |
53 | </delete> | |
54 | </target> | |
55 | ||
56 | <target name="compile"> | |
57 | <property name="libs" value="-lkernel32 -lole32 -lopengl32 -lversion -luser32 -lgdi32 -ladvapi32 -lwinmm"/> | |
58 | <antcall target="compile_dir"/> | |
59 | <antcall target="link"/> | |
60 | <apply dir="." executable="${strip}"> | |
61 | <fileset file="${dllname}"/> | |
62 | </apply> | |
63 | </target> | |
64 | </project> | |
65 | ||
0 | <?xml version="1.0"?> | |
1 | ||
2 | <project name="lwjgl native code, native code" basedir="../../bin/lwjgl" default="compile"> | |
3 | <property name="native" location="../../src/native"/> | |
4 | <property environment="env"/> | |
5 | <property name="mingwprefix" location="x86_64-pc-mingw32-"/> | |
6 | <property name="mingwhome" location="c:/MinGW64"/> | |
7 | <property name="strip" location="${mingwhome}/${mingwprefix}strip"/> | |
8 | <property name="gcc" location="${mingwhome}/${mingwprefix}gcc"/> | |
9 | <property name="dlltool" location="${mingwhome}/${mingwprefix}dlltool"/> | |
10 | <property name="dllname" value="lwjgl64.dll"/> | |
11 | ||
12 | <target name="compile_dir"> | |
13 | <apply dir="." failonerror="true" executable="${gcc}" dest="." skipemptyfilesets="true"> | |
14 | <arg line="-c -Wall -O2 -std=gnu99 -D_JNI_IMPLEMENTATION_"/> | |
15 | <arg value="-I${dxhome}/include"/> | |
16 | <arg value="-I${alhome}/include"/> | |
17 | <arg value="-I${jdkhome}/include"/> | |
18 | <arg value="-I${jdkhome}/include/win32"/> | |
19 | <arg value="-I${native}/common"/> | |
20 | <arg value="-I${native}/windows"/> | |
21 | <srcfile/> | |
22 | <fileset dir="${native}/windows" includes="*.c"/> | |
23 | <fileset dir="${native}/common" includes="*.c"/> | |
24 | <fileset dir="${native}/generated" includes="*.c"/> | |
25 | <mapper type="glob" from="*.c" to="*.o"/> | |
26 | </apply> | |
27 | </target> | |
28 | ||
29 | <target name="link"> | |
30 | <echo file="jawt.def"> | |
31 | EXPORTS | |
32 | JAWT_GetAWT | |
33 | </echo> | |
34 | <exec dir="." executable="${dlltool}" failonerror="true"> | |
35 | <arg line="--def jawt.def --kill-at --dllname jawt.dll --output-lib libjawt.a"/> | |
36 | </exec> | |
37 | <apply dir="." parallel="true" executable="${gcc}" failonerror="true"> | |
38 | <arg value="-Wl,--kill-at"/> | |
39 | <arg line="-shared -o ${dllname}"/> | |
40 | <srcfile/> | |
41 | <arg line="libjawt.a"/> | |
42 | <arg value="-L${java.home}/../lib"/> | |
43 | <arg value="-L${alhome}/libs"/> | |
44 | <arg line="${libs}"/> | |
45 | <fileset dir="." includes="*.o"/> | |
46 | </apply> | |
47 | </target> | |
48 | ||
49 | <target name="clean"> | |
50 | <delete> | |
51 | <fileset dir="." includes="*.o"/> | |
52 | <fileset dir="." includes="*.dll"/> | |
53 | </delete> | |
54 | </target> | |
55 | ||
56 | <target name="compile"> | |
57 | <property name="libs" value="-lkernel32 -lole32 -lopengl32 -lversion -luser32 -lgdi32 -ladvapi32 -lwinmm"/> | |
58 | <antcall target="compile_dir"/> | |
59 | <antcall target="link"/> | |
60 | <apply dir="." executable="${strip}"> | |
61 | <fileset file="${dllname}"/> | |
62 | </apply> | |
63 | </target> | |
64 | </project> | |
65 |
0 | <?xml version="1.0"?> | |
1 | ||
2 | <project name="lwjgl native code, native code" basedir="../../bin/lwjgl" default="compile"> | |
3 | <property name="native" location="../../src/native"/> | |
4 | <property environment="env"/> | |
5 | <property name="sdkhome" location="${env.MSSDK}"/> | |
6 | ||
7 | <target name="compile_dir"> | |
8 | <apply dir="." failonerror="true" executable="cl" dest="." skipemptyfilesets="true"> | |
9 | <arg line="/Ox /W2 /nologo /Ox /Ob2 /Oi /Ot /Oy /FD /EHsc /MT /Gy /W2 /nologo /c"/> | |
10 | <arg value="/I${sdkhome}\include"/> | |
11 | <arg value="/I${java.home}\..\include"/> | |
12 | <arg value="/I${java.home}\..\include\win32"/> | |
13 | <arg value="/I${native}\common"/> | |
14 | <arg value="/I${native}\windows"/> | |
15 | <srcfile/> | |
16 | <fileset dir="${native}/windows" includes="*.c"/> | |
17 | <fileset dir="${native}/common" includes="*.c"/> | |
18 | <fileset dir="${native}/generated" includes="*.c"/> | |
19 | <mapper type="glob" from="*.c" to="*.obj"/> | |
20 | </apply> | |
21 | </target> | |
22 | ||
23 | <target name="link"> | |
24 | <apply dir="." parallel="true" executable="cl" failonerror="true"> | |
25 | <arg line="/LD /nologo"/> | |
26 | <srcfile/> | |
27 | <arg line="/Fe${dllname} /link"/> | |
28 | <arg value="/LIBPATH:${java.home}\..\lib"/> | |
29 | <arg value="/LIBPATH:${sdkhomelib}"/> | |
30 | <arg value="/OPT:REF"/> | |
31 | <arg value="/OPT:ICF"/> | |
32 | <arg line="/DLL /DELAYLOAD:jawt.dll ${libs}"/> | |
33 | <fileset dir="." includes="*.obj"/> | |
34 | </apply> | |
35 | </target> | |
36 | ||
37 | <target name="clean"> | |
38 | <delete> | |
39 | <fileset dir="." includes="*.obj"/> | |
40 | <fileset dir="." includes="*.dll"/> | |
41 | <fileset dir="." includes="*.exp"/> | |
42 | <fileset dir="." includes="*.lib"/> | |
43 | </delete> | |
44 | </target> | |
45 | ||
46 | <target name="compile"> | |
47 | <condition property="sdkhomelib" value="${sdkhome}\lib" else="${sdkhome}\lib\x64"> | |
48 | <equals arg1="${os.arch}" arg2="x86"/> | |
49 | </condition> | |
50 | <condition property="dllname" value="lwjgl.dll" else="lwjgl64.dll"> | |
51 | <equals arg1="${os.arch}" arg2="x86"/> | |
52 | </condition> | |
53 | <echo message="${sdkhomelib}"/> | |
54 | <property name="libs" value="Kernel32.lib ole32.lib OpenGL32.Lib Version.lib user32.lib Gdi32.lib Advapi32.lib jawt.lib delayimp.lib winmm.lib Comctl32.lib"/> | |
55 | <antcall target="compile_dir"/> | |
56 | <antcall target="link"/> | |
57 | </target> | |
58 | </project> | |
59 | ||
0 | <?xml version="1.0"?> | |
1 | ||
2 | <project name="lwjgl native code, native code" basedir="../../bin/lwjgl" default="compile"> | |
3 | <property name="native" location="../../src/native"/> | |
4 | <property environment="env"/> | |
5 | <property name="sdkhome" location="${env.MSSDK}"/> | |
6 | ||
7 | <target name="compile_dir"> | |
8 | <apply dir="." failonerror="true" executable="cl" dest="." skipemptyfilesets="true"> | |
9 | <arg line="/Ox /W2 /nologo /Ox /Ob2 /Oi /Ot /Oy /FD /EHsc /MT /Gy /W2 /nologo /c"/> | |
10 | <arg value="/I${sdkhome}\include"/> | |
11 | <arg value="/I${java.home}\..\include"/> | |
12 | <arg value="/I${java.home}\..\include\win32"/> | |
13 | <arg value="/I${native}\common"/> | |
14 | <arg value="/I${native}\windows"/> | |
15 | <srcfile/> | |
16 | <fileset dir="${native}/windows" includes="*.c"/> | |
17 | <fileset dir="${native}/common" includes="*.c"/> | |
18 | <fileset dir="${native}/generated" includes="*.c"/> | |
19 | <mapper type="glob" from="*.c" to="*.obj"/> | |
20 | </apply> | |
21 | </target> | |
22 | ||
23 | <target name="link"> | |
24 | <apply dir="." parallel="true" executable="cl" failonerror="true"> | |
25 | <arg line="/LD /nologo"/> | |
26 | <srcfile/> | |
27 | <arg line="/Fe${dllname} /link"/> | |
28 | <arg value="/LIBPATH:${java.home}\..\lib"/> | |
29 | <arg value="/LIBPATH:${sdkhomelib}"/> | |
30 | <arg value="/OPT:REF"/> | |
31 | <arg value="/OPT:ICF"/> | |
32 | <arg line="/DLL /DELAYLOAD:jawt.dll ${libs}"/> | |
33 | <fileset dir="." includes="*.obj"/> | |
34 | </apply> | |
35 | </target> | |
36 | ||
37 | <target name="clean"> | |
38 | <delete> | |
39 | <fileset dir="." includes="*.obj"/> | |
40 | <fileset dir="." includes="*.dll"/> | |
41 | <fileset dir="." includes="*.exp"/> | |
42 | <fileset dir="." includes="*.lib"/> | |
43 | </delete> | |
44 | </target> | |
45 | ||
46 | <target name="compile"> | |
47 | <condition property="sdkhomelib" value="${sdkhome}\lib" else="${sdkhome}\lib\x64"> | |
48 | <equals arg1="${os.arch}" arg2="x86"/> | |
49 | </condition> | |
50 | <condition property="dllname" value="lwjgl.dll" else="lwjgl64.dll"> | |
51 | <equals arg1="${os.arch}" arg2="x86"/> | |
52 | </condition> | |
53 | <echo message="${sdkhomelib}"/> | |
54 | <property name="libs" value="Kernel32.lib ole32.lib OpenGL32.Lib Version.lib user32.lib Gdi32.lib Advapi32.lib jawt.lib delayimp.lib winmm.lib Comctl32.lib"/> | |
55 | <antcall target="compile_dir"/> | |
56 | <antcall target="link"/> | |
57 | </target> | |
58 | </project> | |
59 |
0 | /* | |
1 | * Copyright (c) 2002-2008 LWJGL Project | |
2 | * All rights reserved. | |
3 | * | |
4 | * Redistribution and use in source and binary forms, with or without | |
5 | * modification, are permitted provided that the following conditions are | |
6 | * met: | |
7 | * | |
8 | * * Redistributions of source code must retain the above copyright | |
9 | * notice, this list of conditions and the following disclaimer. | |
10 | * | |
11 | * * Redistributions in binary form must reproduce the above copyright | |
12 | * notice, this list of conditions and the following disclaimer in the | |
13 | * documentation and/or other materials provided with the distribution. | |
14 | * | |
15 | * * Neither the name of 'LWJGL' nor the names of | |
16 | * its contributors may be used to endorse or promote products derived | |
17 | * from this software without specific prior written permission. | |
18 | * | |
19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |
20 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | |
21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
22 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR | |
23 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | |
24 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | |
25 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | |
26 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF | |
27 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | |
28 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | |
29 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
30 | */ | |
31 | package org.lwjgl; | |
32 | ||
33 | import java.nio.Buffer; | |
34 | import java.nio.ByteBuffer; | |
35 | import java.nio.DoubleBuffer; | |
36 | import java.nio.FloatBuffer; | |
37 | import java.nio.IntBuffer; | |
38 | import java.nio.ShortBuffer; | |
39 | import java.nio.LongBuffer; | |
40 | ||
41 | /** | |
42 | * <p>A class to check buffer boundaries in general. If there is unsufficient space | |
43 | * in the buffer when the call is made then a buffer overflow would otherwise | |
44 | * occur and cause unexpected behaviour, a crash, or worse, a security risk. | |
45 | * | |
46 | * Internal class, don't use. | |
47 | * </p> | |
48 | * @author cix_foo <cix_foo@users.sourceforge.net> | |
49 | * @author elias_naur <elias_naur@users.sourceforge.net> | |
50 | * @version $Revision: 3279 $ | |
51 | * $Id: BufferChecks.java 3279 2010-03-11 21:06:49Z spasi $ | |
52 | */ | |
53 | public class BufferChecks { | |
54 | /** Static methods only! */ | |
55 | private BufferChecks() { | |
56 | } | |
57 | ||
58 | /** | |
59 | * Helper methods to ensure a function pointer is not-null (0) | |
60 | */ | |
61 | public static void checkFunctionAddress(long pointer) { | |
62 | if (pointer == 0) { | |
63 | throw new IllegalStateException("Function is not supported"); | |
64 | } | |
65 | } | |
66 | ||
67 | /** | |
68 | * Helper methods to ensure a ByteBuffer is null-terminated | |
69 | */ | |
70 | public static void checkNullTerminated(ByteBuffer buf) { | |
71 | if (buf.get(buf.limit() - 1) != 0) { | |
72 | throw new IllegalArgumentException("Missing null termination"); | |
73 | } | |
74 | } | |
75 | ||
76 | public static void checkNullTerminated(ByteBuffer buf, int count) { | |
77 | int nullFound = 0; | |
78 | for ( int i = buf.position(); i < buf.limit(); i++ ) { | |
79 | if ( buf.get(i) == 0 ) | |
80 | nullFound++; | |
81 | } | |
82 | ||
83 | if ( nullFound < count ) | |
84 | throw new IllegalArgumentException("Missing null termination"); | |
85 | } | |
86 | ||
87 | /** Helper methods to ensure an IntBuffer is null-terminated */ | |
88 | public static void checkNullTerminated(IntBuffer buf) { | |
89 | if ( buf.get(buf.limit() - 1) != 0 ) { | |
90 | throw new IllegalArgumentException("Missing null termination"); | |
91 | } | |
92 | } | |
93 | ||
94 | public static void checkNotNull(Object o) { | |
95 | if (o == null) | |
96 | throw new IllegalArgumentException("Null argument"); | |
97 | } | |
98 | ||
99 | /** | |
100 | * Helper methods to ensure a buffer is direct (and, implicitly, non-null). | |
101 | */ | |
102 | public static void checkDirect(ByteBuffer buf) { | |
103 | if (!buf.isDirect()) { | |
104 | throw new IllegalArgumentException("ByteBuffer is not direct"); | |
105 | } | |
106 | } | |
107 | ||
108 | public static void checkDirect(ShortBuffer buf) { | |
109 | if (!buf.isDirect()) { | |
110 | throw new IllegalArgumentException("ShortBuffer is not direct"); | |
111 | } | |
112 | } | |
113 | ||
114 | public static void checkDirect(IntBuffer buf) { | |
115 | if (!buf.isDirect()) { | |
116 | throw new IllegalArgumentException("IntBuffer is not direct"); | |
117 | } | |
118 | } | |
119 | ||
120 | public static void checkDirect(LongBuffer buf) { | |
121 | if (!buf.isDirect()) { | |
122 | throw new IllegalArgumentException("LongBuffer is not direct"); | |
123 | } | |
124 | } | |
125 | ||
126 | public static void checkDirect(FloatBuffer buf) { | |
127 | if (!buf.isDirect()) { | |
128 | throw new IllegalArgumentException("FloatBuffer is not direct"); | |
129 | } | |
130 | } | |
131 | ||
132 | public static void checkDirect(DoubleBuffer buf) { | |
133 | if (!buf.isDirect()) { | |
134 | throw new IllegalArgumentException("DoubleBuffer is not direct"); | |
135 | } | |
136 | } | |
137 | ||
138 | /** | |
139 | * This is a separate call to help inline checkBufferSize. | |
140 | */ | |
141 | private static void throwBufferSizeException(Buffer buf, int size) { | |
142 | throw new IllegalArgumentException("Number of remaining buffer elements is " + buf.remaining() + ", must be at least " + size); | |
143 | } | |
144 | ||
145 | /** | |
146 | * Helper method to ensure a buffer is big enough to receive data from a | |
147 | * glGet* operation. | |
148 | * | |
149 | * @param buf | |
150 | * The buffer to check | |
151 | * @param size | |
152 | * The minimum buffer size | |
153 | * @throws IllegalArgumentException | |
154 | */ | |
155 | public static void checkBufferSize(Buffer buf, int size) { | |
156 | if (buf.remaining() < size) { | |
157 | throwBufferSizeException(buf, size); | |
158 | } | |
159 | } | |
160 | ||
161 | public static void checkBuffer(ByteBuffer buf, int size) { | |
162 | checkBufferSize(buf, size); | |
163 | checkDirect(buf); | |
164 | } | |
165 | ||
166 | public static void checkBuffer(ShortBuffer buf, int size) { | |
167 | checkBufferSize(buf, size); | |
168 | checkDirect(buf); | |
169 | } | |
170 | ||
171 | public static void checkBuffer(IntBuffer buf, int size) { | |
172 | checkBufferSize(buf, size); | |
173 | checkDirect(buf); | |
174 | } | |
175 | ||
176 | public static void checkBuffer(LongBuffer buf, int size) { | |
177 | checkBufferSize(buf, size); | |
178 | checkDirect(buf); | |
179 | } | |
180 | ||
181 | public static void checkBuffer(FloatBuffer buf, int size) { | |
182 | checkBufferSize(buf, size); | |
183 | checkDirect(buf); | |
184 | } | |
185 | ||
186 | public static void checkBuffer(DoubleBuffer buf, int size) { | |
187 | checkBufferSize(buf, size); | |
188 | checkDirect(buf); | |
189 | } | |
190 | } | |
0 | /* | |
1 | * Copyright (c) 2002-2008 LWJGL Project | |
2 | * All rights reserved. | |
3 | * | |
4 | * Redistribution and use in source and binary forms, with or without | |
5 | * modification, are permitted provided that the following conditions are | |
6 | * met: | |
7 | * | |
8 | * * Redistributions of source code must retain the above copyright | |
9 | * notice, this list of conditions and the following disclaimer. | |
10 | * | |
11 | * * Redistributions in binary form must reproduce the above copyright | |
12 | * notice, this list of conditions and the following disclaimer in the | |
13 | * documentation and/or other materials provided with the distribution. | |
14 | * | |
15 | * * Neither the name of 'LWJGL' nor the names of | |
16 | * its contributors may be used to endorse or promote products derived | |
17 | * from this software without specific prior written permission. | |
18 | * | |
19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |
20 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | |
21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
22 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR | |
23 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | |
24 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | |
25 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | |
26 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF | |
27 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | |
28 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | |
29 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
30 | */ | |
31 | package org.lwjgl; | |
32 | ||
33 | import java.nio.Buffer; | |
34 | import java.nio.ByteBuffer; | |
35 | import java.nio.DoubleBuffer; | |
36 | import java.nio.FloatBuffer; | |
37 | import java.nio.IntBuffer; | |
38 | import java.nio.ShortBuffer; | |
39 | import java.nio.LongBuffer; | |
40 | ||
41 | /** | |
42 | * <p>A class to check buffer boundaries in general. If there is unsufficient space | |
43 | * in the buffer when the call is made then a buffer overflow would otherwise | |
44 | * occur and cause unexpected behaviour, a crash, or worse, a security risk. | |
45 | * | |
46 | * Internal class, don't use. | |
47 | * </p> | |
48 | * @author cix_foo <cix_foo@users.sourceforge.net> | |
49 | * @author elias_naur <elias_naur@users.sourceforge.net> | |
50 | * @version $Revision: 3279 $ | |
51 | * $Id: BufferChecks.java 3279 2010-03-11 21:06:49Z spasi $ | |
52 | */ | |
53 | public class BufferChecks { | |
54 | /** Static methods only! */ | |
55 | private BufferChecks() { | |
56 | } | |
57 | ||
58 | /** | |
59 | * Helper methods to ensure a function pointer is not-null (0) | |
60 | */ | |
61 | public static void checkFunctionAddress(long pointer) { | |
62 | if (pointer == 0) { | |
63 | throw new IllegalStateException("Function is not supported"); | |
64 | } | |
65 | } | |
66 | ||
67 | /** | |
68 | * Helper methods to ensure a ByteBuffer is null-terminated | |
69 | */ | |
70 | public static void checkNullTerminated(ByteBuffer buf) { | |
71 | if (buf.get(buf.limit() - 1) != 0) { | |
72 | throw new IllegalArgumentException("Missing null termination"); | |
73 | } | |
74 | } | |
75 | ||
76 | public static void checkNullTerminated(ByteBuffer buf, int count) { | |
77 | int nullFound = 0; | |
78 | for ( int i = buf.position(); i < buf.limit(); i++ ) { | |
79 | if ( buf.get(i) == 0 ) | |
80 | nullFound++; | |
81 | } | |
82 | ||
83 | if ( nullFound < count ) | |
84 | throw new IllegalArgumentException("Missing null termination"); | |
85 | } | |
86 | ||
87 | /** Helper methods to ensure an IntBuffer is null-terminated */ | |
88 | public static void checkNullTerminated(IntBuffer buf) { | |
89 | if ( buf.get(buf.limit() - 1) != 0 ) { | |
90 | throw new IllegalArgumentException("Missing null termination"); | |
91 | } | |
92 | } | |
93 | ||
94 | public static void checkNotNull(Object o) { | |
95 | if (o == null) | |
96 | throw new IllegalArgumentException("Null argument"); | |
97 | } | |
98 | ||
99 | /** | |
100 | * Helper methods to ensure a buffer is direct (and, implicitly, non-null). | |
101 | */ | |
102 | public static void checkDirect(ByteBuffer buf) { | |
103 | if (!buf.isDirect()) { | |
104 | throw new IllegalArgumentException("ByteBuffer is not direct"); | |
105 | } | |
106 | } | |
107 | ||
108 | public static void checkDirect(ShortBuffer buf) { | |
109 | if (!buf.isDirect()) { | |
110 | throw new IllegalArgumentException("ShortBuffer is not direct"); | |
111 | } | |
112 | } | |
113 | ||
114 | public static void checkDirect(IntBuffer buf) { | |
115 | if (!buf.isDirect()) { | |
116 | throw new IllegalArgumentException("IntBuffer is not direct"); | |
117 | } | |
118 | } | |
119 | ||
120 | public static void checkDirect(LongBuffer buf) { | |
121 | if (!buf.isDirect()) { | |
122 | throw new IllegalArgumentException("LongBuffer is not direct"); | |
123 | } | |
124 | } | |
125 | ||
126 | public static void checkDirect(FloatBuffer buf) { | |
127 | if (!buf.isDirect()) { | |
128 | throw new IllegalArgumentException("FloatBuffer is not direct"); | |
129 | } | |
130 | } | |
131 | ||
132 | public static void checkDirect(DoubleBuffer buf) { | |
133 | if (!buf.isDirect()) { | |
134 | throw new IllegalArgumentException("DoubleBuffer is not direct"); | |
135 | } | |
136 | } | |
137 | ||
138 | /** | |
139 | * This is a separate call to help inline checkBufferSize. | |
140 | */ | |
141 | private static void throwBufferSizeException(Buffer buf, int size) { | |
142 | throw new IllegalArgumentException("Number of remaining buffer elements is " + buf.remaining() + ", must be at least " + size); | |
143 | } | |
144 | ||
145 | /** | |
146 | * Helper method to ensure a buffer is big enough to receive data from a | |
147 | * glGet* operation. | |
148 | * | |
149 | * @param buf | |
150 | * The buffer to check | |
151 | * @param size | |
152 | * The minimum buffer size | |
153 | * @throws IllegalArgumentException | |
154 | */ | |
155 | public static void checkBufferSize(Buffer buf, int size) { | |
156 | if (buf.remaining() < size) { | |
157 | throwBufferSizeException(buf, size); | |
158 | } | |
159 | } | |
160 | ||
161 | public static void checkBuffer(ByteBuffer buf, int size) { | |
162 | checkBufferSize(buf, size); | |
163 | checkDirect(buf); | |
164 | } | |
165 | ||
166 | public static void checkBuffer(ShortBuffer buf, int size) { | |
167 | checkBufferSize(buf, size); | |
168 | checkDirect(buf); | |
169 | } | |
170 | ||
171 | public static void checkBuffer(IntBuffer buf, int size) { | |
172 | checkBufferSize(buf, size); | |
173 | checkDirect(buf); | |
174 | } | |
175 | ||
176 | public static void checkBuffer(LongBuffer buf, int size) { | |
177 | checkBufferSize(buf, size); | |
178 | checkDirect(buf); | |
179 | } | |
180 | ||
181 | public static void checkBuffer(FloatBuffer buf, int size) { | |
182 | checkBufferSize(buf, size); | |
183 | checkDirect(buf); | |
184 | } | |
185 | ||
186 | public static void checkBuffer(DoubleBuffer buf, int size) { | |
187 | checkBufferSize(buf, size); | |
188 | checkDirect(buf); | |
189 | } | |
190 | } |
0 | /* | |
1 | * Copyright (c) 2002-2008 LWJGL Project | |
2 | * All rights reserved. | |
3 | * | |
4 | * Redistribution and use in source and binary forms, with or without | |
5 | * modification, are permitted provided that the following conditions are | |
6 | * met: | |
7 | * | |
8 | * * Redistributions of source code must retain the above copyright | |
9 | * notice, this list of conditions and the following disclaimer. | |
10 | * | |
11 | * * Redistributions in binary form must reproduce the above copyright | |
12 | * notice, this list of conditions and the following disclaimer in the | |
13 | * documentation and/or other materials provided with the distribution. | |
14 | * | |
15 | * * Neither the name of 'LWJGL' nor the names of | |
16 | * its contributors may be used to endorse or promote products derived | |
17 | * from this software without specific prior written permission. | |
18 | * | |
19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |
20 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | |
21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
22 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR | |
23 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | |
24 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | |
25 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | |
26 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF | |
27 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | |
28 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | |
29 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
30 | */ | |
31 | package org.lwjgl; | |
32 | ||
33 | import java.nio.Buffer; | |
34 | import java.nio.ByteBuffer; | |
35 | import java.nio.ByteOrder; | |
36 | import java.nio.CharBuffer; | |
37 | import java.nio.DoubleBuffer; | |
38 | import java.nio.FloatBuffer; | |
39 | import java.nio.IntBuffer; | |
40 | import java.nio.LongBuffer; | |
41 | import java.nio.ShortBuffer; | |
42 | ||
43 | /** | |
44 | * Some often-used Buffer code for creating native buffers of the appropriate size. | |
45 | * | |
46 | * @author $Author: matzon $ | |
47 | * @version $Revision: 2983 $ | |
48 | * $Id: BufferUtils.java 2983 2008-04-07 18:36:09Z matzon $ | |
49 | */ | |
50 | ||
51 | public final class BufferUtils { | |
52 | ||
53 | /** | |
54 | * Construct a direct native-ordered bytebuffer with the specified size. | |
55 | * @param size The size, in bytes | |
56 | * @return a ByteBuffer | |
57 | */ | |
58 | public static ByteBuffer createByteBuffer(int size) { | |
59 | return ByteBuffer.allocateDirect(size).order(ByteOrder.nativeOrder()); | |
60 | } | |
61 | ||
62 | /** | |
63 | * Construct a direct native-order shortbuffer with the specified number | |
64 | * of elements. | |
65 | * @param size The size, in shorts | |
66 | * @return a ShortBuffer | |
67 | */ | |
68 | public static ShortBuffer createShortBuffer(int size) { | |
69 | return createByteBuffer(size << 1).asShortBuffer(); | |
70 | } | |
71 | ||
72 | /** | |
73 | * Construct a direct native-order charbuffer with the specified number | |
74 | * of elements. | |
75 | * @param size The size, in chars | |
76 | * @return an CharBuffer | |
77 | */ | |
78 | public static CharBuffer createCharBuffer(int size) { | |
79 | return createByteBuffer(size << 1).asCharBuffer(); | |
80 | } | |
81 | ||
82 | /** | |
83 | * Construct a direct native-order intbuffer with the specified number | |
84 | * of elements. | |
85 | * @param size The size, in ints | |
86 | * @return an IntBuffer | |
87 | */ | |
88 | public static IntBuffer createIntBuffer(int size) { | |
89 | return createByteBuffer(size << 2).asIntBuffer(); | |
90 | } | |
91 | ||
92 | /** | |
93 | * Construct a direct native-order longbuffer with the specified number | |
94 | * of elements. | |
95 | * @param size The size, in longs | |
96 | * @return an LongBuffer | |
97 | */ | |
98 | public static LongBuffer createLongBuffer(int size) { | |
99 | return createByteBuffer(size << 3).asLongBuffer(); | |
100 | } | |
101 | ||
102 | /** | |
103 | * Construct a direct native-order floatbuffer with the specified number | |
104 | * of elements. | |
105 | * @param size The size, in floats | |
106 | * @return a FloatBuffer | |
107 | */ | |
108 | public static FloatBuffer createFloatBuffer(int size) { | |
109 | return createByteBuffer(size << 2).asFloatBuffer(); | |
110 | } | |
111 | ||
112 | /** | |
113 | * Construct a direct native-order doublebuffer with the specified number | |
114 | * of elements. | |
115 | * @param size The size, in floats | |
116 | * @return a FloatBuffer | |
117 | */ | |
118 | public static DoubleBuffer createDoubleBuffer(int size) { | |
119 | return createByteBuffer(size << 3).asDoubleBuffer(); | |
120 | } | |
121 | ||
122 | /** | |
123 | * @return n, where buffer_element_size=2^n. | |
124 | */ | |
125 | public static int getElementSizeExponent(Buffer buf) { | |
126 | if (buf instanceof ByteBuffer) | |
127 | return 0; | |
128 | else if (buf instanceof ShortBuffer || buf instanceof CharBuffer) | |
129 | return 1; | |
130 | else if (buf instanceof FloatBuffer || buf instanceof IntBuffer) | |
131 | return 2; | |
132 | else if (buf instanceof LongBuffer || buf instanceof DoubleBuffer) | |
133 | return 3; | |
134 | else | |
135 | throw new IllegalStateException("Unsupported buffer type: " + buf); | |
136 | } | |
137 | ||
138 | /** | |
139 | * A helper function which is used to get the byte offset in an arbitrary buffer | |
140 | * based on its position | |
141 | * @return the position of the buffer, in BYTES | |
142 | */ | |
143 | public static int getOffset(Buffer buffer) { | |
144 | return buffer.position() << getElementSizeExponent(buffer); | |
145 | } | |
146 | ||
147 | } | |
0 | /* | |
1 | * Copyright (c) 2002-2008 LWJGL Project | |
2 | * All rights reserved. | |
3 | * | |
4 | * Redistribution and use in source and binary forms, with or without | |
5 | * modification, are permitted provided that the following conditions are | |
6 | * met: | |
7 | * | |
8 | * * Redistributions of source code must retain the above copyright | |
9 | * notice, this list of conditions and the following disclaimer. | |
10 | * | |
11 | * * Redistributions in binary form must reproduce the above copyright | |
12 | * notice, this list of conditions and the following disclaimer in the | |
13 | * documentation and/or other materials provided with the distribution. | |
14 | * | |
15 | * * Neither the name of 'LWJGL' nor the names of | |
16 | * its contributors may be used to endorse or promote products derived | |
17 | * from this software without specific prior written permission. | |
18 | * | |
19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |
20 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | |
21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
22 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR | |
23 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | |
24 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | |
25 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | |
26 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF | |
27 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | |
28 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | |
29 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
30 | */ | |
31 | package org.lwjgl; | |
32 | ||
33 | import java.nio.Buffer; | |
34 | import java.nio.ByteBuffer; | |
35 | import java.nio.ByteOrder; | |
36 | import java.nio.CharBuffer; | |
37 | import java.nio.DoubleBuffer; | |
38 | import java.nio.FloatBuffer; | |
39 | import java.nio.IntBuffer; | |
40 | import java.nio.LongBuffer; | |
41 | import java.nio.ShortBuffer; | |
42 | ||
43 | /** | |
44 | * Some often-used Buffer code for creating native buffers of the appropriate size. | |
45 | * | |
46 | * @author $Author: matzon $ | |
47 | * @version $Revision: 2983 $ | |
48 | * $Id: BufferUtils.java 2983 2008-04-07 18:36:09Z matzon $ | |
49 | */ | |
50 | ||
51 | public final class BufferUtils { | |
52 | ||
53 | /** | |
54 | * Construct a direct native-ordered bytebuffer with the specified size. | |
55 | * @param size The size, in bytes | |
56 | * @return a ByteBuffer | |
57 | */ | |
58 | public static ByteBuffer createByteBuffer(int size) { | |
59 | return ByteBuffer.allocateDirect(size).order(ByteOrder.nativeOrder()); | |
60 | } | |
61 | ||
62 | /** | |
63 | * Construct a direct native-order shortbuffer with the specified number | |
64 | * of elements. | |
65 | * @param size The size, in shorts | |
66 | * @return a ShortBuffer | |
67 | */ | |
68 | public static ShortBuffer createShortBuffer(int size) { | |
69 | return createByteBuffer(size << 1).asShortBuffer(); | |
70 | } | |
71 | ||
72 | /** | |
73 | * Construct a direct native-order charbuffer with the specified number | |
74 | * of elements. | |
75 | * @param size The size, in chars | |
76 | * @return an CharBuffer | |
77 | */ | |
78 | public static CharBuffer createCharBuffer(int size) { | |
79 | return createByteBuffer(size << 1).asCharBuffer(); | |
80 | } | |
81 | ||
82 | /** | |
83 | * Construct a direct native-order intbuffer with the specified number | |
84 | * of elements. | |
85 | * @param size The size, in ints | |
86 | * @return an IntBuffer | |
87 | */ | |
88 | public static IntBuffer createIntBuffer(int size) { | |
89 | return createByteBuffer(size << 2).asIntBuffer(); | |
90 | } | |
91 | ||
92 | /** | |
93 | * Construct a direct native-order longbuffer with the specified number | |
94 | * of elements. | |
95 | * @param size The size, in longs | |
96 | * @return an LongBuffer | |
97 | */ | |
98 | public static LongBuffer createLongBuffer(int size) { | |
99 | return createByteBuffer(size << 3).asLongBuffer(); | |
100 | } | |
101 | ||
102 | /** | |
103 | * Construct a direct native-order floatbuffer with the specified number | |
104 | * of elements. | |
105 | * @param size The size, in floats | |
106 | * @return a FloatBuffer | |
107 | */ | |
108 | public static FloatBuffer createFloatBuffer(int size) { | |
109 | return createByteBuffer(size << 2).asFloatBuffer(); | |
110 | } | |
111 | ||
112 | /** | |
113 | * Construct a direct native-order doublebuffer with the specified number | |
114 | * of elements. | |
115 | * @param size The size, in floats | |
116 | * @return a FloatBuffer | |
117 | */ | |
118 | public static DoubleBuffer createDoubleBuffer(int size) { | |
119 | return createByteBuffer(size << 3).asDoubleBuffer(); | |
120 | } | |
121 | ||
122 | /** | |
123 | * @return n, where buffer_element_size=2^n. | |
124 | */ | |
125 | public static int getElementSizeExponent(Buffer buf) { | |
126 | if (buf instanceof ByteBuffer) | |
127 | return 0; | |
128 | else if (buf instanceof ShortBuffer || buf instanceof CharBuffer) | |
129 | return 1; | |
130 | else if (buf instanceof FloatBuffer || buf instanceof IntBuffer) | |
131 | return 2; | |
132 | else if (buf instanceof LongBuffer || buf instanceof DoubleBuffer) | |
133 | return 3; | |
134 | else | |
135 | throw new IllegalStateException("Unsupported buffer type: " + buf); | |
136 | } | |
137 | ||
138 | /** | |
139 | * A helper function which is used to get the byte offset in an arbitrary buffer | |
140 | * based on its position | |
141 | * @return the position of the buffer, in BYTES | |
142 | */ | |
143 | public static int getOffset(Buffer buffer) { | |
144 | return buffer.position() << getElementSizeExponent(buffer); | |
145 | } | |
146 | ||
147 | } |
0 | /* | |
1 | * Copyright (c) 2002-2008 LWJGL Project | |
2 | * All rights reserved. | |
3 | * | |
4 | * Redistribution and use in source and binary forms, with or without | |
5 | * modification, are permitted provided that the following conditions are | |
6 | * met: | |
7 | * | |
8 | * * Redistributions of source code must retain the above copyright | |
9 | * notice, this list of conditions and the following disclaimer. | |
10 | * | |
11 | * * Redistributions in binary form must reproduce the above copyright | |
12 | * notice, this list of conditions and the following disclaimer in the | |
13 | * documentation and/or other materials provided with the distribution. | |
14 | * | |
15 | * * Neither the name of 'LWJGL' nor the names of | |
16 | * its contributors may be used to endorse or promote products derived | |
17 | * from this software without specific prior written permission. | |
18 | * | |
19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |
20 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | |
21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
22 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR | |
23 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | |
24 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | |
25 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | |
26 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF | |
27 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | |
28 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | |
29 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
30 | */ | |
31 | package org.lwjgl; | |
32 | ||
33 | ||
34 | /** | |
35 | * | |
36 | * @author elias_naur <elias_naur@users.sourceforge.net> | |
37 | * @version $Revision: 3055 $ | |
38 | * $Id: DefaultSysImplementation.java 3055 2008-04-30 14:58:47Z elias_naur $ | |
39 | */ | |
40 | abstract class DefaultSysImplementation implements SysImplementation { | |
41 | public native int getJNIVersion(); | |
42 | public native void setDebug(boolean debug); | |
43 | ||
44 | public long getTimerResolution() { | |
45 | return 1000; | |
46 | } | |
47 | ||
48 | public boolean has64Bit() { | |
49 | return false; | |
50 | } | |
51 | ||
52 | public abstract long getTime(); | |
53 | public abstract void alert(String title, String message); | |
54 | public abstract String getClipboard(); | |
55 | } | |
0 | /* | |
1 | * Copyright (c) 2002-2008 LWJGL Project | |
2 | * All rights reserved. | |
3 | * | |
4 | * Redistribution and use in source and binary forms, with or without | |
5 | * modification, are permitted provided that the following conditions are | |
6 | * met: | |
7 | * | |
8 | * * Redistributions of source code must retain the above copyright | |
9 | * notice, this list of conditions and the following disclaimer. | |
10 | * | |
11 | * * Redistributions in binary form must reproduce the above copyright | |
12 | * notice, this list of conditions and the following disclaimer in the | |
13 | * documentation and/or other materials provided with the distribution. | |
14 | * | |
15 | * * Neither the name of 'LWJGL' nor the names of | |
16 | * its contributors may be used to endorse or promote products derived | |
17 | * from this software without specific prior written permission. | |
18 | * | |
19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |
20 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | |
21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
22 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR | |
23 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | |
24 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | |
25 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | |
26 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF | |
27 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | |
28 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | |
29 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
30 | */ | |
31 | package org.lwjgl; | |
32 | ||
33 | ||
34 | /** | |
35 | * | |
36 | * @author elias_naur <elias_naur@users.sourceforge.net> | |
37 | * @version $Revision: 3055 $ | |
38 | * $Id: DefaultSysImplementation.java 3055 2008-04-30 14:58:47Z elias_naur $ | |
39 | */ | |
40 | abstract class DefaultSysImplementation implements SysImplementation { | |
41 | public native int getJNIVersion(); | |
42 | public native void setDebug(boolean debug); | |
43 | ||
44 | public long getTimerResolution() { | |
45 | return 1000; | |
46 | } | |
47 | ||
48 | public boolean has64Bit() { | |
49 | return false; | |
50 | } | |
51 | ||
52 | public abstract long getTime(); | |
53 | public abstract void alert(String title, String message); | |