<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"/>
<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"/>
<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>
<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="${core.kotlin.path}/jni"/>
<src path="${core.kotlin.path}/libc"/>
<src path="${core.kotlin.path}/libffi"/>
<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}/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">
<get taskname="Downloading templates.jar" src="https://build.lwjgl.org/ci/templates.jar" dest="."/>
<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"/>
<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"/>
<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>
<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"/>
<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="lwjglx">
<classpath>
<pathelement path="${bin.lwjgl}/glfw"/>
<pathelement path="${bin.lwjgl}/openal"/>
<pathelement path="${bin.lwjgl}/opengl"/>
</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>
<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/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/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"/>
<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="-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" unless:set="build.arch.arm"/>
<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 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="${jvmargs}" if:set="jvmargs"/>
<arg line="${args}" if:set="args"/>
</java>
</target>
<target name="-build-version" depends="compile">
<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>
<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"
failonerror="true"
verbose="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"/>
<arg line="-Xdoclint:none" if:set="nodoclint"/>
<arg line="-Xdoclint:html,reference,syntax" unless:set="nodoclint"/>
<arg line="-Xmaxerrs 1000 -Xmaxwarns 1000"/>
<arg line="-notimestamp"/>
<arg value="-html5" if:set="jdk9"/>
<arg line="-J-Dfile.encoding=UTF8 -J-Dline.separator= "/>
<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}"/>
</java>
</target>
<target name="upload-native" description="Uploads native build artifacts to build.lwjgl.org" depends="compile-native,-check-AWS-credentials">
<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"/>
<property name="revision" value="lwjgl.dll.git" if:set="platform.windows"/>
<exec executable="git" failonerror="true" output="${lib.native}/org/lwjgl/${revision}" taskname="Git revision">
<arg value="log"/>
<arg value="--first-parent"/>
<arg value="--pretty=format:%H"/>
<arg value="HEAD~2..HEAD~1"/>
</exec>
<apply executable="aws" failonerror="true" relative="true" taskname="S3 upload">
<arg value="s3"/>
<arg value="cp"/>
<srcfile/>
<arg value="s3://lwjgl-build/${build.type}/${platform.remote}/${build.arch}/"/>
<arg line='--cache-control "public, must-revalidate, proxy-revalidate, max-age=0"'/>
<fileset dir=".">
<and>
<filename name="${lib.native}/**"/>
<filename regex="\${file.separator}(?:lib)?lwjgl.*?\.(?:dll|dylib|so)(?:\.git)?$"/>
</and>
</fileset>
</apply>
</target>
<macrodef name="get-release">
<attribute name="platform"/>
<attribute name="arch"/>
<attribute name="file"/>
<sequential>
<local name="skip.git"/>
<condition property="skip.git">
<and>
<istrue value="${build.offline}"/>
<matches string="@{file}" pattern="^.+\.git$"/>
</and>
</condition>
<sequential unless:set="skip.git">
<local name="destination"/>
<condition property="destination"
value="${release}/${module}/META-INF/@{platform}/@{arch}/${module.path}"
else="${release}/${module}/native/@{platform}/@{arch}/${module.path}"
>
<matches string="@{file}" pattern="^.+\.git$"/>
</condition>
<sequential unless:true="${build.offline}">
<quiet>
<mkdir dir="${destination}"/>
</quiet>
<get
src="https://build.lwjgl.org/${build.type}/${platform.@{platform}.remote}/@{arch}/@{file}"
dest="${destination}"
usetimestamp="true"
/>
</sequential>
<sequential if:true="${build.offline}">
<local name="source"/>
<property name="source" value="${lib}/native/@{platform}/@{arch}/${module.path}/@{file}"/>
<local name="available"/>
<available file="${source}" property="available"/>
<echo message="Missing offline artifact: ${source}" level="warning" unless:set="available"/>
<quiet if:set="available">
<mkdir dir="${destination}"/>
<copy file="${source}" todir="${destination}"/>
</quiet>
</sequential>
</sequential>
</sequential>
</macrodef>
<macrodef name="lwjgl-jar">
<attribute name="destfile"/>
<attribute name="title"/>
<attribute name="platform" default=""/>
<element name="content" optional="true" implicit="true"/>
<sequential>
<local name="platform-attrib"/>
<condition property="platform-attrib" value="true" else="false"><not><length string="@{platform}" length="0"/></not></condition>
<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="LWJGL-Platform" value="@{platform}" if:true="${platform-attrib}"/>
<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="path"/>
<attribute name="type"/>
<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}" includes="native/@{path}/${module.path}/*.@{type}"/>
</resourcecount>
</condition>
<lwjgl-jar destfile="${release}/${module}/${module}-natives-@{platform}.jar" platform="@{path}" title="@{title}" unless:set="platform.skip">
<fileset dir="${release}/${module}" includes="META-INF/@{path}/${module.path}/*.@{type}*"/>
<fileset dir="${release}/${module}/native" includes="@{path}/${module.path}/*.@{type}*"/>
<fileset dir="${release}/${module}/native/@{path}" includes="META-INF/versions/9/module-info.class" if:set="jdk9"/>
<content/>
</lwjgl-jar>
</sequential>
</macrodef>
<macrodef name="release-natives">
<attribute name="name"/>
<attribute name="title"/>
<attribute name="native-library"/>
<element name="content" optional="true"/>
<element name="linux-content" optional="true"/>
<element name="linux-arm64-content" optional="true"/>
<element name="linux-arm32-content" optional="true"/>
<element name="macos-content" optional="true"/>
<element name="macos-arm64-content" optional="true"/>
<element name="windows-content" optional="true"/>
<element name="windows-x86-content" optional="true"/>
<element name="windows-arm64-content" optional="true"/>
<sequential>
<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 platform="linux" arch="x64" file="lib@{native-library}.so" if:set="auto-natives"/>
<get-release platform="linux" arch="x64" file="lib@{native-library}.so.git" if:set="git-revision"/>
<get-release platform="linux" arch="arm64" file="lib@{native-library}.so" if:set="auto-natives"/>
<get-release platform="linux" arch="arm64" file="lib@{native-library}.so.git" if:set="git-revision"/>
<get-release platform="linux" arch="arm32" file="lib@{native-library}.so" if:set="auto-natives"/>
<get-release platform="linux" arch="arm32" file="lib@{native-library}.so.git" if:set="git-revision"/>
<get-release platform="macos" arch="x64" file="lib@{native-library}.dylib" if:set="auto-natives"/>
<get-release platform="macos" arch="x64" file="lib@{native-library}.dylib.git" if:set="git-revision"/>
<get-release platform="macos" arch="arm64" file="lib@{native-library}.dylib" if:set="auto-natives"/>
<get-release platform="macos" arch="arm64" file="lib@{native-library}.dylib.git" if:set="git-revision"/>
<get-release platform="windows" arch="x64" file="@{native-library}.dll" if:set="auto-natives"/>
<get-release platform="windows" arch="x64" file="@{native-library}.dll.git" if:set="git-revision"/>
<get-release platform="windows" arch="x86" file="@{native-library}.dll" if:set="auto-natives"/>
<get-release platform="windows" arch="x86" file="@{native-library}.dll.git" if:set="git-revision"/>
<get-release platform="windows" arch="arm64" file="@{native-library}.dll" if:set="auto-natives"/>
<get-release platform="windows" arch="arm64" file="@{native-library}.dll.git" if:set="git-revision"/>
<content/>
</parallel>
<local name="missing-natives"/>
<condition property="missing-natives">
<and>
<istrue value="${build.offline}"/>
<resourcecount when="eq" count="0">
<fileset dir="${release}/${module}">
<include name="native/**/*.dll"/>
<include name="native/**/*.dylib"/>
<include name="native/**/*.so"/>
</fileset>
</resourcecount>
</and>
</condition>
<sequential unless:set="missing-natives">
<mkdir dir="${release}/${module}/META-INF"/>
<checksum algorithm="SHA-1" fileext=".sha1" todir="${release}/${module}/META-INF">
<fileset dir="${release}/${module}/native">
<include name="**/*.dll"/>
<include name="**/*.dylib"/>
<include name="**/*.so"/>
</fileset>
</checksum>
<java
classpath="bin/classes/generator"
classname="org.lwjgl.generator.util.ModuleInfoGen"
fork="true"
failonerror="true"
taskname="module-info-gen :: native :: ${module}"
if:set="jdk9"
>
<jvmarg value="-Dmodule.name.source=${module.name}"/>
<jvmarg value="-Dmodule.name.release=${module}"/>
<jvmarg value="-Dmodule.version=${module.version}"/>
</java>
<parallel threadsPerProcessor="1" failonany="true">
<natives-jar name="@{name}" title="@{title}" platform="linux" path="linux/x64" type="so">
<linux-content/>
</natives-jar>
<natives-jar name="@{name}" title="@{title}" platform="linux-arm64" path="linux/arm64" type="so">
<linux-arm64-content/>
</natives-jar>
<natives-jar name="@{name}" title="@{title}" platform="linux-arm32" path="linux/arm32" type="so">
<linux-arm32-content/>
</natives-jar>
<natives-jar name="@{name}" title="@{title}" platform="macos" path="macos/x64" type="dylib">
<macos-content/>
</natives-jar>
<natives-jar name="@{name}" title="@{title}" platform="macos-arm64" path="macos/arm64" type="dylib">
<macos-arm64-content/>
</natives-jar>
<natives-jar name="@{name}" title="@{title}" platform="windows" path="windows/x64" type="dll">
<windows-content/>
</natives-jar>
<natives-jar name="@{name}" title="@{title}" platform="windows-x86" path="windows/x86" type="dll">
<windows-x86-content/>
</natives-jar>
<natives-jar name="@{name}" title="@{title}" platform="windows-arm64" path="windows/arm64" type="dll">
<windows-arm64-content/>
</natives-jar>
</parallel>
</sequential>
</sequential>
</macrodef>
<macrodef name="release-module">
<attribute name="name"/>
<attribute name="title"/>
<attribute name="native-library" default=""/>
<element name="natives" optional="true"/>
<element name="linux" optional="true"/>
<element name="linux-arm64" optional="true"/>
<element name="linux-arm32" optional="true"/>
<element name="macos" optional="true"/>
<element name="macos-arm64" optional="true"/>
<element name="windows" optional="true"/>
<element name="windows-x86" optional="true"/>
<element name="windows-arm64" optional="true"/>
<sequential>
<local name="module.name"/>
<property name="module.name" value="@{name}"/>
<local name="module"/>
<condition property="module" value="lwjgl" else="lwjgl-@{name}">
<equals arg1="@{name}" arg2="core"/>
</condition>
<local name="module.path"/>
<property name="module.path" value="${module.@{name}.path}"/>
<quiet>
<mkdir dir="${release}/${module}"/>
</quiet>
<release-natives name="@{name}" title="@{title}" native-library="@{native-library}" unless:set="java-only.binding.@{name}">
<content><natives/></content>
<linux-content><linux/></linux-content>
<linux-arm64-content><linux-arm64/></linux-arm64-content>
<linux-arm32-content><linux-arm32/></linux-arm32-content>
<macos-content><macos/></macos-content>
<macos-arm64-content><macos-arm64/></macos-arm64-content>
<windows-content><windows/></windows-content>
<windows-x86-content><windows-x86/></windows-x86-content>
<windows-arm64-content><windows-arm64/></windows-arm64-content>
</release-natives>
<lwjgl-jar destfile="${release}/${module}/${module}.jar" title="@{title}">
<fileset dir="${release}/${module}" includes="META-INF/**/*.sha1" unless:set="java-only.binding.@{name}"/>
<fileset dir="${bin.lwjgl}/@{name}" includes="**"/>
</lwjgl-jar>
<quiet>
<delete dir="${release}/${module}/native" unless:set="java-only.binding.@{name}"/>
<delete dir="${release}/${module}/META-INF" unless:set="java-only.binding.@{name}"/>
</quiet>
<local name="hasMain"/>
<available file="${module.lwjgl}/@{name}/src/main/java" type="dir" property="hasMain"/>
<local name="hasMain.javadoc"/>
<available file="${module.lwjgl}/@{name}/src/main/java/org/lwjgl" type="dir" property="hasMain"/>
<mkdir dir="${release}/${module}/javadoc" unless:set="javadoc.skip"/>
<javadoc
destdir="${release}/${module}/javadoc"
source="9"
windowtitle="LWJGL ${build.version} - @{title}"
encoding="UTF-8"
docencoding="UTF-8"
charset="UTF-8"
useexternalfile="true"
nohelp="true"
notree="true"
public="true"
failonerror="true"
unless:set="javadoc.skip"
>
<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/org/lwjgl" includes="**" if:set="hasMain.javadoc"/>
<fileset dir="${module.lwjgl}/@{name}/src/generated/java" includes="**"/>
<arg value="-XDignore.symbol.file"/>
<arg line="-Xdoclint:html,reference,syntax"/>
<arg line="-Xmaxerrs 1000 -Xmaxwarns 1000"/>
<arg line="-notimestamp"/>
<arg value="-html5" if:set="jdk9"/>
<arg line="-J-Dfile.encoding=UTF8 -J-Dline.separator= "/>
<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" unless:set="javadoc.skip"/>
<java classname="org.lwjgl.system.JavadocPostProcess" failonerror="true" unless:set="javadoc.skip">
<classpath path="${bin.generator}"/>
<arg value="${release}/${module}/javadoc"/>
</java>
<zip destfile="${release}/${module}/${module}-javadoc.jar" basedir="${release}/${module}/javadoc" includes="**" level="9" unless:set="javadoc.skip"/>
<delete dir="${release}/${module}/javadoc" unless:set="javadoc.skip"/>
<quiet>
<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"
/>
</quiet>
<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>
<quiet>
<delete dir="${module.lwjgl}/@{name}/src/generated/java/META-INF" quiet="true"/>
</quiet>
<quiet>
<copy todir="${release}/${module}">
<fileset dir="${module.lwjgl}/@{name}" includes="*_license.txt"/>
</copy>
</quiet>
</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 16 or higher. Continue with current JDK?"
validargs="y,n"
defaultvalue="n"
addproperty="input"
unless:set="jdk16"
/>
<fail message="Cancelled" unless:set="jdk16">
<condition>
<equals arg1="n" arg2="${input}"/>
</condition>
</fail>
</target>
<target name="release" depends="-check-release-jdk,compile,-compile-generator,-build-version">
<local name="revision"/>
<condition property="revision" value="build ${build.revision}" else="SNAPSHOT">
<isset property="build.revision"/>
</condition>
<property name="module.version" value="${build.version}+${build.revision}" if:true="${build.release}"/>
<condition property="module.version" value="${build.version.plain}-snapshot+${build.revision}" else="${build.version.plain}-snapshot" unless:true="${build.release}">
<isset property="build.revision"/>
</condition>
<delete dir="${release}"/>
<mkdir dir="${release}"/>
<quiet>
<copy file="LICENSE.md" tofile="${release}/LICENSE"/>
</quiet>
<echo file="${release}/build.txt" if:set="build.revision">LWJGL ${build.version} ${revision}</echo>
<echo file="${release}/build.txt" unless:set="build.revision">LWJGL ${build.version}</echo>
<java
classpath="bin/classes/generator"
classname="org.lwjgl.generator.util.ModuleInfoGen"
fork="true"
failonerror="true"
taskname="module-info-gen :: java"
if:set="jdk9"
>
<jvmarg value="-Dmodule.name.list=${module.list}"/>
<jvmarg value="-Dmodule.version=${module.version}"/>
</java>
<parallel threadcount="4" failonany="true">
<sequential>
<quiet>
<copy todir="${module.lwjgl}/core/src/generated/java/META-INF/versions/9" if:set="jdk9">
<fileset dir="${module.lwjgl}/core/src/main/java9" includes="**"/>
</copy>
<copy todir="${module.lwjgl}/core/src/generated/java/META-INF/versions/10" if:set="jdk10">
<fileset dir="${module.lwjgl}/core/src/main/java10" includes="**"/>
</copy>
<copy todir="${module.lwjgl}/core/src/generated/java/META-INF/versions/16" if:set="jdk16">
<fileset dir="${module.lwjgl}/core/src/main/java16" includes="**"/>
</copy>
<copy todir="${bin.lwjgl}/core/META-INF/native-image/org.lwjgl/lwjgl">
<fileset dir="config/native-image/META-INF/native-image" includes="**" excludes="resource-config.json"/>
</copy>
</quiet>
<release-module name="core" native-library="lwjgl" title="Core"/>
<delete dir="${bin.lwjgl}/core/META-INF/native-image" quiet="true"/>
</sequential>
<release-module name="assimp" title="assimp" if:true="${binding.assimp}">
<natives>
<get-release platform="linux" arch="x64" file="libassimp.so"/>
<get-release platform="linux" arch="x64" file="libassimp.so.git"/>
<get-release platform="linux" arch="x64" file="libdraco.so"/>
<get-release platform="linux" arch="arm64" file="libassimp.so"/>
<get-release platform="linux" arch="arm64" file="libassimp.so.git"/>
<get-release platform="linux" arch="arm64" file="libdraco.so"/>
<get-release platform="linux" arch="arm32" file="libassimp.so"/>
<get-release platform="linux" arch="arm32" file="libassimp.so.git"/>
<get-release platform="linux" arch="arm32" file="libdraco.so"/>
<get-release platform="macos" arch="x64" file="libassimp.dylib"/>
<get-release platform="macos" arch="x64" file="libassimp.dylib.git"/>
<get-release platform="macos" arch="x64" file="libdraco.dylib"/>
<get-release platform="macos" arch="arm64" file="libassimp.dylib"/>
<get-release platform="macos" arch="arm64" file="libassimp.dylib.git"/>
<get-release platform="macos" arch="arm64" file="libdraco.dylib"/>
<get-release platform="windows" arch="x64" file="assimp.dll"/>
<get-release platform="windows" arch="x64" file="assimp.dll.git"/>
<get-release platform="windows" arch="x64" file="draco.dll"/>
<get-release platform="windows" arch="x86" file="assimp.dll"/>
<get-release platform="windows" arch="x86" file="assimp.dll.git"/>
<get-release platform="windows" arch="x86" file="draco.dll"/>
<get-release platform="windows" arch="arm64" file="assimp.dll"/>
<get-release platform="windows" arch="arm64" file="assimp.dll.git"/>
<get-release platform="windows" arch="arm64" file="draco.dll"/>
</natives>
</release-module>
<release-module name="bgfx" title="bgfx" if:true="${binding.bgfx}">
<natives>
<get-release platform="linux" arch="x64" file="libbgfx.so"/>
<get-release platform="linux" arch="x64" file="libbgfx.so.git"/>
<get-release platform="linux" arch="arm64" file="libbgfx.so"/>
<get-release platform="linux" arch="arm64" file="libbgfx.so.git"/>
<get-release platform="linux" arch="arm32" file="libbgfx.so"/>
<get-release platform="linux" arch="arm32" file="libbgfx.so.git"/>
<get-release platform="macos" arch="x64" file="libbgfx.dylib"/>
<get-release platform="macos" arch="x64" file="libbgfx.dylib.git"/>
<get-release platform="macos" arch="arm64" file="libbgfx.dylib"/>
<get-release platform="macos" arch="arm64" file="libbgfx.dylib.git"/>
<get-release platform="windows" arch="x64" file="bgfx.dll"/>
<get-release platform="windows" arch="x64" file="bgfx.dll.git"/>
<get-release platform="windows" arch="x86" file="bgfx.dll"/>
<get-release platform="windows" arch="x86" file="bgfx.dll.git"/>
</natives>
</release-module>
<release-module name="cuda" title="CUDA" if:true="${binding.cuda}"/>
<release-module name="egl" title="EGL" if:true="${binding.egl}"/>
<release-module name="fmod" title="FMOD" if:true="${binding.fmod}"/>
<release-module name="freetype" native-library="freetype" title="FreeType" if:true="${binding.freetype}"/>
<release-module name="glfw" title="GLFW" if:true="${binding.glfw}">
<natives>
<get-release platform="linux" arch="x64" file="libglfw.so"/>
<get-release platform="linux" arch="x64" file="libglfw.so.git"/>
<get-release platform="linux" arch="arm64" file="libglfw.so"/>
<get-release platform="linux" arch="arm64" file="libglfw.so.git"/>
<get-release platform="linux" arch="arm32" file="libglfw.so"/>
<get-release platform="linux" arch="arm32" file="libglfw.so.git"/>
<get-release platform="macos" arch="x64" file="libglfw.dylib"/>
<get-release platform="macos" arch="x64" file="libglfw.dylib.git"/>
<get-release platform="macos" arch="x64" file="libglfw_async.dylib"/>
<get-release platform="macos" arch="x64" file="libglfw_async.dylib.git"/>
<get-release platform="macos" arch="arm64" file="libglfw.dylib"/>
<get-release platform="macos" arch="arm64" file="libglfw.dylib.git"/>
<get-release platform="macos" arch="arm64" file="libglfw_async.dylib"/>
<get-release platform="macos" arch="arm64" file="libglfw_async.dylib.git"/>
<get-release platform="windows" arch="x64" file="glfw.dll"/>
<get-release platform="windows" arch="x64" file="glfw.dll.git"/>
<get-release platform="windows" arch="x86" file="glfw.dll"/>
<get-release platform="windows" arch="x86" file="glfw.dll.git"/>
<get-release platform="windows" arch="arm64" file="glfw.dll"/>
<get-release platform="windows" arch="arm64" file="glfw.dll.git"/>
</natives>
</release-module>
<release-module name="harfbuzz" native-library="harfbuzz" title="HarfBuzz" if:true="${binding.harfbuzz}"/>
<release-module name="hwloc" native-library="hwloc" title="hwloc" if:true="${binding.hwloc}"/>
<release-module name="jawt" title="JAWT" if:true="${binding.jawt}"/>
<release-module name="jemalloc" native-library="jemalloc" title="jemalloc" if:true="${binding.jemalloc}"/>
<release-module name="libdivide" native-library="lwjgl_libdivide" title="libdivide" if:true="${binding.libdivide}"/>
<release-module name="llvm" native-library="lwjgl_llvm" title="LLVM/Clang" if:true="${binding.llvm}"/>
<release-module name="lmdb" native-library="lwjgl_lmdb" title="LMDB" if:true="${binding.lmdb}"/>
<release-module name="lwjglx" title="LWJGLX" if:true="${binding.lwjglx}"/>
<release-module name="lz4" native-library="lwjgl_lz4" title="lz4" if:true="${binding.lz4}"/>
<release-module name="meow" title="Meow hash" if:true="${binding.meow}">
<natives>
<get-release platform="linux" arch="x64" file="liblwjgl_meow.so"/>
<get-release platform="linux" arch="arm64" file="liblwjgl_meow.so"/>
<get-release platform="macos" arch="x64" file="liblwjgl_meow.dylib"/>
<get-release platform="macos" arch="arm64" file="liblwjgl_meow.dylib"/>
<get-release platform="windows" arch="x64" file="lwjgl_meow.dll"/>
<get-release platform="windows" arch="x86" file="lwjgl_meow.dll"/>
<get-release platform="windows" arch="arm64" file="lwjgl_meow.dll"/>
</natives>
</release-module>
<release-module name="meshoptimizer" native-library="lwjgl_meshoptimizer" title="meshoptimizer" if:true="${binding.meshoptimizer}"/>
<release-module name="nanovg" native-library="lwjgl_nanovg" title="NanoVG" if:true="${binding.nanovg}"/>
<release-module name="nfd" native-library="lwjgl_nfd" title="Native File Dialog" if:true="${binding.nfd}">
<natives>
<get-release platform="linux" arch="x64" file="liblwjgl_nfd_portal.so"/>
<get-release platform="linux" arch="arm64" file="liblwjgl_nfd_portal.so"/>
<get-release platform="linux" arch="arm32" file="liblwjgl_nfd_portal.so"/>
</natives>
</release-module>
<release-module name="nuklear" native-library="lwjgl_nuklear" title="Nuklear" if:true="${binding.nuklear}"/>
<release-module name="odbc" title="ODBC" if:true="${binding.odbc}"/>
<release-module name="openal" title="OpenAL" if:true="${binding.openal}">
<natives>
<get-release platform="linux" arch="x64" file="libopenal.so"/>
<get-release platform="linux" arch="x64" file="libopenal.so.git"/>
<get-release platform="linux" arch="arm64" file="libopenal.so"/>
<get-release platform="linux" arch="arm64" file="libopenal.so.git"/>
<get-release platform="linux" arch="arm32" file="libopenal.so"/>
<get-release platform="linux" arch="arm32" file="libopenal.so.git"/>
<get-release platform="macos" arch="x64" file="libopenal.dylib"/>
<get-release platform="macos" arch="x64" file="libopenal.dylib.git"/>
<get-release platform="macos" arch="arm64" file="libopenal.dylib"/>
<get-release platform="macos" arch="arm64" file="libopenal.dylib.git"/>
<get-release platform="windows" arch="x64" file="OpenAL.dll"/>
<get-release platform="windows" arch="x64" file="OpenAL.dll.git"/>
<get-release platform="windows" arch="x86" file="OpenAL.dll"/>
<get-release platform="windows" arch="x86" file="OpenAL.dll.git"/>
<get-release platform="windows" arch="arm64" file="OpenAL.dll"/>
<get-release platform="windows" arch="arm64" file="OpenAL.dll.git"/>
</natives>
</release-module>
<release-module name="opencl" title="OpenCL" if:true="${binding.opencl}"/>
<release-module name="opengl" native-library="lwjgl_opengl" title="OpenGL" if:true="${binding.opengl}"/>
<release-module name="opengles" native-library="lwjgl_opengles" title="OpenGL ES" if:true="${binding.opengles}"/>
<release-module name="openvr" title="OpenVR" if:true="${binding.openvr}">
<natives>
<get-release platform="linux" arch="x64" file="liblwjgl_openvr.so"/>
<get-release platform="linux" arch="x64" file="libopenvr_api.so"/>
<get-release platform="linux" arch="x64" file="libopenvr_api.so.git"/>
<get-release platform="macos" arch="x64" file="liblwjgl_openvr.dylib"/>
<get-release platform="macos" arch="x64" file="libopenvr_api.dylib"/>
<get-release platform="macos" arch="x64" file="libopenvr_api.dylib.git"/>
<get-release platform="windows" arch="x64" file="lwjgl_openvr.dll"/>
<get-release platform="windows" arch="x64" file="openvr_api.dll"/>
<get-release platform="windows" arch="x64" file="openvr_api.dll.git"/>
<get-release platform="windows" arch="x86" file="lwjgl_openvr.dll"/>
<get-release platform="windows" arch="x86" file="openvr_api.dll"/>
<get-release platform="windows" arch="x86" file="openvr_api.dll.git"/>
</natives>
</release-module>
<release-module name="openxr" title="OpenXR" if:true="${binding.openxr}">
<natives>
<get-release platform="linux" arch="x64" file="libopenxr_loader.so"/>
<get-release platform="linux" arch="x64" file="libopenxr_loader.so.git"/>
<get-release platform="linux" arch="arm64" file="libopenxr_loader.so"/>
<get-release platform="linux" arch="arm64" file="libopenxr_loader.so.git"/>
<get-release platform="linux" arch="arm32" file="libopenxr_loader.so"/>
<get-release platform="linux" arch="arm32" file="libopenxr_loader.so.git"/>
<get-release platform="windows" arch="x64" file="openxr-loader.dll"/>
<get-release platform="windows" arch="x64" file="openxr-loader.dll.git"/>
<get-release platform="windows" arch="x86" file="openxr-loader.dll"/>
<get-release platform="windows" arch="x86" file="openxr-loader.dll.git"/>
<get-release platform="windows" arch="arm64" file="openxr-loader.dll"/>
<get-release platform="windows" arch="arm64" file="openxr-loader.dll.git"/>
</natives>
</release-module>
<release-module name="opus" native-library="opus" title="Opus" if:true="${binding.opus}"/>
<release-module name="ovr" title="LibOVR" if:true="${binding.ovr}">
<natives>
<get-release platform="windows" arch="x64" file="lwjgl_ovr.dll"/>
<get-release platform="windows" arch="x86" file="lwjgl_ovr.dll"/>
</natives>
</release-module>
<release-module name="par" native-library="lwjgl_par" title="par" if:true="${binding.par}"/>
<release-module name="remotery" title="remotery" if:true="${binding.remotery}">
<natives>
<get-release platform="linux" arch="x64" file="liblwjgl_remotery.so"/>
<get-release platform="linux" arch="arm64" file="liblwjgl_remotery.so"/>
<get-release platform="linux" arch="arm32" file="liblwjgl_remotery.so"/>
<get-release platform="macos" arch="x64" file="liblwjgl_remotery.dylib"/>
<get-release platform="macos" arch="arm64" file="liblwjgl_remotery.dylib"/>
<get-release platform="windows" arch="x64" file="lwjgl_remotery.dll"/>
<get-release platform="windows" arch="x86" file="lwjgl_remotery.dll"/>
</natives>
</release-module>
<release-module name="rpmalloc" native-library="lwjgl_rpmalloc" title="rpmalloc" if:true="${binding.rpmalloc}"/>
<release-module name="shaderc" native-library="shaderc" title="Shaderc" if:true="${binding.shaderc}"/>
<release-module name="spvc" native-library="spirv-cross" title="SPIRV-Cross" if:true="${binding.spvc}"/>
<release-module name="sse" title="SSE" if:true="${binding.sse}">
<natives>
<get-release platform="linux" arch="x64" file="liblwjgl_sse.so"/>
<get-release platform="macos" arch="x64" file="liblwjgl_sse.dylib"/>
<get-release platform="windows" arch="x64" file="lwjgl_sse.dll"/>
<get-release platform="windows" arch="x86" file="lwjgl_sse.dll"/>
</natives>
</release-module>
<release-module name="stb" native-library="lwjgl_stb" title="stb" if:true="${binding.stb}"/>
<release-module name="tinyexr" native-library="lwjgl_tinyexr" title="Tiny OpenEXR" if:true="${binding.tinyexr}"/>
<release-module name="tinyfd" native-library="lwjgl_tinyfd" title="tiny file dialogs" if:true="${binding.tinyfd}"/>
<release-module name="tootle" title="tootle" if:true="${binding.tootle}">
<natives>
<get-release platform="linux" arch="x64" file="liblwjgl_tootle.so"/>
<get-release platform="macos" arch="x64" file="liblwjgl_tootle.dylib"/>
<get-release platform="windows" arch="x64" file="lwjgl_tootle.dll"/>
<get-release platform="windows" arch="x86" file="lwjgl_tootle.dll"/>
</natives>
</release-module>
<release-module name="vma" native-library="lwjgl_vma" title="vma" if:true="${binding.vma}"/>
<release-module name="vulkan" title="Vulkan" if:true="${binding.vulkan}">
<natives>
<get-release platform="macos" arch="x64" file="libMoltenVK.dylib"/>
<get-release platform="macos" arch="x64" file="libMoltenVK.dylib.git"/>
<get-release platform="macos" arch="arm64" file="libMoltenVK.dylib"/>
<get-release platform="macos" arch="arm64" file="libMoltenVK.dylib.git"/>
</natives>
</release-module>
<release-module name="xxhash" native-library="lwjgl_xxhash" title="xxHash" if:true="${binding.xxhash}"/>
<release-module name="yoga" native-library="lwjgl_yoga" title="yoga" if:true="${binding.yoga}"/>
<release-module name="zstd" native-library="lwjgl_zstd" title="zstd" if:true="${binding.zstd}"/>
</parallel>
</target>
</project>