forked from LWJGL/lwjgl3
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
1195 lines (1005 loc) · 50.7 KB
/
build.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!--
~ Copyright LWJGL. All rights reserved.
~ License terms: https://www.lwjgl.org/license
-->
<project name="LWJGL" basedir="." default="all" xmlns:if="ant:if" xmlns:unless="ant:unless">
<property name="build.sysclasspath" value="ignore"/>
<property name="config" location="config" relative="true"/>
<import file="${config}/build-definitions.xml"/>
<import file="${config}/build-assets.xml"/>
<import file="${config}/${platform}/build.xml"/>
<!-- Initialize build -->
<target name="init" description="Initializes the directories required by the build process" depends="bindings">
<fail message="LWJGL requires Ant version 1.9.3 or higher.">
<condition>
<not><antversion atleast="1.9.3"/></not>
</condition>
</fail>
<echo taskname="override" message="Build type: ${build.type}" if:set="env.LWJGL_BUILD_TYPE"/>
<echo taskname="override" message="Build output: ${build.output}" if:set="env.LWJGL_BUILD_OUTPUT"/>
<echo taskname="override" message="Build architecture: ${build.arch}" if:set="env.LWJGL_BUILD_ARCH"/>
<echo taskname="override" message="Build offline: ${build.offline}" if:set="env.LWJGL_BUILD_OFFLINE"/>
<mkdir-symlink dir="bin"/>
<ant antfile="update-dependencies.xml" target="check-dependencies" inheritAll="false"/>
<taskdef resource="org/jetbrains/kotlin/ant/antlib.xml" classpath="${kotlinc}/lib/kotlin-ant.jar"/>
<taskdef resource="testngtasks" classpath="${lib}/java/testng.jar"/>
</target>
<target name="init-wiki" description="Initializes the lwjgl3-wiki git repository in /wiki. [Optional]">
<confirm-replace dir="wiki" msg="The wiki directory contents will be replaced with a fresh clone of the lwjgl3-wiki repository. Continue?"/>
<delete dir="wiki"/>
<exec executable="git" failonerror="true">
<arg value="clone"/>
<arg value="https://github.com/LWJGL/lwjgl3-wiki.wiki.git"/>
<arg value="wiki"/>
</exec>
</target>
<target name="reset" description="Resets the repository to its initial state.">
<local name="input"/>
<input
message="This action will clean everything and also remove libraries and sub-repositories. Continue?"
validargs="y,n"
defaultvalue="n"
addproperty="input"
/>
<fail message="Cancelled.">
<condition>
<equals arg1="n" arg2="${input}"/>
</condition>
</fail>
<antcall target="clean"/>
<delete-symlink dir="bin"/>
<delete dir=".gradle"/>
<delete dir="wiki"/>
<echo message="Reset successful."/>
</target>
<target name="clean" description="Cleans all directories controlled by this script">
<delete includeemptydirs="true">
<fileset dir="bin">
<include name="**/*"/>
<exclude name="libs/**"/>
</fileset>
</delete>
<forEachModule>
<delete-symlink dir="${module.lwjgl}/${module}/src/generated"/>
</forEachModule>
<!-- Do not delete /wiki, it may contain the lwjgl3-wiki git repo -->
<echo message="Cleanup successful."/>
</target>
<target name="clean-kotlin" description="Deletes Kotlin binary files produced by this script">
<delete dir="${bin.generator}"/>
<delete dir="${bin.templates}"/>
</target>
<target name="clean-java" description="Deletes Java binary files produced by this script">
<delete dir="${bin.lwjgl}"/>
<delete dir="${bin.samples}"/>
<delete dir="${bin.test}"/>
</target>
<target name="clean-native" description="Deletes native binary files produced by this script">
<delete dir="${bin.native}"/>
</target>
<target name="clean-generated" description="Deletes sources, test results and documentation generated by this script" depends="clean-generated-java,clean-generated-native">
<delete dir="${bin.test.html}"/>
<delete dir="bin/javadoc"/>
</target>
<target name="clean-generated-java" description="Deletes Java sources generated by this script">
<delete file="${bin.generator}/generated-touch.txt" quiet="true"/>
<forEachModule>
<delete dir="${module.lwjgl}/${module}/src/generated/java"/>
</forEachModule>
</target>
<target name="clean-generated-native" description="Deletes native sources generated by this script">
<delete file="${bin.generator}/generated-touch.txt" quiet="true"/>
<forEachModule>
<delete dir="${module.lwjgl}/${module}/src/generated/c" quiet="true"/>
</forEachModule>
</target>
<target name="all" description="Builds LWJGL and runs the tests" depends="compile-templates, tests"/>
<target name="-compile-generator" depends="init">
<local name="generator-uptodate"/>
<uptodate targetfile="${bin.generator}/touch.txt" property="generator-uptodate">
<srcfiles dir="${src.generator}/kotlin" includes="**"/>
</uptodate>
<echo message="Compiling Kotlin generator..." level="info" taskname="Generator" unless:set="generator-uptodate"/>
<mkdir dir="${bin.generator}"/>
<kotlinc moduleName="generator" output="${bin.generator}" printVersion="true" unless:set="generator-uptodate">
<compilerarg line="-jvm-target 1.8"/>
<compilerarg value="-Xno-call-assertions"/>
<compilerarg value="-Xno-param-assertions"/>
<compilerarg value="-Xreport-perf"/>
<src path="${src.generator}/kotlin"/>
</kotlinc>
<touch file="${bin.generator}/touch.txt" unless:set="generator-uptodate"/>
<lwjgl.javac
destdir="${bin.generator}"
srcdir="${src.generator}/java"
includes="org/lwjgl/**"
taskname="javac: Generator Tools & Doclets"
>
<classpath path="${java.home}/../lib/tools.jar" unless:set="jdk9"/>
<classpath path="${env.JAVA8_HOME}/lib/tools.jar" if:set="env.JAVA8_HOME"/>
</lwjgl.javac>
</target>
<target name="compile-templates" description="Compiles the Templates module" depends="-compile-generator">
<local name="templates-uptodate"/>
<uptodate targetfile="${bin.templates}/touch.txt" property="templates-uptodate">
<srcfiles dir="${module.lwjgl}" includes="**/kotlin/**/*.kt"/>
<srcfiles dir="${bin.generator}" includes="touch.txt"/>
</uptodate>
<local name="egl_types"/>
<condition property="egl_types">
<and>
<isfalse value="${binding.egl}"/>
<istrue value="${binding.glfw}"/>
</and>
</condition>
<local name="opencl_types"/>
<condition property="opencl_types">
<and>
<isfalse value="${binding.opencl}"/>
<istrue value="${binding.opengl}"/>
</and>
</condition>
<local name="opengl_types"/>
<condition property="opengl_types">
<and>
<isfalse value="${binding.opengl}"/>
<or>
<istrue value="${binding.glfw}"/>
<istrue value="${binding.opencl}"/>
</or>
</and>
</condition>
<local name="vulkan_types"/>
<condition property="vulkan_types">
<and>
<isfalse value="${binding.vulkan}"/>
<istrue value="${binding.glfw}"/>
</and>
</condition>
<local name="core.kotlin.path"/>
<property name="core.kotlin.path" value="${module.lwjgl}/core/src/templates/kotlin/core"/>
<echo message="Compiling Kotlin templates. This will take 1-2 minutes..." level="info" taskname="Templates" unless:set="templates-uptodate"/>
<mkdir dir="${bin.templates}"/>
<kotlinc moduleName="templates" output="${bin.templates}" printVersion="true" unless:set="templates-uptodate">
<classpath>
<pathelement location="${bin.generator}"/>
</classpath>
<compilerarg line="-jvm-target 1.8"/>
<compilerarg value="-Xno-call-assertions"/>
<compilerarg value="-Xno-param-assertions"/>
<compilerarg value="-Xreport-perf"/>
<src path="${core.kotlin.path}/dyncall"/>
<src path="${core.kotlin.path}/jni"/>
<src path="${core.kotlin.path}/libc"/>
<src path="${core.kotlin.path}/linux"/>
<src path="${core.kotlin.path}/macos"/>
<src path="${core.kotlin.path}/templates"/>
<src path="${core.kotlin.path}/windows"/>
<src path="${module.templatepath}"/>
<src path="${module.lwjgl}/egl/src/templates/kotlin/egl/EGLTypes.kt" if:set="egl_types"/>
<src path="${module.lwjgl}/opencl/src/templates/kotlin/opencl/CLTypes.kt" if:set="opencl_types"/>
<src path="${module.lwjgl}/opengl/src/templates/kotlin/opengl/GLTypes.kt" if:set="opengl_types"/>
<src path="${module.lwjgl}/opengl/src/templates/kotlin/opengl/GLXTypes.kt" if:set="opengl_types"/>
<src path="${module.lwjgl}/opengl/src/templates/kotlin/opengl/WGLTypes.kt" if:set="opengl_types"/>
<src path="${module.lwjgl}/vulkan/src/templates/kotlin/vulkan/VKBase.kt" if:set="vulkan_types"/>
<src path="${module.lwjgl}/vulkan/src/templates/kotlin/vulkan/VKTypes.kt" if:set="vulkan_types"/>
<src path="${module.lwjgl}/vulkan/src/templates/kotlin/vulkan/ExtensionTypes.kt" if:set="vulkan_types"/>
</kotlinc>
<touch file="${bin.templates}/touch.txt" unless:set="templates-uptodate"/>
</target>
<target name="touch-kotlinc" description="Used for touching from an IDE">
<touch file="${bin.generator}/touch.txt"/>
<touch file="${bin.templates}/touch.txt"/>
</target>
<target name="formatter" description="Runs the template formatter tool" depends="-compile-generator">
<java
classname="org.lwjgl.generator.util.TemplateFormatter"
fork="true"
spawn="true"
>
<classpath>
<pathelement path="${bin.generator}"/>
<pathelement path="${test.resources}"/>
</classpath>
</java>
</target>
<target name="urlValidator" description="Runs the URL validator tool" depends="-compile-generator">
<java
classname="org.lwjgl.generator.util.URLValidator"
fork="true"
>
<classpath>
<pathelement path="${bin.generator}"/>
<pathelement path="${test.resources}"/>
</classpath>
<arg line="${args}" if:set="args"/>
</java>
</target>
<target name="generate" description="Runs the Generator" depends="init">
<local name="has-compiled-templates"/>
<available file="${bin.templates}/META-INF" type="dir" property="has-compiled-templates"/>
<fail unless="has-compiled-templates" message="Please invoke the compile-templates target first."/>
<local name="generated-uptodate"/>
<uptodate property="generated-uptodate" targetfile="${bin.generator}/generated-touch.txt">
<srcfiles dir="${config}" includes="build-bindings.xml"/>
<srcfiles dir="${bin.generator}" includes="touch.txt"/>
<srcfiles dir="${bin.templates}" includes="touch.txt"/>
</uptodate>
<forEachModule unless:set="generated-uptodate">
<local name="linkPath"/>
<property name="linkPath" location="${module.lwjgl}/${module}/src/generated" relative="true"/>
<mkdir-symlink dir="${linkPath}"/>
</forEachModule>
<java
classname="org.lwjgl.generator.GeneratorKt"
fork="true"
failonerror="true"
taskname="Generator"
unless:set="generated-uptodate"
>
<classpath>
<pathelement path="${bin.generator}"/>
<pathelement path="${bin.templates}"/>
<pathelement path="${kotlinc}/lib/kotlin-runtime.jar"/>
</classpath>
<jvmarg line="${generator.bindings}"/>
<arg value="${module.lwjgl}"/>
</java>
<touch file="${bin.generator}/generated-touch.txt" verbose="false" unless:set="generated-uptodate"/>
</target>
<macrodef name="compileBinding">
<attribute name="binding"/>
<element name="body" implicit="yes" optional="yes"/>
<sequential>
<local name="hasMain"/>
<available file="${module.lwjgl}/@{binding}/src/main/java" type="dir" property="hasMain"/>
<mkdir dir="${bin.lwjgl}/@{binding}"/>
<lwjgl.javac destdir="${bin.lwjgl}/@{binding}" taskname="javac: @{binding}" if:true="${binding.@{binding}}">
<classpath>
<pathelement path="${bin.lwjgl}/core"/>
<pathelement path="${lib}/java/jsr305.jar"/>
<body/>
</classpath>
<src>
<pathelement path="${module.lwjgl}/@{binding}/src/main/java" if:set="hasMain"/>
<pathelement path="${module.lwjgl}/@{binding}/src/generated/java"/>
</src>
<include name="**"/>
</lwjgl.javac>
</sequential>
</macrodef>
<target name="compile" description="Compiles the Java source code" depends="generate">
<mkdir dir="${bin.lwjgl}/core"/>
<lwjgl.javac destdir="${bin.lwjgl}/core" taskname="javac: core">
<classpath><pathelement path="${lib}/java/jsr305.jar"/></classpath>
<src>
<pathelement path="${module.lwjgl}/core/src/main/java/"/>
<pathelement path="${module.lwjgl}/core/src/generated/java/"/>
</src>
<include name="**"/>
<!-- Supresses internal API (e.g. Unsafe) usage warnings -->
<compilerarg value="-XDignore.symbol.file=true"/>
</lwjgl.javac>
<mkdir dir="${bin.lwjgl}/core/META-INF/versions/9" if:set="jdk9"/>
<delete file="${bin.lwjgl}/core/META-INF/versions/9/module-info.class" quiet="true" if:set="jdk9"/>
<lwjgl.javac9
destdir="${bin.lwjgl}/core/META-INF/versions/9"
classpath="${bin.lwjgl}/core"
srcdir="${module.lwjgl}/core/src/main/java9"
includes="**"
taskname="javac: Core - Java 9"
if:set="jdk9"
/>
<parallel threadsPerProcessor="1">
<compileBinding binding="assimp"/>
<compileBinding binding="bgfx"/>
<compileBinding binding="egl"/>
<compileBinding binding="jawt"/>
<compileBinding binding="jemalloc"/>
<compileBinding binding="lmdb"/>
<compileBinding binding="lz4"/>
<compileBinding binding="nanovg"/>
<compileBinding binding="nfd"/>
<compileBinding binding="nuklear"/>
<compileBinding binding="odbc"/>
<compileBinding binding="openal"/>
<compileBinding binding="opencl"/>
<compileBinding binding="openvr"/>
<compileBinding binding="par"/>
<compileBinding binding="remotery"/>
<compileBinding binding="rpmalloc"/>
<compileBinding binding="sse"/>
<compileBinding binding="stb"/>
<compileBinding binding="tinyexr"/>
<compileBinding binding="tinyfd"/>
<compileBinding binding="tootle"/>
<compileBinding binding="vulkan"/>
<compileBinding binding="xxhash"/>
<compileBinding binding="yoga"/>
<compileBinding binding="zstd"/>
</parallel>
<parallel threadsPerProcessor="1">
<compileBinding binding="opengl">
<pathelement path="${bin.lwjgl}/opencl"/>
</compileBinding>
<compileBinding binding="opengles">
<pathelement path="${bin.lwjgl}/egl"/>
</compileBinding>
<compileBinding binding="glfw">
<pathelement path="${bin.lwjgl}/egl"/>
<pathelement path="${bin.lwjgl}/vulkan"/>
</compileBinding>
<compileBinding binding="ovr">
<pathelement path="${bin.lwjgl}/vulkan"/>
</compileBinding>
<compileBinding binding="vma">
<pathelement path="${bin.lwjgl}/vulkan"/>
</compileBinding>
</parallel>
</target>
<target name="compile-native" description="Compiles the native source code" depends="init, compile">
<mkdir dir="${bin.native}"/>
<antcall target="compile-native-platform"/>
</target>
<target name="compile-tests" description="Compiles the LWJGL test suite" depends="compile">
<mkdir dir="${bin.test}"/>
<forEachModule>
<local name="hasTests"/>
<available property="hasTests" file="${module.lwjgl}/${module}/src/test/java" type="dir"/>
<lwjgl.javac
destdir="${bin.test}"
srcdir="${module.lwjgl}/${module}/src/test/java"
includes="**"
taskname="javac: ${module} tests"
if:set="hasTests"
>
<classpath>
<pathelement path="${bin.lwjgl}/core"/>
<pathelement path="${bin.lwjgl}/${module}"/>
<pathelement path="${lib}/java/jsr305.jar"/>
<pathelement path="${lib}/java/testng.jar"/>
</classpath>
</lwjgl.javac>
</forEachModule>
<local name="test.bgfx"/>
<condition property="test.bgfx">
<and>
<istrue value="${binding.bgfx}"/>
<istrue value="${binding.glfw}"/>
</and>
</condition>
<local name="test.egl"/>
<condition property="test.egl">
<and>
<istrue value="${binding.egl}"/>
<istrue value="${binding.glfw}"/>
<istrue value="${binding.opengles}"/>
</and>
</condition>
<local name="test.glfw"/>
<condition property="test.glfw">
<and>
<istrue value="${binding.glfw}"/>
<istrue value="${binding.opengl}"/>
</and>
</condition>
<local name="test.jawt"/>
<condition property="test.jawt">
<and>
<istrue value="${binding.jawt}"/>
<istrue value="${binding.opengl}"/>
</and>
</condition>
<local name="test.nanovg"/>
<condition property="test.nanovg">
<and>
<istrue value="${test.glfw}"/>
<istrue value="${binding.nanovg}"/>
</and>
</condition>
<local name="test.nuklear"/>
<condition property="test.nuklear">
<and>
<istrue value="${test.glfw}"/>
<istrue value="${binding.nuklear}"/>
</and>
</condition>
<local name="test.nfd"/>
<condition property="test.nfd">
<and>
<istrue value="${test.glfw}"/>
<istrue value="${binding.nfd}"/>
</and>
</condition>
<local name="test.openal"/>
<condition property="test.openal">
<and>
<istrue value="${binding.openal}"/>
<istrue value="${binding.stb}"/>
</and>
</condition>
<local name="test.opencl"/>
<condition property="test.opencl">
<and>
<istrue value="${binding.glfw}"/>
<istrue value="${binding.opencl}"/>
</and>
</condition>
<local name="test.par"/>
<condition property="test.par">
<and>
<istrue value="${binding.glfw}"/>
<istrue value="${binding.nfd}"/>
<istrue value="${binding.par}"/>
<istrue value="${binding.stb}"/>
</and>
</condition>
<local name="test.stb"/>
<condition property="test.stb">
<and>
<istrue value="${binding.stb}"/>
<istrue value="${binding.glfw}"/>
</and>
</condition>
<local name="test.tinyexr"/>
<condition property="test.tinyexr">
<and>
<istrue value="${test.glfw}"/>
<istrue value="${binding.tinyexr}"/>
<istrue value="${binding.tinyfd}"/>
</and>
</condition>
<local name="test.tinyfd"/>
<condition property="test.tinyfd">
<and>
<istrue value="${test.glfw}"/>
<istrue value="${binding.tinyfd}"/>
</and>
</condition>
<local name="test.tootle"/>
<condition property="test.tootle">
<and>
<istrue value="${binding.assimp}"/>
<istrue value="${binding.par}"/>
<istrue value="${binding.tootle}"/>
</and>
</condition>
<local name="test.vulkan"/>
<condition property="test.vulkan">
<and>
<istrue value="${binding.glfw}"/>
<istrue value="${binding.vulkan}"/>
</and>
</condition>
<local name="test.yoga"/>
<condition property="test.yoga">
<and>
<istrue value="${test.glfw}"/>
<istrue value="${binding.stb}"/>
<istrue value="${binding.yoga}"/>
</and>
</condition>
<mkdir dir="${bin.samples}"/>
<lwjgl.javac srcdir="modules/samples/src/test/java" destdir="${bin.samples}" taskname="javac: Samples">
<classpath>
<pathelement path="${module.classpath}"/>
<pathelement path="${bin.test}"/>
<pathelement path="${lib}/java/jsr305.jar"/>
<pathelement path="${lib}/java/joml.jar"/>
</classpath>
<!-- Demos -->
<include name="org/lwjgl/demo/assimp/**" if:true="${binding.assimp}"/>
<include name="org/lwjgl/demo/bgfx/**" if:set="test.bgfx"/>
<include name="org/lwjgl/demo/egl/**" if:set="test.egl"/>
<include name="org/lwjgl/demo/glfw/**" if:set="test.glfw"/>
<include name="org/lwjgl/demo/nanovg/**" if:set="test.nanovg"/>
<include name="org/lwjgl/demo/nuklear/**" if:set="test.nuklear"/>
<include name="org/lwjgl/demo/openal/**" if:true="${binding.openal}"/>
<exclude name="org/lwjgl/demo/openal/ALCDemo.java" unless:set="test.openal"/>
<exclude name="org/lwjgl/demo/openal/EFXTest.java" unless:set="test.openal"/>
<exclude name="org/lwjgl/demo/openal/HRTFDemo.java" unless:set="test.openal"/>
<include name="org/lwjgl/demo/opencl/**" if:set="test.opencl"/>
<include name="org/lwjgl/demo/opencl/CLDemo.java" if:true="${binding.opencl}"/>
<include name="org/lwjgl/demo/opengl/**" if:true="${binding.opengl}"/>
<include name="org/lwjgl/demo/openvr/**" if:true="${binding.openvr}"/>
<include name="org/lwjgl/demo/ovr/**" if:true="${binding.ovr}"/>
<include name="org/lwjgl/demo/stb/**" if:set="test.stb"/>
<include name="org/lwjgl/demo/system/jawt/**" if:set="test.jawt"/>
<include name="org/lwjgl/demo/util/*.java"/>
<include name="org/lwjgl/demo/util/lmdb/**" if:true="${binding.lmdb}"/>
<include name="org/lwjgl/demo/util/lz4/**" if:true="${binding.lz4}"/>
<include name="org/lwjgl/demo/util/nfd/**" if:set="test.nfd"/>
<include name="org/lwjgl/demo/util/par/**" if:set="test.par"/>
<include name="org/lwjgl/demo/util/tinyexr/**" if:set="test.tinyexr"/>
<include name="org/lwjgl/demo/util/tinyfd/**" if:set="test.tinyfd"/>
<include name="org/lwjgl/demo/util/tootle/**" if:set="test.tootle"/>
<include name="org/lwjgl/demo/util/xxhash/**" if:true="${binding.xxhash}"/>
<include name="org/lwjgl/demo/util/yoga/**" if:set="test.yoga"/>
<include name="org/lwjgl/demo/util/zstd/**" if:true="${binding.zstd}"/>
<include name="org/lwjgl/demo/vulkan/**" if:set="test.vulkan"/>
</lwjgl.javac>
</target>
<target name="tests" description="Runs the LWJGL test suite" depends="compile-tests, compile-native">
<testng outputDir="${bin.test.html}" taskname="Tests">
<classpath>
<pathelement path="${bin.lwjgl}/core/META-INF/versions/9" if:set="core.java9"/>
<pathelement path="${module.classpath}"/>
<pathelement path="${bin.test}"/>
<pathelement path="${lib}/java/jcommander.jar"/>
</classpath>
<!--<jvmarg value="-Xcheck:jni"/>--> <!-- SIMD fails with this (see -XX:+RestoreMXCSROnJNICall) -->
<jvmarg value="-ea"/>
<jvmarg value="-Dorg.lwjgl.util.Debug=true"/>
<jvmarg value="-Dorg.lwjgl.util.DebugAllocator=true"/>
<jvmarg value="-Djava.library.path=${lib}"/>
<jvmarg value="-XstartOnFirstThread" if:set="platform.macos"/>
<jvmarg value="-Xss256k"/> <!-- for StackTest::testSOE -->
<jvmarg line="${jvmargs}" if:set="jvmargs"/>
<xmlfileset dir="${config}" includes="tests.xml,tests_${platform}.xml"/>
</testng>
</target>
<target name="demo" description="Runs an LWJGL demo" depends="compile-tests, compile-native, -update-assets">
<fail message="Please use -Dclass=<class> to specify the demo main class to run." unless="class"/>
<local name="spawn"/>
<condition property="spawn" value="true" else="false">
<isset property="jitwatch"/>
</condition>
<local name="failonerror"/>
<condition property="failonerror" value="false" else="true">
<istrue value="${spawn}"/>
</condition>
<java classname="${class}" fork="true" failonerror="${failonerror}" spawn="${spawn}" taskname="Demo">
<classpath>
<pathelement path="${bin.lwjgl}/core/META-INF/versions/9" if:set="core.java9"/>
<pathelement path="${module.classpath}"/>
<pathelement path="${bin.test}"/>
<pathelement path="${bin.samples}"/>
<pathelement path="${test.resources}"/>
<pathelement path="${lib}/java/testng.jar"/>
<pathelement path="${lib}/java/joml.jar"/>
</classpath>
<jvmarg value="-Djava.library.path=${lib}"/>
<jvmarg value="-XstartOnFirstThread" if:set="platform.macos"/>
<!--<jvmarg value="-Xcheck:jni"/>-->
<jvmarg line="-XX:+UnlockDiagnosticVMOptions -XX:+TraceClassLoading -XX:+LogCompilation" if:set="jitwatch"/>
<jvmarg line="-XX:+PrintAssembly -XX:PrintAssemblyOptions=intel -XX:-TieredCompilation -XX:-UseCompressedOops" if:set="jitwatch"/>
<jvmarg line="-XX:LogFile=${jitwatch}" if:set="jitwatch"/>
<jvmarg line="${jvmargs}" if:set="jvmargs"/>
<arg line="${args}" if:set="args"/>
</java>
</target>
<target name="-build-version" depends="compile">
<local name="stderr"/>
<java classname="org.lwjgl.Version" fork="true" failonerror="true" outputproperty="build.version" errorproperty="stderr">
<classpath path="${bin.lwjgl}/core"/>
<jvmarg value="-Djava.library.path=${lib}"/>
</java>
</target>
<!-- Includes all modules for javadoc.lwjgl.org -->
<target name="javadoc" description="Generates the LWJGL JavaDoc" depends="-compile-generator,-build-version">
<echo message="It is recommended to generate JavaDoc on JDK 9 or higher." unless:set="jdk9" taskname="Warning"/>
<delete dir="bin/javadoc"/>
<path id="javadoc.sources">
<pathelement path="${module.sourcepath}"/>
</path>
<javadoc
destdir="bin/javadoc"
sourcepathref="javadoc.sources"
source="1.8"
windowtitle="LWJGL ${build.version}"
encoding="UTF-8"
docencoding="UTF-8"
charset="UTF-8"
useexternalfile="true"
nohelp="true"
notree="true"
public="true"
Splitindex="true"
doclet="org.lwjgl.system.ExcludeDoclet"
docletpath="${bin.generator}"
maxmemory="1G"
failonerror="true"
>
<doctitle><![CDATA[<h1>Lightweight Java Game Library</h1>]]></doctitle>
<bottom><![CDATA[<i>Copyright LWJGL. All Rights Reserved. <a href="https://www.lwjgl.org/license">License terms</a>.</i>]]></bottom>
<classpath>
<pathelement path="${lib}/java/jsr305.jar"/>
</classpath>
<arg value="-XDignore.symbol.file=true"/> <!-- Supresses internal API (e.g. Unsafe) usage warnings -->
<arg value="-Xdoclint"/>
<arg line="-Xmaxwarns 1000"/>
<arg value="-html5" if:set="jdk9"/>
<arg value="-stylesheetfile ${config}/javadoc.css" if:set="jdk9"/>
<arg line="-J-Dfile.encoding=UTF8"/>
<arg line="--add-exports jdk.javadoc/com.sun.tools.doclets=ALL-UNNAMED" if:set="jdk9"/>
</javadoc>
<get-quiet name="favicon" url="https://www.lwjgl.org/favicon.ico" dest="bin/javadoc"/>
<java classname="org.lwjgl.system.JavadocPostProcess" failonerror="true">
<classpath path="${bin.generator}"/>
<arg value="bin/javadoc/org/lwjgl"/>
</java>
</target>
<target name="upload-native" description="Uploads native build artifacts to build.lwjgl.org" depends="compile-native">
<fail message="AWS credentials not configured.">
<condition>
<not>
<or>
<and>
<isset property="env.AWS_ACCESS_KEY_ID"/>
<isset property="env.AWS_SECRET_ACCESS_KEY"/>
</and>
<isset property="env.AWS_CONFIG_FILE"/>
</or>
</not>
</condition>
</fail>
<local name="revision"/>
<property name="revision" value="liblwjgl.so.git" if:set="platform.linux"/>
<property name="revision" value="liblwjgl.dylib.git" if:set="platform.macos"/>
<condition property="revision" value="lwjgl.dll.git" else="lwjgl32.dll.git" if:set="platform.windows">
<equals arg1="${build.arch}" arg2="x64"/>
</condition>
<exec executable="git" failonerror="true" output="${lib}/${revision}" taskname="Git revision">
<arg value="log"/>
<arg value="--first-parent"/>
<arg value="--pretty=format:%H"/>
<arg value="HEAD~2..HEAD~1"/> <!-- Skip the CI commit -->
</exec>
<local name="libraries"/>
<property name="libraries" value="liblwjgl*" unless:set="platform.windows"/>
<condition property="libraries" value="lwjgl*" else="lwjgl*32.*" if:set="platform.windows">
<equals arg1="${build.arch}" arg2="x64"/>
</condition>
<local name="exclude_libraries"/>
<condition property="exclude_libraries" value="lwjgl*32.*" if:set="platform.windows">
<equals arg1="${build.arch}" arg2="x64"/>
</condition>
<apply executable="aws" failonerror="true" relative="true" taskname="S3 upload">
<arg value="s3"/>
<arg value="cp"/>
<srcfile/>
<arg value="s3://build.lwjgl.org/${build.type}/${platform.remote}/${build.arch}/"/>
<arg line='--acl public-read --storage-class REDUCED_REDUNDANCY --cache-control "public, must-revalidate, proxy-revalidate, max-age=0"'/>
<fileset dir=".">
<include name="${lib}/${libraries}"/>
<exclude name="${lib}/${exclude_libraries}" if:set="exclude_libraries"/>
</fileset>
</apply>
</target>
<macrodef name="get-release">
<attribute name="url"/>
<sequential>
<get src="https://build.lwjgl.org/${build.type}/@{url}" dest="${release}/${module}/native" verbose="false" usetimestamp="true"/>
</sequential>
</macrodef>
<macrodef name="lwjgl-jar">
<attribute name="destfile"/>
<attribute name="title"/>
<element name="content" optional="true" implicit="true"/>
<sequential>
<jar destfile="@{destfile}" level="9" index="true" indexmetainf="true" whenmanifestonly="skip">
<manifest>
<attribute name="Specification-Title" value="Lightweight Java Game Library - @{title}"/>
<attribute name="Specification-Version" value="${build.version}"/>
<attribute name="Specification-Vendor" value="lwjgl.org"/>
<attribute name="Implementation-Title" value="${module}"/>
<attribute name="Implementation-Version" value="${revision}"/>
<attribute name="Implementation-Vendor" value="lwjgl.org"/>
<attribute name="Multi-Release" value="true" if:set="jdk9"/>
</manifest>
<content/>
</jar>
</sequential>
</macrodef>
<macrodef name="natives-jar">
<attribute name="name"/>
<attribute name="title"/>
<attribute name="platform"/>
<attribute name="extension"/>
<element name="content" optional="true" implicit="true"/>
<sequential>
<local name="platform.skip"/>
<condition property="platform.skip">
<resourcecount when="eq" count="0">
<fileset dir="${release}/${module}/native" includes="*@{extension}"/>
</resourcecount>
</condition>
<lwjgl-jar destfile="${release}/${module}/${module}-natives-@{platform}.jar" title="@{title}" unless:set="platform.skip">
<fileset dir="${release}/${module}/native" includes="*@{extension}*"/>
<fileset dir="${bin.lwjgl}/@{name}.natives" includes="META-INF/versions/9/module-info.class" if:set="jdk9"/>
</lwjgl-jar>
</sequential>
</macrodef>
<macrodef name="release-natives">
<attribute name="name"/>
<attribute name="title"/>
<attribute name="native-library"/>
<element name="content" optional="true" implicit="true"/>
<sequential>
<mkdir dir="${release}/${module}/native"/>
<local name="auto-natives"/>
<condition property="auto-natives">
<not>
<length string="@{native-library}" length="0"/>
</not>
</condition>
<local name="git-revision"/>
<condition property="git-revision" if:set="auto-natives">
<not>
<matches pattern="^lwjgl_.+" string="@{native-library}"/>
</not>
</condition>
<parallel threadsPerProcessor="4" failonany="true">
<get-release url="linux/x64/lib@{native-library}.so" if:set="auto-natives"/>
<get-release url="macosx/x64/lib@{native-library}.dylib" if:set="auto-natives"/>
<get-release url="windows/x64/@{native-library}.dll" if:set="auto-natives"/>
<get-release url="windows/x86/@{native-library}32.dll" if:set="auto-natives"/>
<get-release url="linux/x64/lib@{native-library}.so.git" if:set="git-revision"/>
<get-release url="macosx/x64/lib@{native-library}.dylib.git" if:set="git-revision"/>
<get-release url="windows/x64/@{native-library}.dll.git" if:set="git-revision"/>
<get-release url="windows/x86/@{native-library}32.dll.git" if:set="git-revision"/>
<content/>
</parallel>
<checksum algorithm="SHA-1" fileext=".sha1">
<fileset dir="${release}/${module}/native">
<include name="*.dll"/>
<include name="*.dylib"/>
<include name="*.so"/>
</fileset>
</checksum>
<parallel threadsPerProcessor="1" failonany="true">
<natives-jar name="@{name}" title="@{title}" platform="linux" extension=".so"/>
<natives-jar name="@{name}" title="@{title}" platform="macos" extension=".dylib"/>
<natives-jar name="@{name}" title="@{title}" platform="windows" extension=".dll"/>
</parallel>
</sequential>
</macrodef>
<macrodef name="release-module">
<attribute name="package"/>
<attribute name="name"/>
<attribute name="title"/>
<attribute name="native-library" default=""/>
<attribute name="license" default="@{name}"/>
<element name="natives" optional="true"/>
<sequential>
<local name="module"/>
<condition property="module" value="lwjgl" else="lwjgl-@{name}">
<equals arg1="@{name}" arg2="core"/>
</condition>
<local name="module.java"/>
<condition property="module.java" value="org.lwjgl" else="org.lwjgl.@{name}">
<equals arg1="@{name}" arg2="core"/>
</condition>
<!-- Bundle natives -->
<release-natives name="@{name}" title="@{title}" native-library="@{native-library}" unless:set="java-only.binding.@{name}">
<natives/>
</release-natives>
<!-- Bundle classes -->
<lwjgl-jar destfile="${release}/${module}/${module}.jar" title="@{title}">
<fileset dir="${release}/${module}/native" includes="*.sha1" unless:set="java-only.binding.@{name}"/>
<fileset dir="${bin.lwjgl}/@{name}" includes="**"/>
</lwjgl-jar>
<delete dir="${release}/${module}/native" unless:set="java-only.binding.@{name}"/>
<local name="hasMain"/>
<available file="${module.lwjgl}/@{name}/src/main/java" type="dir" property="hasMain"/>
<!-- Bundle javadoc -->
<mkdir dir="${release}/${module}/javadoc"/>
<javadoc
destdir="${release}/${module}/javadoc"
source="1.8"
windowtitle="LWJGL ${build.version} - @{title}"
encoding="UTF-8"
docencoding="UTF-8"
charset="UTF-8"
useexternalfile="true"
nohelp="true"
notree="true"
public="true"
doclet="org.lwjgl.system.ExcludeDoclet"
docletpath="${bin.generator}"
failonerror="true"
>
<doctitle><![CDATA[<h1>LWJGL - @{title}</h1>]]></doctitle>
<bottom><![CDATA[<i>Copyright LWJGL. All Rights Reserved. <a href="https://www.lwjgl.org/license">License terms</a>.</i>]]></bottom>
<classpath>
<pathelement path="${module.classpath}"/>
<pathelement path="${lib}/java/jsr305.jar"/>
</classpath>
<fileset dir="${module.lwjgl}/@{name}/src/main/java" includes="**" if:set="hasMain"/>
<fileset dir="${module.lwjgl}/@{name}/src/generated/java" includes="**"/>
<arg value="-XDignore.symbol.file=true"/> <!-- Supresses internal API (e.g. Unsafe) usage warnings -->
<arg value="-Xdoclint:none"/>
<arg line="-Xmaxwarns 1"/>
<arg value="-html5" if:set="jdk9"/>
<arg value="-stylesheetfile ${config}/javadoc.css" if:set="jdk9"/>
<arg line="-J-Dfile.encoding=UTF8"/>
<arg line="--add-exports jdk.javadoc/com.sun.tools.doclets=ALL-UNNAMED" if:set="jdk9"/>
</javadoc>
<get-quiet name="favicon" url="https://www.lwjgl.org/favicon.ico" dest="${release}/${module}/javadoc"/>
<java classname="org.lwjgl.system.JavadocPostProcess" failonerror="true">
<classpath path="${bin.generator}"/>
<arg value="${release}/${module}/javadoc/org/lwjgl"/>
</java>
<zip destfile="${release}/${module}/${module}-javadoc.jar" basedir="${release}/${module}/javadoc" includes="**" level="9"/>
<delete dir="${release}/${module}/javadoc"/>
<!-- Bundle source -->
<copy
file ="${module.lwjgl}/@{name}/src/main/resources/module-info.java"
todir="${module.lwjgl}/@{name}/src/generated/java/META-INF/versions/9"
quiet="true"
if:set="jdk9"
/>
<jar destfile="${release}/${module}/${module}-sources.jar" level="9">
<fileset dir="${module.lwjgl}/@{name}/src/main/java" includes="**" if:set="hasMain"/>
<fileset dir="${module.lwjgl}/@{name}/src/generated/java" includes="**"/>
</jar>
<delete dir="${module.lwjgl}/@{name}/src/generated/java/META-INF" quiet="true"/>
<!-- Copy license -->
<copy todir="${release}/${module}">
<fileset dir="${module.lwjgl}/@{name}" includes="@{license}*"/>
</copy>
</sequential>
</macrodef>
<target name="-check-release-jdk">
<fail message="The JAVA8_HOME environment variable is not set." if:set="jdk9">
<condition>
<not><isset property="env.JAVA8_HOME"/></not>
</condition>
</fail>
<local name="input"/>
<input
message="It is recommended to build LWJGL releases on JDK 9 or higher. Continue with JDK 8?"
validargs="y,n"
defaultvalue="n"