diff options
author | Kenneth Russel <[email protected]> | 2008-06-30 20:12:47 +0000 |
---|---|---|
committer | Kenneth Russel <[email protected]> | 2008-06-30 20:12:47 +0000 |
commit | 252efbfd61fb62883df028cba5743e458a5b18c7 (patch) | |
tree | a5f5d87bca24309a4c6c5ac48497a30a70cd442c /make/build.xml | |
parent | 7be2d71e458dd37789ceac43dede4b308eff45c2 (diff) |
Refactored more C compiler setup into gluegen-cpptasks.xml to make it
easier to build native sources via Ant. Provided new
gluegen.cpptasks.setup.compiler target which sets up
platform-independent compiler and linker IDs and other properties
which can be used in other projects' build files. Refactored JOGL
build to use some of these new properties and eliminate duplication;
more code savings possible. Added new GLWindow class to Newt
implementing GLAutoDrawable to increase code sharing, and supporting
making OpenGL calls inside of EventListener callbacks. Moved repaint()
method from GLAutoDrawable to AWTGLAutoDrawable. Added WindowEvent and
WindowListener interfaces to Newt, currently implemented on Windows
and AWT backends (X11 backend would need to support and watch for
window resizes -- FIXME added). Refactored common functionality into
Newt Event class. Renumbered event IDs to avoid collisions. Fixed
potential problems with removing event listeners inside of
EventListener callbacks.
git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/svn-server-sync/jogl/branches/JOGL_2_SANDBOX@1702 232f8b59-042b-4e1e-8c03-345bb8c30851
Diffstat (limited to 'make/build.xml')
-rw-r--r-- | make/build.xml | 199 |
1 files changed, 51 insertions, 148 deletions
diff --git a/make/build.xml b/make/build.xml index b35641e43..5dce7d8ae 100644 --- a/make/build.xml +++ b/make/build.xml @@ -322,22 +322,9 @@ <!-- ================================================================== --> <!-- - - Set up java.home.dir appropriately on all platforms. - --> - <target name="setup.java.home.dir.nonmacosx" depends="load.user.properties" unless="isOSX"> - <!-- java home dir is up one directory as java.home points to '<java-install-dir>/jre' --> - <property name="java.home.dir" value="${java.home}/.." /> - </target> - <target name="setup.java.home.dir.macosx" depends="load.user.properties" if="isOSX"> - <property name="java.home.dir" value="/System/Library/Frameworks/JavaVM.framework/Home" /> - </target> - <target name="setup.java.home.dir" depends="setup.java.home.dir.nonmacosx,setup.java.home.dir.macosx"/> - - <!-- ================================================================== --> - <!-- - Declare all paths and user defined variables. --> - <target name="declare.common" description="Declare properties" depends="setup.java.home.dir, gluegen.cpptasks.detect.compiler"> + <target name="declare.common" description="Declare properties" depends="load.user.properties"> <!-- The location and name of the configuration ANT file that will - validate to ensure that all user-define variables are set. --> <property name="validate.user.properties" value="${make}/validate-properties.xml" /> @@ -427,35 +414,6 @@ <include name="cg-common-CustomJavaCode.java" /> </fileset> - <property name="java.includes.dir" value="${java.home.dir}/include" /> <!-- NOTE: this MUST be relative for FileSet --> - <property name="java.includes.dir.win32" value="${java.includes.dir}/win32" /> - <property name="java.includes.dir.linux" value="${java.includes.dir}/linux" /> - <property name="java.includes.dir.solaris" value="${java.includes.dir}/solaris" /> - <property name="java.includes.dir.macosx" value="/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Headers" /> - <property name="java.includes.dir.freebsd" value="${java.includes.dir}/freebsd" /> - <property name="java.includes.dir.hpux" value="${java.includes.dir}/hp-ux" /> - <property name="java.lib.dir.win32" value="${java.home.dir}/lib" /> - <property name="java.lib.dir.linux" value="${java.home.dir}/jre/lib/i386" /> - <property name="java.lib.dir.linux.amd64" value="${java.home.dir}/jre/lib/amd64" /> - <property name="java.lib.dir.linux.ia64" value="${java.home.dir}/jre/lib/ia64" /> - <property name="java.lib.dir.hpux" value="${java.home.dir}/jre/lib/PA_RISC2.0" /> - <condition property="cpu" value="sparc"> - <os name="SunOS" arch="sparc" /> - </condition> - <condition property="cpu" value="sparcv9"> - <os name="SunOS" arch="sparcv9" /> - </condition> - <condition property="cpu" value="i386"> - <os name="SunOS" arch="x86" /> - </condition> - - <condition property="cpu" value="amd64"> - <os name="SunOS" arch="amd64" /> - </condition> - - <property name="java.lib.dir.solaris" value="${java.home.dir}/jre/lib/${cpu}" /> - <property name="java.lib.dir.macosx" value="/System/Library/Frameworks/JavaVM.framework/Libraries" /> - <!-- Create the classpath that includes GlueGen and - ANTLR. This requires the user-defined "antlr.jar" - property. --> @@ -531,34 +489,10 @@ <!-- - Platform specific declares - COMPILER --> - <target name="declare.win32.vc6" if="isVC6"> - <echo message="Win32.VC6" /> - <property name="compiler.cfg.id" value="compiler.cfg.win32.msvc" /> - <property name="linker.cfg.id.base" value="linker.cfg.win32.msvc" /> - <property name="linker.cfg.id.oswin" value="linker.cfg.win32.msvc.jogl" /> - <property name="linker.cfg.id.gl2" value="linker.cfg.win32.msvc.jogl" /> - </target> - - <target name="declare.win32.vc7" if="isVC7"> - <echo message="Win32.VC7" /> - <property name="compiler.cfg.id" value="compiler.cfg.win32.msvc" /> - <property name="linker.cfg.id.base" value="linker.cfg.win32.msvc" /> - <property name="linker.cfg.id.oswin" value="linker.cfg.win32.msvc.jogl" /> - <property name="linker.cfg.id.gl2" value="linker.cfg.win32.msvc.jogl" /> - </target> - - <target name="declare.win32.vc8" if="isVC8"> - <echo message="Win32.VC8" /> - <property name="compiler.cfg.id" value="compiler.cfg.win32.msvc" /> - <property name="linker.cfg.id.base" value="linker.cfg.win32.msvc" /> - <property name="linker.cfg.id.oswin" value="linker.cfg.win32.msvc.jogl" /> - <property name="linker.cfg.id.gl2" value="linker.cfg.win32.msvc.jogl" /> - </target> - - <target name="declare.win32.vc8_x64" if="isVC8_X64"> - <echo message="Win32.VC8_X64" /> + <target name="declare.win32.vc" if="isVCFamily"> + <echo message="Win32.VC" /> <property name="compiler.cfg.id" value="compiler.cfg.win32.msvc" /> - <property name="linker.cfg.id.base" value="linker.cfg.win32.msvc" /> + <property name="linker.cfg.id.core" value="linker.cfg.win32.msvc" /> <property name="linker.cfg.id.oswin" value="linker.cfg.win32.msvc.jogl" /> <property name="linker.cfg.id.gl2" value="linker.cfg.win32.msvc.jogl" /> </target> @@ -566,40 +500,31 @@ <target name="declare.win32.mingw" if="isMingW"> <echo message="Win32.MingW" /> <property name="compiler.cfg.id" value="compiler.cfg.win32.mingw" /> - <property name="linker.cfg.id.base" value="linker.cfg.win32.mingw" /> + <property name="linker.cfg.id.core" value="linker.cfg.win32.mingw" /> <property name="linker.cfg.id.oswin" value="linker.cfg.win32.mingw.jogl" /> <property name="linker.cfg.id.gl2" value="linker.cfg.win32.mingw.jogl" /> </target> <target name="declare.linux.x86" if="isLinuxX86"> <echo message="Linux.x86" /> - <property name="java.includes.dir.platform" value="${java.includes.dir.linux}" /> - <property name="java.lib.dir.platform" value="${java.lib.dir.linux}" /> - <property name="compiler.cfg.id" value="compiler.cfg.linux" /> - <property name="linker.cfg.id.base" value="linker.cfg.linux" /> + <property name="linker.cfg.id.core" value="linker.cfg.linux" /> <property name="linker.cfg.id.oswin" value="linker.cfg.linux.jogl.x11" /> <property name="linker.cfg.id.gl2" value="linker.cfg.linux.jogl.gl2" /> </target> <target name="declare.linux.amd64" if="isLinuxAMD64"> <echo message="Linux.AMD64" /> - <property name="java.includes.dir.platform" value="${java.includes.dir.linux}" /> - <property name="java.lib.dir.platform" value="${java.lib.dir.linux.amd64}" /> - <property name="compiler.cfg.id" value="compiler.cfg.linux.amd64" /> - <property name="linker.cfg.id.base" value="linker.cfg.linux.amd64" /> + <property name="linker.cfg.id.core" value="linker.cfg.linux.amd64" /> <property name="linker.cfg.id.oswin" value="linker.cfg.linux.amd64.jogl.x11" /> <property name="linker.cfg.id.gl2" value="linker.cfg.linux.amd64.jogl.gl2" /> </target> <target name="declare.linux.ia64" if="isLinuxIA64"> <echo message="Linux.IA64" /> - <property name="java.includes.dir.platform" value="${java.includes.dir.linux}" /> - <property name="java.lib.dir.platform" value="${java.lib.dir.linux.ia64}" /> - <property name="compiler.cfg.id" value="compiler.cfg.linux" /> - <property name="linker.cfg.id.base" value="linker.cfg.linux" /> + <property name="linker.cfg.id.core" value="linker.cfg.linux" /> <property name="linker.cfg.id.oswin" value="linker.cfg.linux.jogl.x11" /> <property name="linker.cfg.id.gl2" value="linker.cfg.linux.jogl.gl2" /> </target> @@ -608,11 +533,8 @@ <target name="declare.solaris32" depends="declare.x11" if="isSolaris32Bit"> <echo message="Solaris" /> - <property name="java.includes.dir.platform" value="${java.includes.dir.solaris}" /> - <property name="java.lib.dir.platform" value="${java.lib.dir.solaris}" /> - <property name="compiler.cfg.id" value="compiler.cfg.solaris" /> - <property name="linker.cfg.id.base" value="linker.cfg.solaris" /> + <property name="linker.cfg.id.core" value="linker.cfg.solaris" /> <property name="linker.cfg.id.oswin" value="linker.cfg.solaris.jogl.x11" /> <property name="linker.cfg.id.gl2" value="linker.cfg.solaris.jogl.gl2" /> </target> @@ -620,11 +542,8 @@ <target name="declare.solaris.sparcv9" depends="declare.x11" if="isSolarisSparcv9"> <echo message="SolarisSparcv9" /> - <property name="java.includes.dir.platform" value="${java.includes.dir.solaris}" /> - <property name="java.lib.dir.platform" value="${java.lib.dir.solaris}" /> - <property name="compiler.cfg.id" value="compiler.cfg.solaris.sparcv9" /> - <property name="linker.cfg.id.base" value="linker.cfg.solaris.sparcv9" /> + <property name="linker.cfg.id.core" value="linker.cfg.solaris.sparcv9" /> <property name="linker.cfg.id.oswin" value="linker.cfg.solaris.sparcv9.jogl.x11" /> <property name="linker.cfg.id.gl2" value="linker.cfg.solaris.sparcv9.jogl.gl2" /> </target> @@ -632,50 +551,35 @@ <target name="declare.solaris.amd64" depends="declare.x11" if="isSolarisAMD64"> <echo message="SolarisAMD64" /> - <property name="java.includes.dir.platform" value="${java.includes.dir.solaris}" /> - <property name="java.lib.dir.platform" value="${java.lib.dir.solaris}" /> - <property name="compiler.cfg.id" value="compiler.cfg.solaris.amd64" /> - <property name="linker.cfg.id.base" value="linker.cfg.solaris.amd64" /> + <property name="linker.cfg.id.core" value="linker.cfg.solaris.amd64" /> <property name="linker.cfg.id.oswin" value="linker.cfg.solaris.amd64.jogl.x11" /> <property name="linker.cfg.id.gl2" value="linker.cfg.solaris.amd64.jogl.gl2" /> </target> <target name="declare.freebsd" depends="declare.x11" if="isFreeBSD"> <echo message="FreeBSD" /> - <property name="java.includes.dir.platform" value="${java.includes.dir.freebsd}" /> - <property name="java.lib.dir.platform" value="${java.lib.dir.linux}" /> - <property name="compiler.cfg.id" value="compiler.cfg.freebsd.jogl" /> - <property name="linker.cfg.id.base" value="linker.cfg.linux" /> + <property name="linker.cfg.id.core" value="linker.cfg.linux" /> <property name="linker.cfg.id.oswin" value="linker.cfg.linux.jogl.x11" /> <property name="linker.cfg.id.gl2" value="linker.cfg.linux.jogl.gl2" /> </target> <target name="declare.hpux" depends="declare.x11" if="isHPUX"> <echo message="HP-UX" /> - <property name="java.includes.dir.platform" value="${java.includes.dir.hpux}" /> - <property name="java.lib.dir.platform" value="${java.lib.dir.hpux}" /> <property name="compiler.cfg.id" value="compiler.cfg.hpux" /> - <property name="linker.cfg.id.base" value="linker.cfg.hpux" /> + <property name="linker.cfg.id.core" value="linker.cfg.hpux" /> <property name="linker.cfg.id.oswin" value="linker.cfg.hpux.jogl.x11" /> <property name="linker.cfg.id.gl2" value="linker.cfg.hpux.jogl.gl2" /> </target> - <target name="declare.win32" depends="declare.win32.vc6,declare.win32.vc7,declare.win32.vc8,declare.win32.vc8_x64,declare.win32.mingw" if="isWindows"> - <property name="java.includes.dir.platform" value="${java.includes.dir.win32}" /> - <property name="java.lib.dir.platform" value="${java.lib.dir.win32}" /> - </target> + <target name="declare.win32" depends="declare.win32.vc,declare.win32.mingw" if="isWindows" /> - <target name="declare.x11" depends="init" if="isX11"> - </target> + <target name="declare.x11" depends="init" if="isX11" /> <target name="declare.macosx" depends="init" if="isOSX"> - <property name="java.includes.dir.platform" value="${java.includes.dir.macosx}" /> - <property name="java.lib.dir.platform" value="${java.lib.dir.macosx}" /> - <property name="compiler.cfg.id" value="compiler.cfg.macosx" /> - <property name="linker.cfg.id.base" value="linker.cfg.macosx" /> + <property name="linker.cfg.id.core" value="linker.cfg.macosx" /> <property name="linker.cfg.id.oswin" value="linker.cfg.macosx.jogl" /> <property name="linker.cfg.id.gl2" value="linker.cfg.macosx.jogl" /> </target> @@ -906,6 +810,7 @@ <target name="java.generate.window.system.es" if="window.es.cfg" unless="jogl.noes"> <echo message="Generating EGL implementation class" /> + <dirset id="stub.includes.fileset.platform" dir="." includes="${stub.includes.dir}/${window.es.system}/**" /> <gluegen src="${stub.includes.dir}/${window.es.system}/window-system.c" config="${window.es.cfg}" includeRefid="stub.includes.fileset.platform" @@ -950,12 +855,12 @@ <target name="java.generate.BufferUtil" depends="java.generate.BufferUtil.javase, java.generate.BufferUtil.javame_cdc_fp" /> <target name="java.generate.gl.platforms" > - <dirset id="stub.includes.fileset.platform" dir="." includes="${stub.includes.dir}/${window.os.system}/** ${stub.includes.dir}/${window.es.system}/** ${stub.includes.dir}/common/** ${stub.includes.dir}/opengl/**" /> + <dirset id="stub.includes.fileset.platform" dir="." includes="${stub.includes.dir}/${window.os.system}/** ${stub.includes.dir}/${window.es.system}/** ${stub.includes.dir}/common/** ${stub.includes.dir}/opengl/**" /> - <antcall target="java.generate.platform.glext" inheritRefs="true" /> - <antcall target="java.generate.window.lib" inheritRefs="true" /> - <antcall target="java.generate.window.system.os" inheritRefs="true" /> - <antcall target="java.generate.jawt" inheritRefs="true" /> + <antcall target="java.generate.platform.glext" inheritRefs="true" /> + <antcall target="java.generate.window.lib" inheritRefs="true" /> + <antcall target="java.generate.window.system.os" inheritRefs="true" /> + <antcall target="java.generate.jawt" inheritRefs="true" /> </target> <!-- @@ -977,7 +882,6 @@ <antcall target="java.generate.gl.all" inheritRefs="true" /> <!--antcall target="java.generate.gl.nsig" inheritRefs="true" /--> - <echo message="Generating EGL implementation class" /> <antcall target="java.generate.window.system.es" inheritRefs="true" /> <echo message="Generating platform-specifics: X11" /> @@ -1202,7 +1106,7 @@ - Compile the native C code for JOGL (and optionally the Cg binding). --> - <target name="c.configure" depends="gluegen.cpptasks.configure.compiler" unless="jogl.compiler.present"> + <target name="c.configure" depends="gluegen.cpptasks.setup.compiler" unless="jogl.compiler.present"> <!-- compiler configuration --> <!-- Note that we can use the base setups in the gluegen-cpptasks for most of these --> @@ -1283,6 +1187,14 @@ </linker> </target> + <target name="rename.mingw.dll" if="isMingW"> + <move file="${src}" tofile="${dest}" /> + </target> + + <target name="rename.dylib" if="isOSX"> + <move file="${src}" tofile="${dest}" /> + </target> + <target name="c.build" depends="c.configure"> <fail message="Requires '${c.compiler.src.files}'" unless="c.compiler.src.files"/> <fail message="Requires '${compiler.cfg.id}'" unless="compiler.cfg.id"/> @@ -1427,31 +1339,23 @@ <syslibset dir="${java.lib.dir.platform}/server" libs="jvm" if="c.compiler.needs-libjvm"/> </linker> </cc> - </target> - <target name="c.rename.jogl.libs.mingw" if="isMingW"> <!-- FIXME: this is a hack; the cpptask should have an option to change the - suffix or at least understand the override from .so to .dll --> - <move file="${obj}/libjogl_awt.so" tofile="${obj}/jogl_awt.dll" /> - <move file="${obj}/lib_newt.so" tofile="${obj}/newt.dll" /> - <move file="${obj}/libjogl_gl2.so" tofile="${obj}/jogl_gl2.dll" /> - <move file="${obj}/libjogl_es2.so" tofile="${obj}/jogl_es2.dll" /> - <move file="${obj}/libjogl_es1.so" tofile="${obj}/jogl_es1.dll" /> - <move file="${obj}/libjogl_cg.so" tofile="${obj}/jogl_cg.dll" failonerror="false" /> - </target> + suffix or at least understand the override from dylib to jnilib --> + <antcall target="rename.dylib" inheritRefs="true"> + <param name="src" value="${build}/obj/lib${output.lib.name}.dylib" /> + <param name="dest" value="${build}/obj/lib${output.lib.name}.jnilib" /> + </antcall> - <target name="c.rename.jogl.libs.macosx" if="isOSX"> <!-- FIXME: this is a hack; the cpptask should have an option to change the suffix or at least understand the override from dylib to jnilib --> - <move file="${obj}/libjogl_awt.dylib" tofile="${obj}/libjogl_awt.jnilib" /> - <move file="${obj}/libjogl_gl2.dylib" tofile="${obj}/libjogl_gl2.jnilib" /> - <move file="${obj}/libjogl_es2.dylib" tofile="${obj}/libjogl_es2.jnilib" /> - <move file="${obj}/libjogl_es1.dylib" tofile="${obj}/libjogl_es1.jnilib" /> - <move file="${obj}/libjogl_cg.dylib" tofile="${obj}/libjogl_cg.jnilib" failonerror="false" /> - <antcall target="c.fixup.jawt.version.macosx" inheritrefs="true" /> - </target> + <antcall target="rename.mingw.dll" inheritRefs="true"> + <param name="src" value="${build}/lib${output.lib.name}.so" /> + <param name="dest" value="${build}/${output.lib.name}.dll" /> + </antcall> + </target> - <target name="c.fixup.jawt.version.macosx" if="macosxfat"> + <target name="c.fixup.jawt.version.macosx" if="isOSX"> <!-- Edit the link to the JAWT version in the resulting jnilib file; this isn't strictly needed but seems to allow the universal binaries to work on 10.3 machines as well, which @@ -1513,7 +1417,7 @@ <param name="c.compiler.src.files" value="c.src.files.jogl.es2"/> <param name="c.compiler.use-es2" value="true"/> <param name="output.lib.name" value="jogl_es2"/> - <param name="linker.cfg.id" value="${linker.cfg.id.base}"/> + <param name="linker.cfg.id" value="${linker.cfg.id.core}"/> </antcall> </target> @@ -1522,7 +1426,7 @@ <param name="c.compiler.src.files" value="c.src.files.jogl.es1"/> <param name="c.compiler.use-es1" value="true"/> <param name="output.lib.name" value="jogl_es1"/> - <param name="linker.cfg.id" value="${linker.cfg.id.base}"/> + <param name="linker.cfg.id" value="${linker.cfg.id.core}"/> </antcall> </target> @@ -1559,8 +1463,7 @@ </target> <target name="c.build.jogl" depends="c.build.jogl.prepare,c.build.jogl.awt,c.build.newt,c.build.jogl.gl2,c.build.jogl.es2,c.build.jogl.es1,c.build.jogl.cg"> - <antcall target="c.rename.jogl.libs.mingw" inheritRefs="true" /> - <antcall target="c.rename.jogl.libs.macosx" inheritRefs="true" /> + <antcall target="c.fixup.jawt.version.macosx" inheritrefs="true" /> <antcall target="c.manifest" inheritRefs="true" /> </target> @@ -1698,7 +1601,7 @@ - on the platform specific build targets. To circumvent any - errors, ensure that the source is built first. --> - <target name="javadoc.nocg" depends="setup.java.home.dir,init" unless="jogl.cg"> + <target name="javadoc.nocg" depends="load.user.properties,init" unless="jogl.cg"> <!-- Build the general Javadoc --> <javadoc packagenames="${javadoc.packagenames}" excludepackagenames="${java.excludes.javadoc.packagenames}" @@ -1714,7 +1617,7 @@ </target> <!-- Same as above but with Cg directories added --> - <target name="javadoc.cg" depends="setup.java.home.dir,init" if="jogl.cg"> + <target name="javadoc.cg" depends="load.user.properties,init" if="jogl.cg"> <!-- Build the general Javadoc --> <javadoc packagenames="${javadoc.packagenames},com.sun.opengl.cg" excludepackagenames="${java.excludes.javadoc.packagenames}" @@ -1731,7 +1634,7 @@ <target name="javadoc" depends="javadoc.nocg,javadoc.cg" /> - <target name="javadoc.spec.nocg" depends="setup.java.home.dir,init" unless="jogl.cg"> + <target name="javadoc.spec.nocg" depends="load.user.properties,init" unless="jogl.cg"> <!-- Build the general Javadoc --> <javadoc packagenames="${javadoc.spec.packagenames}" excludepackagenames="${java.excludes.javadoc.packagenames}" @@ -1747,7 +1650,7 @@ </target> <!-- Same as above since Cg directories are not part of spec --> - <target name="javadoc.spec.cg" depends="setup.java.home.dir,init" if="jogl.cg"> + <target name="javadoc.spec.cg" depends="load.user.properties,init" if="jogl.cg"> <!-- Build the general Javadoc --> <javadoc packagenames="${javadoc.spec.packagenames}" excludepackagenames="${java.excludes.javadoc.packagenames}" @@ -1795,7 +1698,7 @@ </javadoc> </target> - <target name="javadoc.dev.all" depends="setup.java.home.dir,init,declare,javadoc.dev.nocg,javadoc.dev.cg" /> + <target name="javadoc.dev.all" depends="load.user.properties,init,declare,javadoc.dev.nocg,javadoc.dev.cg" /> <!-- ================================================================== --> <!-- @@ -2255,7 +2158,7 @@ <!-- - Build everything. --> - <target name="all" description="Build JOGL JAR file(s) and native libraries." depends="setup.java.home.dir,init,declare"> + <target name="all" description="Build JOGL JAR file(s) and native libraries." depends="load.user.properties,init,declare"> <!-- Generate, compile, and build the jar for the Java sources. --> <antcall target="jar" inheritRefs="true" /> |