<?xml version="1.0"?>

<!-- Ant file for building native  ogl renderer files for Windows-i586 -->
<project name="j3d-core native" default="compile">

  <target name="compile">

    <!--
    /*
     * TODO: To compile CG, do the following steps:
     *
     * 1. define the following property:
     *      <property name="cg_home" location="c:/Program Files/NVIDIA Corporation/Cg"/>
     *
     * 2. Add the following to the "compile" command:
     *      -I&quot;${cg_home}\include&quot;
     *
     * 3. Add the following the the "link" command:
     *      -L&quot;${cg_home}\lib&quot; -lcg -lcgGL
     */
    -->

    <echo message="Executing 32 bit native renderer build [${bldType}]"/>

    <!-- Create the build directories for sparc -->
    <mkdir dir="${build}/${platform}/${bldType}/native/ogl/objs"/>
    <mkdir dir="${build}/${platform}/${bldType}/bin"/>
    
    <property name="javaInclude"
     location="${java.home}/../include"/>

    <property name="javaWin32Include"
     location="${java.home}/../include/win32"/>

    <property name="oglsrc"     location="${src}/native/ogl"/>

    <!-- Inhibit all warning for native build. Remove -w to switch warning on -->

    <!-- Compile the c source files for the core ogl library -->
    <exec dir="${build}/${platform}/${bldType}/native/ogl/objs" executable="gcc">
	<arg line="-w -D_WINGDI_ -D_JNI_IMPLEMENTATION_ -I&quot;${oglsrc}&quot; -I&quot;${javaInclude}&quot; -I&quot;${javaWin32Include}&quot; -I&quot;${javahCoreTarget}&quot; ${bldFlag} -c &quot;${oglsrc}/DrawingSurfaceObjectAWT.c&quot; &quot;${oglsrc}/Canvas3D.c&quot; &quot;${oglsrc}/GraphicsContext3D.c&quot; &quot;${oglsrc}/NativeScreenInfo.c&quot; &quot;${oglsrc}/NativeConfigTemplate3D.c&quot; &quot;${oglsrc}/MasterControl.c&quot; &quot;${oglsrc}/GeometryArrayRetained.c&quot; &quot;${oglsrc}/Attributes.c&quot; &quot;${oglsrc}/CgShaderProgram.c&quot; &quot;${oglsrc}/GLSLShaderProgram.c&quot; &quot;${oglsrc}/Lights.c&quot;"/>
    </exec>

    <!-- Create the core ogl library file-->
    <exec dir="${build}/${platform}/${bldType}/native/ogl/objs" executable="gcc">
	<arg line="-shared -o j3dcore-ogl.dll DrawingSurfaceObjectAWT.o Canvas3D.o GraphicsContext3D.o NativeScreenInfo.o NativeConfigTemplate3D.o MasterControl.o GeometryArrayRetained.o Attributes.o CgShaderProgram.o GLSLShaderProgram.o Lights.o -Wl,--kill-at -L&quot;${java.home}\..\lib&quot; -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshell32 -lole32 -loleaut32 -luuid -lodbc32 -lodbccp32 -lopengl32 -ljawt"/>
    </exec>

    <!-- Compile the c source files for the ogl-chk library -->
    <exec dir="${build}/${platform}/${bldType}/native/ogl/objs" executable="gcc">
	<arg line="-w -D_WINGDI_ -D_JNI_IMPLEMENTATION_ -I&quot;${oglsrc}&quot; -I&quot;${javaInclude}&quot; -I&quot;${javaWin32Include}&quot; -I&quot;${javahCoreTarget}&quot; ${bldFlag} -c &quot;${oglsrc}/OglCheck.c&quot;"/>
    </exec>

    <!-- Create the ogl-chk library file-->
    <exec dir="${build}/${platform}/${bldType}/native/ogl/objs" executable="gcc">
	<arg line="-shared -o j3dcore-ogl-chk.dll OglCheck.o  -Wl,--kill-at -L&quot;${java.home}\..\lib&quot; -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshell32 -lole32 -loleaut32 -luuid -lodbc32 -lodbccp32 -lopengl32"/>
    </exec>

    <!-- Copy the  library files -->
    <copy todir="${build}/${platform}/${bldType}/bin">
          <fileset dir="${build}/${platform}/${bldType}/native/ogl/objs"
                      includes="j3dcore-ogl*.dll"
          />
    </copy>

  </target>

  <target name="dist">
    <!-- Create the distribution directory -->
    <mkdir dir="${dist}/${platform}/bin"/>

    <!-- Copy the library files -->
    <copy file="${build}/${platform}/opt/bin/j3dcore-ogl.dll"
	 todir="${dist}/${platform}/bin"/>

  </target>

</project>
