forked from LWJGL/lwjgl3
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
1977 lines (1659 loc) · 90.6 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">
<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"/>
<!-- Compile custom Ant tasks -->
<mkdir dir="${bin.ant}"/>
<lwjgl.javac
destdir="${bin.ant}"
classpath="${ant.core.lib}"
srcdir="${src.ant}/java"
includes="org/lwjgl/**"
taskname="javac: Custom Ant Tasks"
/>
<taskdef name="logLevel" classname="org.lwjgl.SetLogLevel" classpath="${bin.ant}"/>
<taskdef name="bindingConfig" classname="org.lwjgl.BindingConfig" classpath="${bin.ant}"/>
<bindingConfig/>
<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;${lib}/java/slf4j-api.jar;${lib}/java/slf4j-jdk14.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}" unless:set="module"/>
<delete dir="${bin.native}/${module}" if:set="module"/>
</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 unless:set="module">
<delete dir="${module.lwjgl}/${module}/src/generated/java"/>
</forEachModule>
<delete dir="${module.lwjgl}/${module}/src/generated/java" if:set="module"/>
</target>
<target name="clean-generated-native" description="Deletes native sources generated by this script">
<delete file="${bin.generator}/generated-touch.txt" quiet="true"/>
<forEachModule unless:set="module">
<delete dir="${module.lwjgl}/${module}/src/generated/c" quiet="true"/>
</forEachModule>
<delete dir="${module.lwjgl}/${module}/src/generated/c" quiet="true" if:set="module"/>
</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 value="-progressive"/>
<compilerarg value="-Xno-call-assertions"/>
<compilerarg value="-Xno-param-assertions"/>
<compilerarg value="-Xlambdas=indy"/>
<compilerarg value="-Xreport-perf"/>
<compilerarg value="-Xbackend-threads=${backend-threads}" if:set="backend-threads"/>
<compilerarg line="-jvm-target 1.8"/>
<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"
/>
</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}"/>
<istrue value="${binding.openxr}"/>
</and>
</condition>
<local name="opengl_types"/>
<condition property="opengl_types">
<and>
<isfalse value="${binding.opengl}"/>
<istrue value="${binding.glfw}"/>
<istrue value="${binding.openxr}"/>
</and>
</condition>
<local name="vulkan_types"/>
<condition property="vulkan_types">
<and>
<isfalse value="${binding.vulkan}"/>
<istrue value="${binding.glfw}"/>
<istrue value="${binding.openxr}"/>
</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 value="-progressive"/>
<compilerarg value="-Xno-call-assertions"/>
<compilerarg value="-Xno-param-assertions"/>
<compilerarg value="-Xlambdas=indy"/>
<compilerarg value="-Xreport-perf"/>
<compilerarg value="-Xbackend-threads=${backend-threads}" if:set="backend-threads"/>
<compilerarg line="-jvm-target 1.8"/>
<src path="${module.templatepath}"/>
<src path="${module.lwjgl}/egl/src/templates/kotlin/egl/EGLTypes.kt" if:set="egl_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"/>
<src path="${module.lwjgl}/vulkan/src/templates/kotlin/vulkan/VkVideoTypes.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="cache-kotlinc" description="Uploads the compiled Kotlin templates to build.lwjgl.org" depends="init">
<antcall target="clean-kotlin" unless:set="quick"/>
<antcall target="compile-templates" unless:set="quick"/>
<local name="commit"/>
<exec executable="git" failonerror="true" outputproperty="commit" taskname="Git revision">
<arg value="log"/>
<arg value="--first-parent"/>
<arg value="--pretty=format:%H"/>
<arg value="${revision}" if:set="revision"/>
<arg value="HEAD~1..HEAD" unless:set="revision"/>
</exec>
<jar destfile="templates.jar" level="9" taskname="Building templates.jar">
<manifest>
<attribute name="Specification-Title" value="LWJGL Kotlin Template Cache"/>
<attribute name="Specification-Vendor" value="lwjgl.org"/>
<attribute name="Implementation-Version" value="${commit}"/>
</manifest>
<fileset dir=".">
<include name="${bin.generator}/**"/>
<include name="${bin.templates}/**"/>
<exclude name="**/*.txt"/>
</fileset>
</jar>
<apply executable="aws" failonerror="true" relative="true" taskname="S3 upload">
<arg value="s3"/>
<arg value="mv"/>
<srcfile/>
<arg value="s3://lwjgl-build/ci/"/>
<arg line='--cache-control "public, must-revalidate, proxy-revalidate, max-age=0"'/>
<fileset file="templates.jar"/>
</apply>
</target>
<target name="hydrate-kotlinc" description="Downloads the compiled Kotlin templates to build.lwjgl.org" depends="init">
<!-- Download cache -->
<get taskname="Downloading templates.jar" src="https://build.lwjgl.org/ci/templates.jar" dest="."/>
<!-- Validate commit -->
<local name="Implementation-Version"/>
<loadproperties taskname="Cache revision">
<zipentry zipfile="templates.jar" name="META-INF/MANIFEST.MF"/>
<filterchain>
<linecontains>
<contains value="Implementation-Version"/>
</linecontains>
</filterchain>
</loadproperties>
<local name="commit_message"/>
<exec executable="git" failonerror="true" outputproperty="commit_message" taskname="Git message">
<arg value="log"/>
<arg value="--first-parent"/>
<arg value="--pretty=format:%s"/>
<arg value="HEAD~1..HEAD"/>
</exec>
<local name="commit_CI"/>
<condition property="commit_CI" value="true" else="false">
<equals arg1="${commit_message}" arg2="CI configuration"/>
</condition>
<local name="commit"/>
<exec executable="git" failonerror="true" outputproperty="commit" taskname="Git revision">
<arg value="log"/>
<arg value="--first-parent"/>
<arg value="--pretty=format:%H"/>
<arg value="HEAD~2..HEAD~1" if:true="${commit_CI}"/>
<arg value="HEAD~1..HEAD" unless:true="${commit_CI}"/>
</exec>
<local name="commit_mismatch"/>
<local name="fail_on_mismatch"/>
<condition property="commit_mismatch" value="true">
<not><equals arg1="${Implementation-Version}" arg2="${commit}"/></not>
</condition>
<condition property="fail_on_mismatch" value="true">
<and>
<isset property="commit_mismatch"/>
<not><isset property="hydrate-kotlinc.force"/></not>
</and>
</condition>
<delete file="templates.jar" taskname="Deleting the compiled Kotlin templates cache" if:set="fail_on_mismatch"/>
<fail message="The current commit does not match the Kotlin template cache's commit." if="fail_on_mismatch"/>
<echo message="The current commit does not match the Kotlin template cache's commit, but hydration has been forced." taskname="WARNING" if:set="commit_mismatch"/>
<!-- Hydrate -->
<antcall target="clean-kotlin"/>
<unzip src="templates.jar" dest="." taskname="Hydrating the compiled Kotlin templates">
<patternset>
<include name="**/*"/>
<exclude name="META-INF"/>
<exclude name="META-INF/MANIFEST.MF"/>
</patternset>
</unzip>
<antcall target="touch-kotlinc"/>
<!-- Cleanup -->
<delete file="templates.jar" taskname="Deleting the compiled Kotlin templates cache"/>
</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-stdlib.jar"/>
</classpath>
<jvmarg line="${generator.bindings}"/>
<jvmarg line="-Dfile.encoding=UTF8 -Dline.separator= "/>
<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>
<!-- cleanup in case there was an earlier "release" failure -->
<delete dir="${module.lwjgl}/@{binding}/src/generated/java/META-INF" quiet="true"/>
<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"/>
</classpath>
<src>
<pathelement path="${module.lwjgl}/@{binding}/src/main/java" if:set="hasMain"/>
<pathelement path="${module.lwjgl}/@{binding}/src/generated/java"/>
</src>
<include name="**"/>
<body/>
</lwjgl.javac>
</sequential>
</macrodef>
<target name="compile" description="Compiles the Java source code" depends="generate">
<mkdir dir="${bin.lwjgl}/core"/>
<!-- cleanup in case there was an earlier "release" failure -->
<delete dir="${module.lwjgl}/core/src/generated/java/META-INF" quiet="true"/>
<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="**"/>
</lwjgl.javac>
<mkdir dir="${bin.lwjgl}/core/META-INF/versions/9" if:set="jdk9"/>
<mkdir dir="${bin.lwjgl}/core/META-INF/versions/10" if:set="jdk10"/>
<mkdir dir="${bin.lwjgl}/core/META-INF/versions/16" if:set="jdk16"/>
<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" taskname="javac: Core - Java 9" if:set="jdk9">
<classpath>
<pathelement path="${bin.lwjgl}/core"/>
<pathelement path="${lib}/java/jsr305.jar"/>
</classpath>
<src>
<pathelement path="${module.lwjgl}/core/src/main/java9"/>
</src>
<include name="**"/>
</lwjgl.javac9>
<lwjgl.javac10 destdir="${bin.lwjgl}/core/META-INF/versions/10" taskname="javac: Core - Java 10" if:set="jdk10">
<classpath>
<pathelement path="${bin.lwjgl}/core"/>
</classpath>
<src>
<pathelement path="${module.lwjgl}/core/src/main/java10"/>
</src>
<include name="**"/>
</lwjgl.javac10>
<lwjgl.javac16 destdir="${bin.lwjgl}/core/META-INF/versions/16" taskname="javac: Core - Java 16" if:set="jdk16">
<classpath>
<pathelement path="${bin.lwjgl}/core"/>
</classpath>
<src>
<pathelement path="${module.lwjgl}/core/src/main/java16"/>
</src>
<include name="**"/>
</lwjgl.javac16>
<parallel threadsPerProcessor="1">
<compileBinding binding="assimp"/>
<compileBinding binding="bgfx"/>
<compileBinding binding="cuda"/>
<compileBinding binding="egl"/>
<compileBinding binding="fmod"/>
<compileBinding binding="freetype"/>
<compileBinding binding="harfbuzz"/>
<compileBinding binding="hwloc"/>
<compileBinding binding="jawt"/>
<compileBinding binding="jemalloc"/>
<compileBinding binding="libdivide"/>
<compileBinding binding="llvm"/>
<compileBinding binding="lmdb"/>
<compileBinding binding="lz4"/>
<compileBinding binding="meow"/>
<compileBinding binding="meshoptimizer"/>
<compileBinding binding="nanovg"/>
<compileBinding binding="nfd"/>
<compileBinding binding="nuklear"/>
<compileBinding binding="odbc"/>
<compileBinding binding="openal"/>
<compileBinding binding="opencl"/>
<compileBinding binding="opengles"/>
<compileBinding binding="openvr"/>
<compileBinding binding="opus"/>
<compileBinding binding="par"/>
<compileBinding binding="remotery"/>
<compileBinding binding="rpmalloc"/>
<compileBinding binding="shaderc"/>
<compileBinding binding="spvc"/>
<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">
<classpath><pathelement path="${bin.lwjgl}/opencl"/></classpath>
</compileBinding>
<compileBinding binding="ovr">
<classpath><pathelement path="${bin.lwjgl}/vulkan"/></classpath>
</compileBinding>
<compileBinding binding="vma">
<classpath><pathelement path="${bin.lwjgl}/vulkan"/></classpath>
</compileBinding>
</parallel>
<compileBinding binding="glfw">
<classpath>
<pathelement path="${bin.lwjgl}/egl"/>
<pathelement path="${bin.lwjgl}/opengl"/>
<pathelement path="${bin.lwjgl}/opengles"/>
<pathelement path="${bin.lwjgl}/vulkan"/>
</classpath>
<exclude name="org/lwjgl/glfw/GLFWNativeEGL.java" unless:true="${binding.egl}"/>
<exclude name="org/lwjgl/glfw/GLFWNativeGLX.java" unless:true="${binding.opengl}"/>
<exclude name="org/lwjgl/glfw/GLFWNativeNSGL.java" unless:true="${binding.opengl}"/>
<exclude name="org/lwjgl/glfw/GLFWNativeWGL.java" unless:true="${binding.opengl}"/>
<exclude name="org/lwjgl/glfw/GLFWVulkan.java" unless:true="${binding.vulkan}"/>
</compileBinding>
<compileBinding binding="ktx">
<classpath>
<pathelement path="${bin.lwjgl}/vulkan"/>
</classpath>
</compileBinding>
<compileBinding binding="openxr">
<classpath>
<pathelement path="${bin.lwjgl}/egl"/>
<pathelement path="${bin.lwjgl}/opengl"/>
<pathelement path="${bin.lwjgl}/vulkan"/>
</classpath>
</compileBinding>
</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-extract">
<local name="extract-uptodate"/>
<uptodate targetfile="${bin.extract}/touch.txt" property="extract-uptodate">
<srcfiles dir="${src.extract}/kotlin" includes="**"/>
</uptodate>
<echo message="Compiling LWJGL Template Extraction Tool..." level="info" taskname="extract compilation" unless:set="extract-uptodate"/>
<mkdir dir="${bin.extract}"/>
<kotlinc moduleName="extract" output="${bin.extract}" printVersion="true" unless:set="extract-uptodate">
<classpath>
<pathelement path="${bin.lwjgl}/core/META-INF/versions/9" if:set="core.java9"/>
<pathelement path="${bin.lwjgl}/core/META-INF/versions/10" if:set="core.java10"/>
<pathelement path="${bin.lwjgl}/core/META-INF/versions/16" if:set="core.java16"/>
<pathelement path="${module.classpath}"/>
<pathelement path="${kotlinc}/lib/kotlin-stdlib.jar"/>
<pathelement path="${kotlinc}/lib/kotlin-stdlib-jdk7.jar"/>
</classpath>
<compilerarg line="-jvm-target 1.8"/>
<compilerarg value="-Xno-call-assertions"/>
<compilerarg value="-Xno-param-assertions"/>
<compilerarg value="-Xreport-perf"/>
<compilerarg value="-progressive"/>
<compilerarg value="-Xuse-experimental=kotlin.Experimental"/>
<compilerarg value="-Xuse-experimental=kotlin.contracts.ExperimentalContracts"/>
<src path="${src.extract}/kotlin"/>
</kotlinc>
<touch file="${bin.extract}/touch.txt" unless:set="extract-uptodate"/>
</target>
<target name="touch-extract" description="Used for touching from an IDE">
<touch file="${bin.extract}/touch.txt"/>
</target>
<target name="extract" description="Runs the LWJGL Template Extraction tool" depends="compile-native, -compile-extract">
<java classname="org.lwjgl.extract.MainKt" fork="true" spawn="true" taskname="LWJGL Template Extraction Tool">
<classpath>
<pathelement path="${bin.lwjgl}/core/META-INF/versions/9" if:set="core.java9"/>
<pathelement path="${bin.lwjgl}/core/META-INF/versions/10" if:set="core.java10"/>
<pathelement path="${bin.lwjgl}/core/META-INF/versions/16" if:set="core.java16"/>
<pathelement path="${module.classpath}"/>
<pathelement path="${bin.extract}"/>
<pathelement path="${test.resources}"/>
<pathelement path="${kotlinc}/lib/kotlin-stdlib.jar"/>
<pathelement path="${kotlinc}/lib/kotlin-stdlib-jdk7.jar"/>
<pathelement path="${lib}/native"/>
</classpath>
<jvmarg line="${jvmargs}" if:set="jvmargs"/>
<arg line="${args}" if:set="args"/>
</java>
</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.openxr"/>
<condition property="test.openxr">
<and>
<istrue value="${binding.glfw}"/>
<istrue value="${binding.opengl}"/>
<istrue value="${binding.vulkan}"/>
</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>
<local name="test.hashing"/>
<condition property="test.hashing">
<and>
<istrue value="${binding.xxhash}"/>
<istrue value="${binding.meow}"/>
</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/jmh-core.jar"/>
<pathelement path="${lib}/java/jmh-generator-annprocess.jar"/>
<pathelement path="${lib}/java/joml.jar"/>
<pathelement path="${lib}/java/testng.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/cuda/**" if:true="${binding.cuda}"/>
<include name="org/lwjgl/demo/egl/**" if:set="test.egl"/>
<include name="org/lwjgl/demo/fmod/**" if:true="${binding.fmod}"/>
<include name="org/lwjgl/demo/glfw/**" if:set="test.glfw"/>
<include name="org/lwjgl/demo/llvm/**" if:true="${binding.llvm}"/>
<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/openxr/**" if:set="test.openxr"/>
<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/system/linux/liburing/**" if:set="platform.linux"/>
<include name="org/lwjgl/demo/util/*.java"/>
<include name="org/lwjgl/demo/util/freetype/**" if:true="${binding.freetype}"/>
<include name="org/lwjgl/demo/util/harfbuzz/**" if:true="${binding.harfbuzz}"/>
<include name="org/lwjgl/demo/util/hwloc/**" if:true="${binding.hwloc}"/>
<include name="org/lwjgl/demo/util/ktx/**" if:true="${binding.ktx}"/>
<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/meow/**" if:true="${binding.meow}"/>
<include name="org/lwjgl/demo/util/meshoptimizer/**" if:true="${binding.meshoptimizer}"/>
<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/remotery/**" if:true="${binding.remotery}"/>
<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"/>
<!-- Benchmarks -->
<include name="org/lwjgl/jmh/**"/>
<exclude name="org/lwjgl/jmh/Hashing*" unless:true="${test.hashing}"/>
<exclude name="org/lwjgl/jmh/VarHandle*" unless:set="jdk9"/>
</lwjgl.javac>
</target>
<target name="tests" description="Runs the LWJGL test suite" depends="compile-tests, compile-native">
<testng haltonfailure="true" outputDir="${bin.test.html}" taskname="Tests">
<classpath>
<pathelement path="${bin.lwjgl}/core/META-INF/versions/9" if:set="core.java9"/>
<pathelement path="${bin.lwjgl}/core/META-INF/versions/10" if:set="core.java10"/>
<pathelement path="${bin.lwjgl}/core/META-INF/versions/16" if:set="core.java16"/>
<pathelement path="${module.classpath}"/>
<pathelement path="${bin.test}"/>
<pathelement path="${lib}/java/jcommander.jar"/>
<pathelement path="${lib}/java/jquery.jar"/>
<pathelement path="${lib}/java/slf4j-api.jar"/>
<pathelement path="${lib}/java/slf4j-jdk14.jar"/>
<pathelement path="${lib}/native"/>
</classpath>
<!--<jvmarg value="-Xcheck:jni"/>--> <!-- SIMD fails with this (see -XX:+RestoreMXCSROnJNICall) -->
<jvmarg value="-server"/>
<jvmarg value="-ea"/>
<jvmarg value="-Dorg.lwjgl.util.Debug=true"/>
<jvmarg value="-Dorg.lwjgl.util.DebugAllocator=true"/>
<jvmarg value="-XstartOnFirstThread" if:set="platform.macos"/>
<jvmarg value="-Xss256k" if:set="build.arch.x64|x86"/> <!-- 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="${bin.lwjgl}/core/META-INF/versions/10" if:set="core.java10"/>
<pathelement path="${bin.lwjgl}/core/META-INF/versions/16" if:set="core.java16"/>
<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"/>
<pathelement path="${lib}/java/jmh-core.jar"/>
<pathelement path="${lib}/java/commons-math3.jar"/>
<pathelement path="${lib}/java/jopt-simple.jar"/>
<pathelement path="${lib}/native"/>
</classpath>
<jvmarg value="-server"/>
<jvmarg value="-XstartOnFirstThread" if:set="platform.macos"/>
<!--<jvmarg value="-Xcheck:jni"/>-->
<jvmarg line="-XX:+UnlockDiagnosticVMOptions -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="-agentlib:native-image-agent=config-output-dir=META-INF/native-image"/>-->
<jvmarg line="${jvmargs}" if:set="jvmargs"/>
<arg line="${args}" if:set="args"/>
</java>
</target>
<target name="-build-version" depends="compile">
<!-- -Dbuild.version is manually specified only when building a release -->
<condition property="build.release" value="true" else="false">
<isset property="build.version"/>
</condition>
<java classname="org.lwjgl.Version" fork="true" failonerror="true" outputproperty="build.version" errorproperty="build.version.plain" unless:set="build.version">
<classpath>
<pathelement path="${bin.lwjgl}/core"/>
<pathelement path="${lib}/native"/>
</classpath>
</java>
</target>
<target name="-check-AWS-credentials">
<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>
</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 10 or higher." unless:set="jdk10" taskname="Warning"/>
<delete dir="${bin.javadoc}"/>
<path id="javadoc.sources">
<pathelement path="${module.javadocsourcepath}"/>
</path>
<javadoc
destdir="${bin.javadoc}"
sourcepathref="javadoc.sources"
source="9"
windowtitle="LWJGL ${build.version}"
encoding="UTF-8"
docencoding="UTF-8"
charset="UTF-8"
useexternalfile="true"
nohelp="true"
notree="true"
public="true"
Splitindex="true"