Added the opengl-template-pattern ant property to control the set of included opengl extensions

This commit is contained in:
Elias Naur 2005-09-29 18:12:20 +00:00
parent df2bc7d7e0
commit 4636c4b251
3 changed files with 14 additions and 34 deletions

View File

@ -15,6 +15,7 @@
<property name="lwjgl.res" value="./res" />
<property name="lwjgl.version" value="0.98" />
<property name="opengl-template-pattern" value="org/lwjgl/opengl/GL*.java,org/lwjgl/opengl/ARB*.java,org/lwjgl/opengl/ATI*.java,org/lwjgl/opengl/EXT*.java,org/lwjgl/opengl/NV*.java,org/lwjgl/opengl/HP*.java,org/lwjgl/opengl/IBM*.java,org/lwjgl/opengl/SUN*.java"/>
<!-- ================================================================== -->
<!-- Filesets used for targets -->
<!-- ================================================================== -->
@ -442,7 +443,7 @@
</apply>
</target>
<target name="-generate-opengl-from-template" depends="generators" description="Generates java and native source for a GL function set">
<target name="generate-opengl" depends="generators" description="Generates java and native source for GL">
<!-- there's no apt task in ant yet, so we'll just invoke it manually for now -->
<apply executable="apt" parallel="true">
<arg value="-nocompile"/>
@ -456,37 +457,10 @@
<arg path="${lwjgl.src.native}/generated"/>
<arg value="-Acontextspecific"/>
<arg value="-Atypemap=org.lwjgl.util.generator.GLTypeMap"/>
<fileset dir="${lwjgl.src.templates}" includes="${template-pattern}"/>
<fileset dir="${lwjgl.src.templates}" includes="${opengl-template-pattern}"/>
</apply>
</target>
<target name="generate-opengl" depends="generators" description="Generates java and native source for GL">
<antcall target="-generate-opengl-from-template">
<param name="template-pattern" value="org/lwjgl/opengl/GL*.java"/>
</antcall>
<antcall target="-generate-opengl-from-template">
<param name="template-pattern" value="org/lwjgl/opengl/ARB*.java"/>
</antcall>
<antcall target="-generate-opengl-from-template">
<param name="template-pattern" value="org/lwjgl/opengl/ATI*.java"/>
</antcall>
<antcall target="-generate-opengl-from-template">
<param name="template-pattern" value="org/lwjgl/opengl/EXT*.java"/>
</antcall>
<antcall target="-generate-opengl-from-template">
<param name="template-pattern" value="org/lwjgl/opengl/NV*.java"/>
</antcall>
<antcall target="-generate-opengl-from-template">
<param name="template-pattern" value="org/lwjgl/opengl/HP*.java"/>
</antcall>
<antcall target="-generate-opengl-from-template">
<param name="template-pattern" value="org/lwjgl/opengl/IBM*.java"/>
</antcall>
<antcall target="-generate-opengl-from-template">
<param name="template-pattern" value="org/lwjgl/opengl/SUN*.java"/>
</antcall>
</target>
<target name="generate-opengl-references" depends="generators" description="Generates java and native source for GL">
<!-- Generate context capabilities -->
<apply executable="apt" parallel="true">
@ -497,7 +471,7 @@
<arg path="${lwjgl.src}/java:${lwjgl.src.templates}:${lwjgl.bin}:${java.class.path}"/>
<arg value="-s"/>
<arg path="${lwjgl.src}/generated"/>
<fileset dir="${lwjgl.src.templates}" includes="org/lwjgl/opengl/*.java"/>
<fileset dir="${lwjgl.src.templates}" includes="${opengl-template-pattern}"/>
</apply>
</target>
@ -512,7 +486,7 @@
<arg value="-s"/>
<arg path="${lwjgl.src}/generated"/>
<arg value="-Acontextspecific"/>
<fileset dir="${lwjgl.src.templates}" includes="org/lwjgl/opengl/*.java"/>
<fileset dir="${lwjgl.src.templates}" includes="${opengl-template-pattern}"/>
</apply>
</target>

View File

@ -33,8 +33,15 @@ files are still in CVS and the generator is not invoked in a default build.
How to use it
-------------
The generator is invoked from ant with 'ant generate-openal', 'ant
generate-opengl' or simply 'ant generate-all'.
The generator is invoked from ant with 'ant generate-all'.
If you want to do a stripped version of LWJGL including only a select subset
of extensions and core function sets, use the "opengl-template-pattern"
ant property. For example, this will only create source files for the core
OpenGL functions:
ant -Dopengl-template-pattern="org/lwjgl/opengl/GL*.java" clean-generated
generate-all
How it works
------------

View File

@ -164,7 +164,6 @@ public class GeneratorVisitor extends SimpleDeclarationVisitor {
private void generateJavaSource(InterfaceDeclaration d) throws IOException {
validateMethods(d);
// PrintWriter java_writer = env.getFiler().createSourceFile(Utils.getQualifiedClassName(d));
PrintWriter java_writer = env.getFiler().createTextFile(Filer.Location.SOURCE_TREE, d.getPackage().getQualifiedName(), new File(Utils.getSimpleClassName(d) + ".java"), null);
java_writer.println("/* MACHINE GENERATED FILE, DO NOT EDIT */");
java_writer.println();