From e5bc9f7c6dd6e55be2e7028fce9e410e12e6ea1a Mon Sep 17 00:00:00 2001
From: Gary Frost <frost.gary@gmail.com>
Date: Fri, 11 Nov 2011 17:30:06 +0000
Subject: [PATCH] Simplified build.  Now jogamp files will be downloaded as
 needed when build target is invoked for ant.

---
 examples/nbody/build.xml | 153 +++++++++++++++++++++------------------
 examples/nbody/nbody.bat |   4 +-
 examples/nbody/nbody.sh  |   4 +-
 3 files changed, 87 insertions(+), 74 deletions(-)

diff --git a/examples/nbody/build.xml b/examples/nbody/build.xml
index 48dc677a..fed6f6a6 100644
--- a/examples/nbody/build.xml
+++ b/examples/nbody/build.xml
@@ -5,8 +5,8 @@
 
    <path id="compiler.class.path">
       <pathelement path="../../com.amd.aparapi/aparapi.jar"/>
-      <pathelement path="lib/jogl.all.jar"/>
-      <pathelement path="lib/gluegen-rt.jar"/>
+      <pathelement path="jogamp/jogl.all.jar"/>
+      <pathelement path="jogamp/gluegen-rt.jar"/>
    </path>
 
    <path id="runtime.class.path" cache="true">
@@ -14,92 +14,56 @@
       <pathelement path="${ant.project.name}.jar"/>
    </path>
 
-   <target name="build" depends="clean">
-      <mkdir dir="classes"/>
-      <javac srcdir="src" destdir="classes" debug="on" includeantruntime="false">
-         <classpath refid="compiler.class.path"/>
-      </javac>
-      <copy todir="classes/com/amd/aparapi/examples/nbody" file="src/com/amd/aparapi/examples/nbody/particle.jpg"/>
-      <jar jarfile="${ant.project.name}.jar" basedir="classes"/>
-   </target>
-
-   <target name="clean">
-      <delete dir="classes"/>
-      <delete file="${ant.project.name}.jar"/>
-   </target>
-
-
-
-   <target name="run-jtp">
-
-
-      <java classname="com.amd.aparapi.examples.nbody.Main" fork="true">
-         <classpath refid="runtime.class.path"/>
-         <sysproperty key="java.library.path" path="..\..\com.amd.aparapi.jni;lib"/>
-         <sysproperty key="com.amd.aparapi.executionMode" value="JTP"/>
-         <sysproperty key="bodies" value="16384"/>
-         <sysproperty key="height" value="800"/>
-         <sysproperty key="width" value="800"/>
-      </java>
-   </target>
-
-   <target name="run-gpu">
-      <java classname="com.amd.aparapi.examples.nbody.Main" fork="true">
-         <classpath refid="runtime.class.path"/>
-         <sysproperty key="java.library.path" path="..\..\com.amd.aparapi.jni;lib"/>
-         <sysproperty key="com.amd.aparapi.executionMode" value="GPU"/>
-         <sysproperty key="bodies" value="16384"/>
-         <sysproperty key="height" value="800"/>
-         <sysproperty key="width" value="800"/>
-      </java>
-   </target>
-
-   <target name="run" depends="run-gpu"/>
-
    <target name="getjogl-windows-i586" if="use.win32">
-      <delete dir="lib"/>
-      <get dest="lib">
+      <delete dir="jogamp"/>
+      <get dest="jogamp">
          <url url="${jogamp-jar-url}/jogl-all-natives-windows-i586.jar"/> 
+         <url url="${jogamp-jar-url}/gluegen-rt-natives-windows-i586.jar"/> 
          <url url="${jogamp-jar-url}/jogl.all.jar"/> 
          <url url="${jogamp-jar-url}/gluegen-rt.jar"/> 
-         <url url="${jogamp-jar-url}/gluegen-rt-natives-windows-i586.jar"/> 
       </get>
-      <unzip src="lib/jogl-all-natives-windows-i586.jar" dest="lib"/>
-      <unzip src="lib/gluegen-rt-natives-windows-i586.jar" dest="lib"/>
-      <delete dir="lib/META-INF"/>
+      <unzip src="jogamp/jogl-all-natives-windows-i586.jar" dest="jogamp"/>
+      <unzip src="jogamp/gluegen-rt-natives-windows-i586.jar" dest="jogamp"/>
+      <delete dir="jogamp/META-INF"/>
    </target>
 
    <target name="getjogl-windows-amd64" if="use.win64">
-      <delete dir="lib"/>
-      <get dest="lib">
+      <delete dir="jogamp"/>
+      <get dest="jogamp">
          <url url="${jogamp-jar-url}/jogl-all-natives-windows-amd64.jar"/> 
          <url url="${jogamp-jar-url}/gluegen-rt-natives-windows-amd64.jar"/> 
+         <url url="${jogamp-jar-url}/jogl.all.jar"/> 
+         <url url="${jogamp-jar-url}/gluegen-rt.jar"/> 
       </get>
-      <unzip src="lib/jogl-all-natives-windows-amd64.jar" dest="lib"/>
-      <unzip src="lib/gluegen-rt-natives-windows-amd64.jar" dest="lib"/>
-      <delete dir="lib/META-INF"/>
+      <unzip src="jogamp/jogl-all-natives-windows-amd64.jar" dest="jogamp"/>
+      <unzip src="jogamp/gluegen-rt-natives-windows-amd64.jar" dest="jogamp"/>
+      <delete dir="jogamp/META-INF"/>
    </target>
 
    <target name="getjogl-linux-i586" if="use.linux32">
-      <delete dir="lib"/>
-      <get dest="lib">
+      <delete dir="jogamp"/>
+      <get dest="jogamp">
          <url url="${jogamp-jar-url}/jogl-all-natives-linux-i586.jar"/> 
          <url url="${jogamp-jar-url}/gluegen-rt-windows-linux-i586.jar"/> 
+         <url url="${jogamp-jar-url}/jogl.all.jar"/> 
+         <url url="${jogamp-jar-url}/gluegen-rt.jar"/> 
       </get>
-      <unzip src="lib/jogl-all-natives-linux-i586.jar" dest="lib"/>
-      <unzip src="lib/gluegen-rt-natives-linux-i586.jar" dest="lib"/>
-      <delete dir="lib/META-INF"/>
+      <unzip src="jogamp/jogl-all-natives-linux-i586.jar" dest="jogamp"/>
+      <unzip src="jogamp/gluegen-rt-natives-linux-i586.jar" dest="jogamp"/>
+      <delete dir="jogamp/META-INF"/>
    </target>
 
    <target name="getjogl-linux-amd64" if="use.linux64">
-      <delete dir="lib"/>
-      <get dest="lib">
+      <delete dir="jogamp"/>
+      <get dest="jogamp">
          <url url="${jogamp-jar-url}/jogl-all-natives-linux-amd64.jar"/> 
          <url url="${jogamp-jar-url}/gluegen-rt-natives-linux-amd64.jar"/> 
+         <url url="${jogamp-jar-url}/jogl.all.jar"/> 
+         <url url="${jogamp-jar-url}/gluegen-rt.jar"/> 
       </get>
-      <unzip src="lib/jogl-all-natives-linux-amd64.jar" dest="lib"/>
-      <unzip src="lib/gluegen-rt-natives-linux-amd64.jar" dest="lib"/>
-      <delete dir="lib/META-INF"/>
+      <unzip src="jogamp/jogl-all-natives-linux-amd64.jar" dest="jogamp"/>
+      <unzip src="jogamp/gluegen-rt-natives-linux-amd64.jar" dest="jogamp"/>
+      <delete dir="jogamp/META-INF"/>
    </target>
 
    <target name="checkos">
@@ -110,6 +74,10 @@
                <os arch="x86" />
                <os arch="i386" />
             </or>
+            <not><available file="jogamp/jogl-all-natives-windows-i586.jar"/> </not>
+            <not><available file="jogamp/gluegen-rt-natives-windows-i586.jar"/> </not>
+            <not><available file="jogamp/jogl.all.jar"/> </not>
+            <not><available file="jogamp/gluegen-rt.jar"/> </not>
          </and>
       </condition>
       <condition property="use.win64">
@@ -121,6 +89,10 @@
                   <os arch="i386" />
                </or>
             </not>
+            <not><available file="jogamp/jogl-all-natives-windows-amd64.jar"/> </not>
+            <not><available file="jogamp/gluegen-rt-natives-windows-amd64.jar"/> </not>
+            <not><available file="jogamp/jogl.all.jar"/> </not>
+            <not><available file="jogamp/gluegen-rt.jar"/> </not>
          </and>
       </condition>
       <condition property="use.linux32">
@@ -133,6 +105,10 @@
                <os arch="x86" />
                <os arch="i386" />
             </or>
+            <not><available file="jogamp/jogl-all-natives-linux-i586.jar"/> </not>
+            <not><available file="jogamp/gluegen-rt-natives-linux-i586.jar"/> </not>
+            <not><available file="jogamp/jogl.all.jar"/> </not>
+            <not><available file="jogamp/gluegen-rt.jar"/> </not>
          </and>
       </condition>
       <condition property="use.linux64">
@@ -147,16 +123,53 @@
                   <os arch="i386" />
                </or>
             </not>
+            <not><available file="jogamp/jogl-all-natives-linux-amd64.jar"/> </not>
+            <not><available file="jogamp/gluegen-rt-natives-linux-amd64.jar"/> </not>
+            <not><available file="jogamp/jogl.all.jar"/> </not>
+            <not><available file="jogamp/gluegen-rt.jar"/> </not>
          </and>
       </condition>
    </target>
 
-   <target name="getjogl" depends="checkos, getjogl-windows-i586, getjogl-windows-amd64, getjogl-linux-i586, getjogl-linux-amd64">
-      <get dest="lib">
-         <url url="${jogamp-jar-url}/jogl.all.jar"/> 
-         <url url="${jogamp-jar-url}/gluegen-rt.jar"/> 
-      </get>
+   <target name="getjogl" depends="checkos, getjogl-windows-i586, getjogl-windows-amd64, getjogl-linux-i586, getjogl-linux-amd64"/>
+
+   <target name="build" depends="clean, getjogl">
+      <mkdir dir="classes"/>
+      <javac srcdir="src" destdir="classes" debug="on" includeantruntime="false">
+         <classpath refid="compiler.class.path"/>
+      </javac>
+      <copy todir="classes/com/amd/aparapi/examples/nbody" file="src/com/amd/aparapi/examples/nbody/particle.jpg"/>
+      <jar jarfile="${ant.project.name}.jar" basedir="classes"/>
+   </target>
+
+   <target name="clean">
+      <delete dir="classes"/>
+      <delete file="${ant.project.name}.jar"/>
+   </target>
+
+   <target name="run-jtp">
+      <java classname="com.amd.aparapi.examples.nbody.Main" fork="true">
+         <classpath refid="runtime.class.path"/>
+         <sysproperty key="java.library.path" path="..\..\com.amd.aparapi.jni;jogamp"/>
+         <sysproperty key="com.amd.aparapi.executionMode" value="JTP"/>
+         <sysproperty key="bodies" value="16384"/>
+         <sysproperty key="height" value="800"/>
+         <sysproperty key="width" value="800"/>
+      </java>
    </target>
 
+   <target name="run-gpu">
+      <java classname="com.amd.aparapi.examples.nbody.Main" fork="true">
+         <classpath refid="runtime.class.path"/>
+         <sysproperty key="java.library.path" path="..\..\com.amd.aparapi.jni;jogamp"/>
+         <sysproperty key="com.amd.aparapi.executionMode" value="GPU"/>
+         <sysproperty key="bodies" value="16384"/>
+         <sysproperty key="height" value="800"/>
+         <sysproperty key="width" value="800"/>
+      </java>
+   </target>
+
+   <target name="run" depends="run-gpu"/>
+
 
 </project>
diff --git a/examples/nbody/nbody.bat b/examples/nbody/nbody.bat
index ec363229..e5bd4180 100644
--- a/examples/nbody/nbody.bat
+++ b/examples/nbody/nbody.bat
@@ -1,12 +1,12 @@
 @echo off
 
 java ^
-  -Djava.library.path=..\..\com.amd.aparapi.jni;lib ^
+  -Djava.library.path=..\..\com.amd.aparapi.jni;jogamp ^
   -Dcom.amd.aparapi.executionMode=%1 ^
   -Dbodies=%2 ^
   -Dheight=600 ^
   -Dwidth=600 ^
-  -classpath lib\gluegen-rt.jar;lib\jogl.all.jar;..\..\com.amd.aparapi\aparapi.jar;nbody.jar ^
+  -classpath jogamp\gluegen-rt.jar;jogamp\jogl.all.jar;..\..\com.amd.aparapi\aparapi.jar;nbody.jar ^
   com.amd.aparapi.examples.nbody.Main 
 
 
diff --git a/examples/nbody/nbody.sh b/examples/nbody/nbody.sh
index 4c85079c..63af264e 100644
--- a/examples/nbody/nbody.sh
+++ b/examples/nbody/nbody.sh
@@ -1,10 +1,10 @@
 
 java \
-  -Djava.library.path=../../com.amd.aparapi.jni:lib \
+  -Djava.library.path=../../com.amd.aparapi.jni:jogamp \
   -Dcom.amd.aparapi.executionMode=$1 \
   -Dbodies=$1 \
   -Dheight=600 \
   -Dwidth=600 \
-  -classpath lib/jogl.all.jar:lib/gluegen-rt.jar:../../com.amd.aparapi/aparapi.jar:nbody.jar \
+  -classpath jogamp/jogl.all.jar:jogamp/gluegen-rt.jar:../../com.amd.aparapi/aparapi.jar:nbody.jar \
   com.amd.aparapi.examples.nbody.Main 
 
-- 
GitLab