diff --git a/src/aparapi/com.amd.aparapi.jni/build_altera_nallatech_ocl.xml b/src/aparapi/com.amd.aparapi.jni/build_altera_nallatech_ocl.xml
new file mode 100644
index 0000000000000000000000000000000000000000..72f8a9b4a1d94d9e33e9c80dde4f563b01b6e178
--- /dev/null
+++ b/src/aparapi/com.amd.aparapi.jni/build_altera_nallatech_ocl.xml
@@ -0,0 +1,895 @@
+<?xml version="1.0"?>
+
+<!--
+You should not have to edit this file
+First consider editing the properties in build.properties
+-->
+<project name="com.amd.aparapi.jni" default="build" basedir=".">
+
+   <!-- 
+   DO NOT EDIT BELOW THIS LINE 
+   -->
+   <echo>OS Name:    ${os.name}</echo>
+   <echo>OS Version: ${os.version}</echo>
+   <echo>OS Arch:    ${os.arch}</echo>
+
+   <!--<property name="build.compiler" value="javac1.6"/>-->
+   <!--  <property name="ant.build.javac.source" value="1.6"/>-->
+   <!-- <property name="ant.build.javac.target" value="1.6"/> -->
+
+   <property environment="env" />
+   <!-- we need env.PATH for msvc only -->
+
+   <!-- uncomment this if you want to use mingw! -->
+   <!--<property name="mingw.dir" value="c:\\MinGW"/>-->
+
+   <target name="init">
+      <available property="win32.amd.app.sdk.exists" file="C:/Program Files/AMD APP" type="dir"/>
+
+      <condition property="amd.app.sdk.dir" value="C:/Program Files/AMD APP">
+         <and>
+            <os family="windows" />
+            <isset property="win32.amd.app.sdk.exists" />
+            <not>
+               <isset property="amd.app.sdk.dir" />
+            </not>
+         </and>
+      </condition>
+
+      <available property="win64.amd.app.sdk.exists" file="C:/Program Files (x86)/AMD APP" type="dir"/>
+      <condition property="amd.app.sdk.dir" value="C:/Program Files (x86)/AMD APP">
+         <and>
+            <os family="windows" />
+            <isset property="win64.amd.app.sdk.exists" />
+            <not>
+               <isset property="win32.amd.app.sdk.exists" />
+            </not>
+         </and>
+      </condition>
+
+      <!-- !!! oren change -> detect Altera OpenCL SDK -->
+      <available property="linux.amd.app.sdk.exists" file="${env.ALTERAOCLSDKROOT}" type="dir"/>
+      <condition property="amd.app.sdk.dir" value="${env.ALTERAOCLSDKROOT}">
+         <and>
+            <os family="unix" />
+            <not>
+               <os family="mac" />
+            </not>
+            <isset property="linux.amd.app.sdk.exists" />
+            <not>
+               <isset property="win32.amd.app.sdk.exists" />
+            </not>
+            <not>
+               <isset property="win64.amd.app.sdk.exists" />
+            </not>
+         </and>
+      </condition>
+
+      <echo message=" amd.app.sdk.dir ${amd.app.sdk.dir}"/>
+
+
+      <!-- !!! 11.11.14 oren change -> detect Altera OpenCL SDK Board Package root -->
+      <available property="linux.amd.app.bsp.exists" file="${env.AOCL_BOARD_PACKAGE_ROOT}" type="dir"/>
+      <condition property="amd.app.bsp.dir" value="${env.AOCL_BOARD_PACKAGE_ROOT}">
+         <and>
+            <os family="unix" />
+            <not>
+               <os family="mac" />
+            </not>
+            <isset property="linux.amd.app.bsp.exists" />
+            <not>
+               <isset property="win32.amd.app.sdk.exists" />
+            </not>
+            <not>
+               <isset property="win64.amd.app.sdk.exists" />
+            </not>
+         </and>
+      </condition>
+
+      <echo message=" amd.app.bsp.dir ${amd.app.bsp.dir}"/>
+
+	  <!-- Check for Visual Studio -->
+	  <!-- This needs to be in descending order to properly handle multiple installations -->
+	  
+      <available property="msvc.32.11.0.exists" file="c:/Program Files (x86)/Microsoft Visual Studio 11.0\VC\bin" type="dir"/>
+      <condition property="msvc.dir" value="c:/Program Files (x86)/Microsoft Visual Studio 11.0">
+         <and>
+            <not>
+               <or>
+                  <os arch="x86" />
+                  <os arch="i386" />
+               </or>
+            </not>
+            <os family="windows" />
+            <isset property="msvc.32.11.0.exists" />
+            <not>
+               <isset property="msvc.dir" />
+            </not>
+            <not>
+               <isset property="mingw.dir" />
+            </not>
+         </and>
+      </condition>
+      
+      <available property="msvc.64.10.0.exists" file="c:/Program Files/Microsoft Visual Studio 10.0\vc\bin" type="dir"/>
+      <condition property="msvc.dir" value="c:/Program Files/Microsoft Visual Studio 10.0">
+         <and>
+            <or>
+               <os arch="x86" />
+               <os arch="i386" />
+            </or>
+            <os family="windows" />
+            <isset property="msvc.64.10.0.exists" />
+            <not>
+               <isset property="msvc.dir" />
+            </not>
+            <not>
+               <isset property="mingw.dir" />
+            </not>
+         </and>
+      </condition>
+      
+      <available property="msvc.32.10.0.exists" file="c:/Program Files (x86)/Microsoft Visual Studio 10.0\vc\bin" type="dir"/>
+      <condition property="msvc.dir" value="c:/Program Files (x86)/Microsoft Visual Studio 10.0">
+         <and>
+            <not>
+               <or>
+                  <os arch="x86" />
+                  <os arch="i386" />
+               </or>
+            </not>
+            <os family="windows" />
+            <isset property="msvc.32.10.0.exists" />
+            <not>
+               <isset property="msvc.dir" />
+            </not>
+            <not>
+               <isset property="mingw.dir" />
+            </not>
+         </and>
+      </condition>
+      
+      <available property="msvc.32.9.0.exists" file="c:/Program Files/Microsoft Visual Studio 9.0\vc\bin" type="dir"/>
+      <condition property="msvc.dir" value="c:/Program Files/Microsoft Visual Studio 9.0">
+         <and>
+            <or>
+               <os arch="x86" />
+               <os arch="i386" />
+            </or>
+            <os family="windows" />
+            <isset property="msvc.32.9.0.exists" />
+            <not>
+               <isset property="msvc.dir" />
+            </not>
+            <not>
+               <isset property="mingw.dir" />
+            </not>
+         </and>
+      </condition>
+
+	  <!-- Check for SDKs -->
+	  <!-- This needs to be in descending order to properly handle multiple installations -->
+	  
+      <!-- <available property="msvc.sdk.8.0A.32.exists" file="C:/Program Files (x86)/Microsoft SDKs/Windows/v8.0A" type="dir"/>
+      <condition property="msvc.sdk.dir" value="C:/Program Files (x86)/Microsoft SDKs/Windows/v8.0A">
+         <and>
+            <os family="windows" />
+            <isset property="msvc.sdk.8.0A.32.exists" />
+            <not>
+               <isset property="msvc.sdk.dir" />
+            </not>
+            <not>
+               <isset property="mingw.dir" />
+            </not>
+         </and>
+      </condition>
+      
+      <available property="msvc.sdk.8.0.32.exists" file="C:/Program Files (x86)/Microsoft SDKs/Windows/v8.0" type="dir"/>
+      <condition property="msvc.sdk.dir" value="C:/Program Files (x86)/Microsoft SDKs/Windows/v8.0">
+         <and>
+            <os family="windows" />
+            <isset property="msvc.sdk.8.0.32.exists" />
+            <not>
+               <isset property="msvc.sdk.dir" />
+            </not>
+            <not>
+               <isset property="mingw.dir" />
+            </not>
+         </and>
+      </condition> -->
+      
+      <available property="msvc.sdk.7.1A.exists" file="C:/Program Files/Microsoft SDKs/Windows/v7.1A" type="dir"/>
+      <condition property="msvc.sdk.dir" value="C:/Program Files/Microsoft SDKs/Windows/v7.1A">
+         <and>
+            <os family="windows" />
+            <isset property="msvc.sdk.7.1A.exists" />
+            <not>
+               <isset property="msvc.sdk.dir" />
+            </not>
+            <not>
+               <isset property="mingw.dir" />
+            </not>
+         </and>
+      </condition>
+      
+      <available property="msvc.sdk.7.1A.32.exists" file="C:/Program Files (x86)/Microsoft SDKs/Windows/v7.1A" type="dir"/>
+      <condition property="msvc.sdk.dir" value="C:/Program Files (x86)/Microsoft SDKs/Windows/v7.1A">
+         <and>
+            <os family="windows" />
+            <isset property="msvc.sdk.7.1A.32.exists" />
+            <not>
+               <isset property="msvc.sdk.dir" />
+            </not>
+            <not>
+               <isset property="mingw.dir" />
+            </not>
+         </and>
+      </condition>
+      
+      <available property="msvc.sdk.7.1.exists" file="C:/Program Files/Microsoft SDKs/Windows/v7.1" type="dir"/>
+      <condition property="msvc.sdk.dir" value="C:/Program Files/Microsoft SDKs/Windows/v7.1">
+         <and>
+            <os family="windows" />
+            <isset property="msvc.sdk.7.1.exists" />
+            <not>
+               <isset property="msvc.sdk.dir" />
+            </not>
+            <not>
+               <isset property="mingw.dir" />
+            </not>
+         </and>
+      </condition>
+
+	  <available property="msvc.sdk.7.1.32.exists" file="C:/Program Files (x86)/Microsoft SDKs/Windows/v7.1" type="dir"/>
+      <condition property="msvc.sdk.dir" value="C:/Program Files (x86)/Microsoft SDKs/Windows/v7.1">
+         <and>
+            <os family="windows" />
+            <isset property="msvc.sdk.7.1.32.exists" />
+            <not>
+               <isset property="msvc.sdk.dir" />
+            </not>
+            <not>
+               <isset property="mingw.dir" />
+            </not>
+         </and>
+      </condition>
+
+      <available property="msvc.sdk.7.0A.exists" file="C:/Program Files/Microsoft SDKs/Windows/v7.0A" type="dir"/>
+      <condition property="msvc.sdk.dir" value="C:/Program Files/Microsoft SDKs/Windows/v7.0A">
+         <and>
+            <os family="windows" />
+            <isset property="msvc.sdk.7.0A.exists" />
+            <not>
+               <isset property="msvc.sdk.dir" />
+            </not>
+            <not>
+               <isset property="mingw.dir" />
+            </not>
+         </and>
+      </condition>
+
+      <available property="msvc.sdk.7.0A.32.exists" file="C:/Program Files (x86)/Microsoft SDKs/Windows/v7.0A" type="dir"/>
+      <condition property="msvc.sdk.dir" value="C:/Program Files (x86)/Microsoft SDKs/Windows/v7.0A">
+         <and>
+            <os family="windows" />
+            <isset property="msvc.sdk.7.0A.32.exists" />
+            <not>
+               <isset property="msvc.sdk.dir" />
+            </not>
+            <not>
+               <isset property="mingw.dir" />
+            </not>
+         </and>
+      </condition>
+      
+      <available property="msvc.sdk.7.0.exists" file="C:/Program Files/Microsoft SDKs/Windows/v7.0" type="dir"/>
+      <condition property="msvc.sdk.dir" value="C:/Program Files/Microsoft SDKs/Windows/v7.0">
+         <and>
+            <os family="windows" />
+            <isset property="msvc.sdk.7.0.exists" />
+            <not>
+               <isset property="msvc.sdk.dir" />
+            </not>
+            <not>
+               <isset property="mingw.dir" />
+            </not>
+         </and>
+      </condition>
+
+      <available property="msvc.sdk.6.0A.exists" file="C:/Program Files/Microsoft SDKs/Windows/v6.0A" type="dir"/>
+      <condition property="msvc.sdk.dir" value="C:/Program Files/Microsoft SDKs/Windows/v6.0A">
+         <and>
+            <os family="windows" />
+            <isset property="msvc.sdk.6.0A.exists" />
+            <not>
+               <isset property="msvc.sdk.dir" />
+            </not>
+            <not>
+               <isset property="mingw.dir" />
+            </not>
+         </and>
+      </condition>
+
+      <echo message=" msvc.dir ${msvc.dir}"/>
+      <echo message=" msvc.sdk.dir ${msvc.sdk.dir}"/>
+   </target>
+
+   <target name="check" depends="init">
+
+      <fail message="Error:">
+         <condition>
+            <and>
+               <os family="windows" />
+               <isset property="msvc.dir" />
+               <not>
+                  <isset property="msvc.sdk.dir" />
+               </not>
+            </and>
+         </condition>
+         <![CDATA[
+         You will need to edit com.amd.aparapi.jni/build.properties to compile aparapi JNI code
+
+         At present msvc.dir seems to be Configured but not msvc.sdk.dir
+         ]]>
+      </fail>
+
+      <fail message="Error:">
+         <condition>
+            <and>
+               <os family="windows" />
+               <not>
+                  <isset property="msvc.dir" />
+               </not>
+               <isset property="msvc.sdk.dir" />
+            </and>
+         </condition>
+         <![CDATA[
+         You will need to edit com.amd.aparapi.jni/build.properties to compile aparapi JNI code
+
+         At present msvc.sdk.dir seems to be Configured but not msvc.dir
+         ]]>
+      </fail>
+      <available file="${msvc.dir}" type="dir" property="msvc.dir.exists" />
+      <available file="${msvc.sdk.dir}" type="dir" property="msvc.sdk.dir.exists" />
+
+      <fail message="Error:">
+         <condition>
+            <and>
+               <os family="windows" />
+               <isset property="msvc.dir" />
+               <not>
+                  <isset property="msvc.dir.exists" />
+               </not>
+            </and>
+         </condition>
+         <![CDATA[
+         You will need to edit com.amd.aparapi.jni/build.properties to compile aparapi JNI code
+
+         At present msvc.dir is set (to ${msvc.dir}) but that dir does not exist
+         ]]>
+      </fail>
+      <fail message="Error:">
+         <condition>
+            <and>
+               <os family="windows" />
+               <isset property="msvc.sdk.dir" />
+               <not>
+                  <isset property="msvc.sdk.dir.exists" />
+               </not>
+            </and>
+         </condition>
+         <![CDATA[
+         You will need to edit com.amd.aparapi.jni/build.properties to compile aparapi JNI code
+
+         At present msvc.sdk.dir is set (to ${msvc.sdk.dir}) but that dir does not exist
+         ]]>
+      </fail>
+
+
+      <available file="${mingw.dir}" type="dir" property="mingw.dir.exists" />
+      <fail message="Error:">
+         <condition>
+            <and>
+               <os family="windows" />
+               <isset property="mingw.dir" />
+               <not>
+                  <isset property="mingw.dir.exists" />
+               </not>
+            </and>
+         </condition>
+         <![CDATA[
+         You will need to edit com.amd.aparapi.jni/build.properties to compile aparapi JNI code
+
+         At present mingw.dir is set (to ${mingw.dir}) but that dir does not exist
+         ]]>
+      </fail>
+      <!--<echo message="java.home ${java.home}"/>-->
+      <!--<echo message="msvc.dir.exists ${msvc.dir.exists}"/>-->
+      <!--<echo message="msvc.sdk.dir.exists ${msvc.sdk.dir.exists}"/>-->
+      <!--<echo message="mingw.dir.exists ${mingw.dir.exists}"/>-->
+      <condition property="use.msvc">
+         <and>
+            <os family="windows" />
+            <isset property="msvc.dir.exists" />
+            <isset property="msvc.sdk.dir.exists" />
+         </and>
+      </condition>
+      <!--<echo message="use.msvc ${use.msvc}"/>-->
+
+      <condition property="use.mingw">
+         <and>
+            <os family="windows" />
+            <isset property="mingw.dir.exists" />
+         </and>
+      </condition>
+      <!--<echo message="use.mingw ${use.mingw}"/>-->
+
+      <fail message="Error:">
+         <condition>
+            <and>
+               <isset property="use.mingw" />
+               <isset property="use.msvc" />
+            </and>
+         </condition>
+         <![CDATA[
+         You will need to edit com.amd.aparapi.jni/build.properties to compile aparapi JNI code
+
+         At present ant is Configured for both MinGW AND Microsoft Visual Studio. You need to pick one or the other :) !
+
+         Just comment out the properties for the compiler that you *do not* wish to use.
+         ]]>
+      </fail>
+
+      <fail message="Error:">
+         <condition>
+            <and>
+               <os family="windows" />
+               <not>
+                  <or>
+                     <isset property="use.mingw" />
+                     <isset property="use.msvc" />
+                  </or>
+               </not>
+            </and>
+         </condition>
+         <![CDATA[
+         You will need to edit com.amd.aparapi.jni/build.properties to compile aparapi JNI code
+
+         This looks like a windows machine so you probably need to Configure either:-
+
+         * msvc.dir and msvc.sdk.dir if you wish to use Microsoft Visual Studio compiler
+
+         * mingw.dir if you prefer if you prefer to use MinGW 
+         ]]>
+      </fail>
+
+      <condition property="use.gcc">
+         <and>
+            <os family="unix" />
+            <not>
+               <os family="mac" />
+            </not>
+         </and>
+      </condition>
+
+      <condition property="use.gcc_mac">
+         <os family="mac" />
+      </condition>
+
+      <condition property="x86_or_x86_64" value="x86" else="x86_64">
+         <or>
+            <os arch="x86" />
+            <os arch="i386" />
+         </or>
+      </condition>
+
+      <condition property="optional.amd64.subdir" value="" else="amd64\">
+         <or>
+            <os arch="x86" />
+            <os arch="i386" />
+         </or>
+      </condition>
+
+      <condition property="optional.x64.subdir" value="" else="x64\">
+         <or>
+            <os arch="x86" />
+            <os arch="i386" />
+         </or>
+      </condition>
+
+
+      <available file="${msvc.dir}\vc\bin\${optional.amd64.subdir}cl.exe" type="file" property="cl.exists" />
+
+      <fail message="Error:">
+         <condition>
+            <and>
+               <isset property="use.msvc" />
+               <not>
+                  <isset property="cl.exists" />
+               </not>
+            </and>
+         </condition>
+         <![CDATA[
+         You will need to edit com.amd.aparapi.jni/build.properties to compile aparapi JNI code
+
+         Could not find vc\bin\${optional.amd64.subdir}cl under Configured msvc.dir. Check if msvc.dir is pointing
+         to a valid visual studio installation
+         ]]>
+      </fail>
+
+      <fail message="Error:">
+         <condition>
+            <and>
+               <not>
+                  <os family="mac" />
+               </not>
+               <not>
+                  <isset property="amd.app.sdk.dir" />
+               </not>
+            </and>
+         </condition>
+         <![CDATA[
+         You will need to edit com.amd.aparapi.jni/build.properties to compile aparapi JNI code
+
+         You need to set amd.app.sdk.dir to point to the location where AMD APP SDK is installed
+         ]]>
+      </fail>
+      <available file="${amd.app.sdk.dir}" type="dir" property="amd.app.sdk.dir.exists" />
+
+      <fail message="Error:">
+         <condition>
+            <and>
+               <not>
+                  <os family="mac" />
+               </not>
+               <not>
+                  <isset property="amd.app.sdk.dir.exists" />
+               </not>
+            </and>
+         </condition>
+         <![CDATA[
+         You will need to edit com.amd.aparapi.jni/build.properties to compile aparapi JNI code
+
+         At present amd.app.sdk.dir is set (to ${amd.app.sdk.dir}) but that dir does not exist
+         ]]>
+      </fail>
+   </target>
+
+   <target name="clean" depends="check">
+      <delete dir="include" />
+      <delete dir="${basedir}/dist" />
+      <!-- Legacy cleanup -->
+      <delete file="libaparapi_${x86_or_x86_64}.dylib" />
+      <delete file="libaparapi_${x86_or_x86_64}.so" />
+      <delete file="aparapi_${x86_or_x86_64}.dll" />
+      <delete file="aparapi.dll" />
+      <delete file="aparapi.obj" />
+      <delete file="aparapi.o" />
+      <delete file="aparapi.lib" />
+      <delete file="aparapi.exp" />
+      <delete file="OpenCLJNI.obj" />
+      <delete file="OpenCLJNI.o" />
+      <delete file="Config.obj" />
+      <delete file="Config.o" />
+      <delete file="ProfileInfo.obj" />
+      <delete file="ProfileInfo.o" />
+      <delete file="ArrayBuffer.obj" />
+      <delete file="ArrayBuffer.o" />
+      <delete file="AparapiBuffer.obj" />
+      <delete file="AparapiBuffer.o" />
+      <delete file="JNIHelper.obj" />
+      <delete file="JNIHelper.o" />
+      <delete file="CLHelper.obj" />
+      <delete file="CLHelper.o" />
+      <delete file="JNIContext.obj" />
+      <delete file="JNIContext.o" />
+      <delete file="KernelArg.obj" />
+      <delete file="KernelArg.o" />
+      <delete file="Range.obj" />
+      <delete file="Range.o" />
+      <delete file="OpenCLArgDescriptor.obj" />
+      <delete file="OpenCLArgDescriptor.o" />
+      <delete file="agent.obj" />
+      <delete file="agent.o" />
+      <delete file="classtools.obj" />
+      <delete file="classtools.o" />
+      <delete file="OpenCLMem.obj" />
+      <delete file="OpenCLMem.o" />
+   </target>
+
+   <target name="javah">
+      <mkdir dir="include" />
+      <javah classpath="..\com.amd.aparapi\classes" destdir="include" force="true">
+         <class name="com.amd.aparapi.internal.jni.ConfigJNI" />
+         <class name="com.amd.aparapi.internal.jni.KernelArgJNI" />
+         <class name="com.amd.aparapi.internal.jni.KernelRunnerJNI" />
+         <class name="com.amd.aparapi.internal.jni.OpenCLJNI" />
+         <class name="com.amd.aparapi.internal.jni.RangeJNI" />
+         <!-- Non-Native Classes -->
+         <class name="com.amd.aparapi.Kernel"/>
+         <class name="com.amd.aparapi.Range"/>
+         <class name="com.amd.aparapi.Config" />
+         <class name="com.amd.aparapi.device.Device" />
+         <class name="com.amd.aparapi.device.OpenCLDevice" />
+         <class name="com.amd.aparapi.internal.kernel.KernelRunner"/>
+         <class name="com.amd.aparapi.internal.opencl.OpenCLArgDescriptor" />
+         <class name="com.amd.aparapi.internal.opencl.OpenCLMem" />
+      </javah>
+   </target>
+
+
+   <target name="gcc" if="use.gcc">
+      <mkdir dir="${basedir}/dist"/>
+      <echo message="linuxcc ${os.arch}" />
+      <exec executable="g++">
+        <!-- !!! oren change -> add debug info, no optimizations 
+         <arg value="-O3" />
+         <arg value="-O0" />
+        -->
+         <arg value="-O3" />
+         <arg value="-g" />
+         <arg value="-fPIC" />
+         <arg value="-DCL_USE_DEPRECATED_OPENCL_1_1_APIS"/>
+         <arg value="-DALTERA_OPENCL"/>
+         <arg value="-I${java.home}/../include" />
+         <arg value="-I${java.home}/../include/linux" />
+         <arg value="-Iinclude" />
+         <arg value="-I${amd.app.sdk.dir}/host/include" />
+         <arg value="-Isrc/cpp" />
+         <arg value="-Isrc/cpp/runKernel" />
+         <arg value="-Isrc/cpp/invoke" />
+         <arg value="-shared" />
+         <arg value="-o"/> 
+         <arg value="${basedir}/dist/libaparapi_${x86_or_x86_64}.so" />
+         <arg value="src/cpp/runKernel/Aparapi.cpp" />
+         <arg value="src/cpp/runKernel/ArrayBuffer.cpp" />
+         <arg value="src/cpp/runKernel/AparapiBuffer.cpp" />
+         <arg value="src/cpp/runKernel/Config.cpp" />
+         <arg value="src/cpp/runKernel/JNIContext.cpp" />
+         <arg value="src/cpp/runKernel/KernelArg.cpp" />
+         <arg value="src/cpp/runKernel/ProfileInfo.cpp" />
+         <arg value="src/cpp/runKernel/Range.cpp" />
+         <arg value="src/cpp/invoke/OpenCLJNI.cpp" />
+         <arg value="src/cpp/invoke/OpenCLArgDescriptor.cpp" />
+         <arg value="src/cpp/invoke/OpenCLMem.cpp" />
+         <arg value="src/cpp/CLHelper.cpp" />
+         <arg value="src/cpp/classtools.cpp" />
+         <arg value="src/cpp/JNIHelper.cpp" />
+         <arg value="src/cpp/agent.cpp" />
+         <!--  11.1.14 Nallatch old -> <arg value="-L${amd.app.sdk.dir}/linux64/lib" /> -->
+         <arg value="-L${amd.app.bsp.dir}/linux64/lib" />
+         <arg value="-L${amd.app.sdk.dir}/host/linux64/lib" />
+         <arg value="-lalterahalmmd" />
+         <!--  5.9.15 Nallatch  -> -->
+         <arg value="-lnalla_pcie_mmd" /> 
+         <!--  Terasic  -> -->
+         <!--  5.9.15 terasic specific -> <arg value="-laltera_apb_14_0_mmd" /> -->
+         <!--  11.1.14 Nallatch old -><arg value="-lpkg_editor" /> -->
+         <arg value="-lalteracl" />
+         <arg value="-lelf" />
+         <arg value="-lrt" />
+         <arg value="-lstdc++" />
+      </exec>
+   </target>
+
+   <target name="gcc_mac" if="use.gcc_mac">
+      <mkdir dir="${basedir}/dist"/>
+      <echo message="gcc ${os.arch}" />
+      <exec executable="g++">
+         <arg value="-O3" />
+         <arg value="-g" />
+         <arg value="-fPIC" />
+         <!-- <arg value="-fopenmp"/> -->
+         <arg value="-DCL_USE_DEPRECATED_OPENCL_1_1_APIS"/>
+         <arg value="-I/System/Library/Frameworks/JavaVM.framework/Headers" />
+         <arg value="-Iinclude" />
+         <arg value="-Isrc/cpp" />
+         <arg value="-Isrc/cpp/runKernel" />
+         <arg value="-Isrc/cpp/invoke" />
+         <arg value="-shared" />
+         <arg value="-o" />
+         <arg value="${basedir}/dist/libaparapi_${x86_or_x86_64}.dylib" />
+         <arg value="src/cpp/runKernel/Aparapi.cpp" />
+         <arg value="src/cpp/runKernel/ArrayBuffer.cpp" />
+         <arg value="src/cpp/runKernel/AparapiBuffer.cpp" />
+         <arg value="src/cpp/runKernel/Config.cpp" />
+         <arg value="src/cpp/runKernel/JNIContext.cpp" />
+         <arg value="src/cpp/runKernel/KernelArg.cpp" />
+         <arg value="src/cpp/runKernel/ProfileInfo.cpp" />
+         <arg value="src/cpp/runKernel/Range.cpp" />
+         <arg value="src/cpp/invoke/OpenCLJNI.cpp" />
+         <arg value="src/cpp/invoke/OpenCLArgDescriptor.cpp" />
+         <arg value="src/cpp/invoke/OpenCLMem.cpp" />
+         <arg value="src/cpp/CLHelper.cpp" />
+         <arg value="src/cpp/classtools.cpp" />
+         <arg value="src/cpp/JNIHelper.cpp" />
+         <arg value="src/cpp/agent.cpp" />
+         <arg value="-framework" />
+         <arg value="OpenCL" />
+         <arg value="-Wno-write-strings" />
+      </exec>
+   </target>
+
+   <target name="msvc" if="use.msvc">
+      <mkdir dir="${basedir}\dist"/>
+      <echo message="msvc ${os.arch}" />
+      <exec executable="${msvc.dir}\vc\bin\${optional.amd64.subdir}cl.exe">
+         <env key="PATH" path="${env.PATH};${msvc.dir}\\Common7\\IDE" />
+         <arg value="/nologo" />
+         <arg value="/TP" />
+         <arg value="/Ox" />
+         <!-- <arg value="/openmp" /> -->
+         <arg value="-DCL_USE_DEPRECATED_OPENCL_1_1_APIS"/>
+         <arg value="/EHsc" />
+         <arg value="/I${msvc.dir}\vc\include" />
+         <arg value="/I${msvc.sdk.dir}\include" />
+         <arg value="/I${java.home}\..\include" />
+         <arg value="/I${java.home}\..\include\win32" />
+         <arg value="/Iinclude" />
+         <arg value="/I${amd.app.sdk.dir}\include" />
+         <arg value="/Isrc/cpp" />
+         <arg value="/Isrc/cpp/runKernel" />
+         <arg value="/Isrc/cpp/invoke" />
+         <arg value="src/cpp/runKernel/Aparapi.cpp" />
+         <arg value="src/cpp/runKernel/ArrayBuffer.cpp" />
+         <arg value="src/cpp/runKernel/AparapiBuffer.cpp" />
+         <arg value="src/cpp/runKernel/Config.cpp" />
+         <arg value="src/cpp/runKernel/JNIContext.cpp" />
+         <arg value="src/cpp/runKernel/KernelArg.cpp" />
+         <arg value="src/cpp/runKernel/ProfileInfo.cpp" />
+         <arg value="src/cpp/runKernel/Range.cpp" />
+         <arg value="src/cpp/invoke/OpenCLJNI.cpp" />
+         <arg value="src/cpp/invoke/OpenCLArgDescriptor.cpp" />
+         <arg value="src/cpp/invoke/OpenCLMem.cpp" />
+         <arg value="src/cpp/CLHelper.cpp" />
+         <arg value="src/cpp/classtools.cpp" />
+         <arg value="src/cpp/JNIHelper.cpp" />
+         <arg value="src/cpp/agent.cpp" />
+         <arg value="/LD" />
+         <arg value="/link" />
+         <arg value="/libpath:${msvc.dir}\vc\lib\${optional.amd64.subdir}" />
+         <arg value="/libpath:${msvc.sdk.dir}\lib\${optional.x64.subdir}" />
+         <arg value="/libpath:${amd.app.sdk.dir}\lib\${x86_or_x86_64}" />
+         <arg value="OpenCL.lib" />
+         <arg value="/out:${basedir}\dist\aparapi_${x86_or_x86_64}.dll" />
+      </exec>
+   </target>
+
+   <target name="mingw" if="use.mingw">
+      <mkdir dir="${basedir}\dist"/>
+      <echo message="mingw ${os.arch}" /> 
+      <exec executable="${mingw.dir}/bin/g++">
+         <env key="PATH" path="${env.PATH};${mingw.dir}/bin" />
+         <arg value="-Wall" />
+         <arg value="-O3" />
+         <arg value="-Wl,--kill-at" />
+         <arg value="-DCL_USE_DEPRECATED_OPENCL_1_1_APIS"/>
+         <arg value="-I${java.home}\..\include" />
+         <arg value="-I${java.home}\..\include\win32" />
+         <arg value="-Iinclude" />
+         <arg value="-I${amd.app.sdk.dir}\include" />
+         <arg value="-Isrc/cpp" />
+         <arg value="-Isrc/cpp/runKernel" />
+         <arg value="-Isrc/cpp/invoke" />
+         <arg value="-shared" />
+         <arg value="-o" />
+         <arg value="${basedir}\dist\aparapi_${x86_or_x86_64}.dll" />
+         <arg value="src/cpp/runKernel/Aparapi.cpp" />
+         <arg value="src/cpp/runKernel/ArrayBuffer.cpp" />
+         <arg value="src/cpp/runKernel/AparapiBuffer.cpp" />
+         <arg value="src/cpp/runKernel/Config.cpp" />
+         <arg value="src/cpp/runKernel/JNIContext.cpp" />
+         <arg value="src/cpp/runKernel/KernelArg.cpp" />
+         <arg value="src/cpp/runKernel/ProfileInfo.cpp" />
+         <arg value="src/cpp/runKernel/Range.cpp" />
+         <arg value="src/cpp/invoke/OpenCLJNI.cpp" />
+         <arg value="src/cpp/invoke/OpenCLArgDescriptor.cpp" />
+         <arg value="src/cpp/invoke/OpenCLMem.cpp" />
+         <arg value="src/cpp/CLHelper.cpp" />
+         <arg value="src/cpp/classtools.cpp" />
+         <arg value="src/cpp/JNIHelper.cpp" />
+         <arg value="src/cpp/agent.cpp" />
+         <arg value="-L${amd.app.sdk.dir}\lib\${x86_or_x86_64}" />
+         <arg value="-lOpenCL" />
+      </exec>
+   </target>
+
+   <target name="build" depends="clean, javah, msvc, mingw, gcc, gcc_mac" />
+
+   <target name="msvc_cltest" if="use.msvc">
+      <mkdir dir="${basedir}\dist"/>
+      <echo message="msvc_cltest ${os.arch}" />
+      <exec executable="${msvc.dir}\vc\bin\${optional.amd64.subdir}cl.exe">
+         <env key="PATH" path="${env.PATH};${msvc.dir}\\Common7\\IDE" />
+         <arg value="/nologo" />
+         <arg value="/TP" />
+         <arg value="/Ox" />
+         <arg value="-DCL_USE_DEPRECATED_OPENCL_1_1_APIS"/>
+         <arg value="/I${msvc.dir}\vc\include" />
+         <arg value="/I${msvc.sdk.dir}\include" />
+         <arg value="/I${amd.app.sdk.dir}\include" />
+         <arg value="/Isrc/cpp" />
+         <arg value="/Isrc/cpp/runKernel" />
+         <arg value="/Isrc/cpp/invoke" />
+         <arg value="src\cpp\CLTest.cpp" />
+         <arg value="/link" />
+         <arg value="/libpath:${msvc.dir}\vc\lib\${optional.amd64.subdir}" />
+         <arg value="/libpath:${msvc.sdk.dir}\lib\${optional.x64.subdir}" />
+         <arg value="/libpath:${amd.app.sdk.dir}\lib\${x86_or_x86_64}" />
+         <arg value="OpenCL.lib" />
+         <arg value="/out:${basedir}/dist/cltest_${x86_or_x86_64}.exe" />
+      </exec>
+   </target>
+
+   <target name="mac_cltest" if="use.gcc_mac">
+      <mkdir dir="${basedir}/dist"/>
+      <echo message="gcc cltest ${os.arch}" />
+      <exec executable="g++">
+         <arg value="-O3" />
+         <arg value="-g" />
+         <arg value="-fPIC" />
+         <arg value="-DCL_USE_DEPRECATED_OPENCL_1_1_APIS"/>
+         <arg value="-I/System/Library/Frameworks/JavaVM.framework/Headers" />
+         <arg value="-Iinclude" />
+         <arg value="-Isrc/cpp" />
+         <arg value="-Isrc/cpp/runKernel" />
+         <arg value="-Isrc/cpp/invoke" />
+         <arg value="-o" />
+         <arg value="${basedir}/dist/cltest" />
+         <arg value="src/cpp/CLTest.cpp" />
+         <arg value="-framework" />
+         <arg value="OpenCL" />
+      </exec>
+   </target>
+
+   <target name="gcc_cltest" if="use.gcc">
+      <mkdir dir="${basedir}/dist"/>
+      <echo message="gcc cltest ${os.arch}" />
+      <exec executable="g++">
+         <arg value="-O3" />
+         <arg value="-g" />
+         <arg value="-fPIC" />
+         <arg value="-DCL_USE_DEPRECATED_OPENCL_1_1_APIS"/>
+         <arg value="-I${java.home}/../include" />
+         <arg value="-I${java.home}/../include/linux" />
+         <arg value="-I${amd.app.sdk.dir}/include" />
+         <arg value="src/cpp/cltest.cpp" />
+         <arg value="-L${amd.app.sdk.dir}/lib/${x86_or_x86_64}" />
+         <arg value="-lOpenCL" />
+         <arg value="-o" />
+         <arg value="${basedir}/cltest_${x86_or_x86_64}" />
+      </exec>
+  </target>
+
+   <target name="gcc_clt" if="use.gcc">
+      <mkdir dir="${basedir}/dist"/>
+      <echo message="gcc cltest ${os.arch}" />
+      <exec executable="g++">
+         <arg value="-O3" />
+         <arg value="-g" />
+         <arg value="-fPIC" />
+         <arg value="src/cpp/classtools.cpp" />
+         <arg value="src/cpp/classtoolstest.cpp" />
+         <arg value="-o" />
+         <arg value="${basedir}/clt" />
+      </exec>
+  </target>
+
+
+   <target name="mac_clt" if="use.gcc_mac">
+      <mkdir dir="${basedir}/dist"/>
+      <echo message="gcc clt ${os.arch}" />
+      <exec executable="g++">
+         <arg value="-O3" />
+         <arg value="-g" />
+         <arg value="-fPIC" />
+         <arg value="src/cpp/classtools.cpp" />
+         <arg value="src/cpp/classtoolstest.cpp" />
+         <arg value="-o" />
+         <arg value="${basedir}/clt" />
+      </exec>
+   </target>
+
+   <target name="cltest" depends="check,msvc_cltest,mac_cltest,gcc_cltest" />
+   <target name="clt" depends="check,gcc_clt,mac_clt" />
+</project>
diff --git a/src/aparapi/com.amd.aparapi.jni/build_altera_terasic_ocl.xml b/src/aparapi/com.amd.aparapi.jni/build_altera_terasic_ocl.xml
new file mode 100644
index 0000000000000000000000000000000000000000..71bd115829497c695d54e2e788195af492d50cbb
--- /dev/null
+++ b/src/aparapi/com.amd.aparapi.jni/build_altera_terasic_ocl.xml
@@ -0,0 +1,893 @@
+<?xml version="1.0"?>
+
+<!--
+You should not have to edit this file
+First consider editing the properties in build.properties
+-->
+<project name="com.amd.aparapi.jni" default="build" basedir=".">
+
+   <!-- 
+   DO NOT EDIT BELOW THIS LINE 
+   -->
+   <echo>OS Name:    ${os.name}</echo>
+   <echo>OS Version: ${os.version}</echo>
+   <echo>OS Arch:    ${os.arch}</echo>
+
+   <!--<property name="build.compiler" value="javac1.6"/>-->
+   <!--  <property name="ant.build.javac.source" value="1.6"/>-->
+   <!-- <property name="ant.build.javac.target" value="1.6"/> -->
+
+   <property environment="env" />
+   <!-- we need env.PATH for msvc only -->
+
+   <!-- uncomment this if you want to use mingw! -->
+   <!--<property name="mingw.dir" value="c:\\MinGW"/>-->
+
+   <target name="init">
+      <available property="win32.amd.app.sdk.exists" file="C:/Program Files/AMD APP" type="dir"/>
+
+      <condition property="amd.app.sdk.dir" value="C:/Program Files/AMD APP">
+         <and>
+            <os family="windows" />
+            <isset property="win32.amd.app.sdk.exists" />
+            <not>
+               <isset property="amd.app.sdk.dir" />
+            </not>
+         </and>
+      </condition>
+
+      <available property="win64.amd.app.sdk.exists" file="C:/Program Files (x86)/AMD APP" type="dir"/>
+      <condition property="amd.app.sdk.dir" value="C:/Program Files (x86)/AMD APP">
+         <and>
+            <os family="windows" />
+            <isset property="win64.amd.app.sdk.exists" />
+            <not>
+               <isset property="win32.amd.app.sdk.exists" />
+            </not>
+         </and>
+      </condition>
+
+      <!-- !!! oren change -> detect Altera OpenCL SDK -->
+      <available property="linux.amd.app.sdk.exists" file="${env.ALTERAOCLSDKROOT}" type="dir"/>
+      <condition property="amd.app.sdk.dir" value="${env.ALTERAOCLSDKROOT}">
+         <and>
+            <os family="unix" />
+            <not>
+               <os family="mac" />
+            </not>
+            <isset property="linux.amd.app.sdk.exists" />
+            <not>
+               <isset property="win32.amd.app.sdk.exists" />
+            </not>
+            <not>
+               <isset property="win64.amd.app.sdk.exists" />
+            </not>
+         </and>
+      </condition>
+
+      <echo message=" amd.app.sdk.dir ${amd.app.sdk.dir}"/>
+
+
+      <!-- !!! 11.11.14 oren change -> detect Altera OpenCL SDK Board Package root -->
+      <available property="linux.amd.app.bsp.exists" file="${env.AOCL_BOARD_PACKAGE_ROOT}" type="dir"/>
+      <condition property="amd.app.bsp.dir" value="${env.AOCL_BOARD_PACKAGE_ROOT}">
+         <and>
+            <os family="unix" />
+            <not>
+               <os family="mac" />
+            </not>
+            <isset property="linux.amd.app.bsp.exists" />
+            <not>
+               <isset property="win32.amd.app.sdk.exists" />
+            </not>
+            <not>
+               <isset property="win64.amd.app.sdk.exists" />
+            </not>
+         </and>
+      </condition>
+
+      <echo message=" amd.app.bsp.dir ${amd.app.bsp.dir}"/>
+
+	  <!-- Check for Visual Studio -->
+	  <!-- This needs to be in descending order to properly handle multiple installations -->
+	  
+      <available property="msvc.32.11.0.exists" file="c:/Program Files (x86)/Microsoft Visual Studio 11.0\VC\bin" type="dir"/>
+      <condition property="msvc.dir" value="c:/Program Files (x86)/Microsoft Visual Studio 11.0">
+         <and>
+            <not>
+               <or>
+                  <os arch="x86" />
+                  <os arch="i386" />
+               </or>
+            </not>
+            <os family="windows" />
+            <isset property="msvc.32.11.0.exists" />
+            <not>
+               <isset property="msvc.dir" />
+            </not>
+            <not>
+               <isset property="mingw.dir" />
+            </not>
+         </and>
+      </condition>
+      
+      <available property="msvc.64.10.0.exists" file="c:/Program Files/Microsoft Visual Studio 10.0\vc\bin" type="dir"/>
+      <condition property="msvc.dir" value="c:/Program Files/Microsoft Visual Studio 10.0">
+         <and>
+            <or>
+               <os arch="x86" />
+               <os arch="i386" />
+            </or>
+            <os family="windows" />
+            <isset property="msvc.64.10.0.exists" />
+            <not>
+               <isset property="msvc.dir" />
+            </not>
+            <not>
+               <isset property="mingw.dir" />
+            </not>
+         </and>
+      </condition>
+      
+      <available property="msvc.32.10.0.exists" file="c:/Program Files (x86)/Microsoft Visual Studio 10.0\vc\bin" type="dir"/>
+      <condition property="msvc.dir" value="c:/Program Files (x86)/Microsoft Visual Studio 10.0">
+         <and>
+            <not>
+               <or>
+                  <os arch="x86" />
+                  <os arch="i386" />
+               </or>
+            </not>
+            <os family="windows" />
+            <isset property="msvc.32.10.0.exists" />
+            <not>
+               <isset property="msvc.dir" />
+            </not>
+            <not>
+               <isset property="mingw.dir" />
+            </not>
+         </and>
+      </condition>
+      
+      <available property="msvc.32.9.0.exists" file="c:/Program Files/Microsoft Visual Studio 9.0\vc\bin" type="dir"/>
+      <condition property="msvc.dir" value="c:/Program Files/Microsoft Visual Studio 9.0">
+         <and>
+            <or>
+               <os arch="x86" />
+               <os arch="i386" />
+            </or>
+            <os family="windows" />
+            <isset property="msvc.32.9.0.exists" />
+            <not>
+               <isset property="msvc.dir" />
+            </not>
+            <not>
+               <isset property="mingw.dir" />
+            </not>
+         </and>
+      </condition>
+
+	  <!-- Check for SDKs -->
+	  <!-- This needs to be in descending order to properly handle multiple installations -->
+	  
+      <!-- <available property="msvc.sdk.8.0A.32.exists" file="C:/Program Files (x86)/Microsoft SDKs/Windows/v8.0A" type="dir"/>
+      <condition property="msvc.sdk.dir" value="C:/Program Files (x86)/Microsoft SDKs/Windows/v8.0A">
+         <and>
+            <os family="windows" />
+            <isset property="msvc.sdk.8.0A.32.exists" />
+            <not>
+               <isset property="msvc.sdk.dir" />
+            </not>
+            <not>
+               <isset property="mingw.dir" />
+            </not>
+         </and>
+      </condition>
+      
+      <available property="msvc.sdk.8.0.32.exists" file="C:/Program Files (x86)/Microsoft SDKs/Windows/v8.0" type="dir"/>
+      <condition property="msvc.sdk.dir" value="C:/Program Files (x86)/Microsoft SDKs/Windows/v8.0">
+         <and>
+            <os family="windows" />
+            <isset property="msvc.sdk.8.0.32.exists" />
+            <not>
+               <isset property="msvc.sdk.dir" />
+            </not>
+            <not>
+               <isset property="mingw.dir" />
+            </not>
+         </and>
+      </condition> -->
+      
+      <available property="msvc.sdk.7.1A.exists" file="C:/Program Files/Microsoft SDKs/Windows/v7.1A" type="dir"/>
+      <condition property="msvc.sdk.dir" value="C:/Program Files/Microsoft SDKs/Windows/v7.1A">
+         <and>
+            <os family="windows" />
+            <isset property="msvc.sdk.7.1A.exists" />
+            <not>
+               <isset property="msvc.sdk.dir" />
+            </not>
+            <not>
+               <isset property="mingw.dir" />
+            </not>
+         </and>
+      </condition>
+      
+      <available property="msvc.sdk.7.1A.32.exists" file="C:/Program Files (x86)/Microsoft SDKs/Windows/v7.1A" type="dir"/>
+      <condition property="msvc.sdk.dir" value="C:/Program Files (x86)/Microsoft SDKs/Windows/v7.1A">
+         <and>
+            <os family="windows" />
+            <isset property="msvc.sdk.7.1A.32.exists" />
+            <not>
+               <isset property="msvc.sdk.dir" />
+            </not>
+            <not>
+               <isset property="mingw.dir" />
+            </not>
+         </and>
+      </condition>
+      
+      <available property="msvc.sdk.7.1.exists" file="C:/Program Files/Microsoft SDKs/Windows/v7.1" type="dir"/>
+      <condition property="msvc.sdk.dir" value="C:/Program Files/Microsoft SDKs/Windows/v7.1">
+         <and>
+            <os family="windows" />
+            <isset property="msvc.sdk.7.1.exists" />
+            <not>
+               <isset property="msvc.sdk.dir" />
+            </not>
+            <not>
+               <isset property="mingw.dir" />
+            </not>
+         </and>
+      </condition>
+
+	  <available property="msvc.sdk.7.1.32.exists" file="C:/Program Files (x86)/Microsoft SDKs/Windows/v7.1" type="dir"/>
+      <condition property="msvc.sdk.dir" value="C:/Program Files (x86)/Microsoft SDKs/Windows/v7.1">
+         <and>
+            <os family="windows" />
+            <isset property="msvc.sdk.7.1.32.exists" />
+            <not>
+               <isset property="msvc.sdk.dir" />
+            </not>
+            <not>
+               <isset property="mingw.dir" />
+            </not>
+         </and>
+      </condition>
+
+      <available property="msvc.sdk.7.0A.exists" file="C:/Program Files/Microsoft SDKs/Windows/v7.0A" type="dir"/>
+      <condition property="msvc.sdk.dir" value="C:/Program Files/Microsoft SDKs/Windows/v7.0A">
+         <and>
+            <os family="windows" />
+            <isset property="msvc.sdk.7.0A.exists" />
+            <not>
+               <isset property="msvc.sdk.dir" />
+            </not>
+            <not>
+               <isset property="mingw.dir" />
+            </not>
+         </and>
+      </condition>
+
+      <available property="msvc.sdk.7.0A.32.exists" file="C:/Program Files (x86)/Microsoft SDKs/Windows/v7.0A" type="dir"/>
+      <condition property="msvc.sdk.dir" value="C:/Program Files (x86)/Microsoft SDKs/Windows/v7.0A">
+         <and>
+            <os family="windows" />
+            <isset property="msvc.sdk.7.0A.32.exists" />
+            <not>
+               <isset property="msvc.sdk.dir" />
+            </not>
+            <not>
+               <isset property="mingw.dir" />
+            </not>
+         </and>
+      </condition>
+      
+      <available property="msvc.sdk.7.0.exists" file="C:/Program Files/Microsoft SDKs/Windows/v7.0" type="dir"/>
+      <condition property="msvc.sdk.dir" value="C:/Program Files/Microsoft SDKs/Windows/v7.0">
+         <and>
+            <os family="windows" />
+            <isset property="msvc.sdk.7.0.exists" />
+            <not>
+               <isset property="msvc.sdk.dir" />
+            </not>
+            <not>
+               <isset property="mingw.dir" />
+            </not>
+         </and>
+      </condition>
+
+      <available property="msvc.sdk.6.0A.exists" file="C:/Program Files/Microsoft SDKs/Windows/v6.0A" type="dir"/>
+      <condition property="msvc.sdk.dir" value="C:/Program Files/Microsoft SDKs/Windows/v6.0A">
+         <and>
+            <os family="windows" />
+            <isset property="msvc.sdk.6.0A.exists" />
+            <not>
+               <isset property="msvc.sdk.dir" />
+            </not>
+            <not>
+               <isset property="mingw.dir" />
+            </not>
+         </and>
+      </condition>
+
+      <echo message=" msvc.dir ${msvc.dir}"/>
+      <echo message=" msvc.sdk.dir ${msvc.sdk.dir}"/>
+   </target>
+
+   <target name="check" depends="init">
+
+      <fail message="Error:">
+         <condition>
+            <and>
+               <os family="windows" />
+               <isset property="msvc.dir" />
+               <not>
+                  <isset property="msvc.sdk.dir" />
+               </not>
+            </and>
+         </condition>
+         <![CDATA[
+         You will need to edit com.amd.aparapi.jni/build.properties to compile aparapi JNI code
+
+         At present msvc.dir seems to be Configured but not msvc.sdk.dir
+         ]]>
+      </fail>
+
+      <fail message="Error:">
+         <condition>
+            <and>
+               <os family="windows" />
+               <not>
+                  <isset property="msvc.dir" />
+               </not>
+               <isset property="msvc.sdk.dir" />
+            </and>
+         </condition>
+         <![CDATA[
+         You will need to edit com.amd.aparapi.jni/build.properties to compile aparapi JNI code
+
+         At present msvc.sdk.dir seems to be Configured but not msvc.dir
+         ]]>
+      </fail>
+      <available file="${msvc.dir}" type="dir" property="msvc.dir.exists" />
+      <available file="${msvc.sdk.dir}" type="dir" property="msvc.sdk.dir.exists" />
+
+      <fail message="Error:">
+         <condition>
+            <and>
+               <os family="windows" />
+               <isset property="msvc.dir" />
+               <not>
+                  <isset property="msvc.dir.exists" />
+               </not>
+            </and>
+         </condition>
+         <![CDATA[
+         You will need to edit com.amd.aparapi.jni/build.properties to compile aparapi JNI code
+
+         At present msvc.dir is set (to ${msvc.dir}) but that dir does not exist
+         ]]>
+      </fail>
+      <fail message="Error:">
+         <condition>
+            <and>
+               <os family="windows" />
+               <isset property="msvc.sdk.dir" />
+               <not>
+                  <isset property="msvc.sdk.dir.exists" />
+               </not>
+            </and>
+         </condition>
+         <![CDATA[
+         You will need to edit com.amd.aparapi.jni/build.properties to compile aparapi JNI code
+
+         At present msvc.sdk.dir is set (to ${msvc.sdk.dir}) but that dir does not exist
+         ]]>
+      </fail>
+
+
+      <available file="${mingw.dir}" type="dir" property="mingw.dir.exists" />
+      <fail message="Error:">
+         <condition>
+            <and>
+               <os family="windows" />
+               <isset property="mingw.dir" />
+               <not>
+                  <isset property="mingw.dir.exists" />
+               </not>
+            </and>
+         </condition>
+         <![CDATA[
+         You will need to edit com.amd.aparapi.jni/build.properties to compile aparapi JNI code
+
+         At present mingw.dir is set (to ${mingw.dir}) but that dir does not exist
+         ]]>
+      </fail>
+      <!--<echo message="java.home ${java.home}"/>-->
+      <!--<echo message="msvc.dir.exists ${msvc.dir.exists}"/>-->
+      <!--<echo message="msvc.sdk.dir.exists ${msvc.sdk.dir.exists}"/>-->
+      <!--<echo message="mingw.dir.exists ${mingw.dir.exists}"/>-->
+      <condition property="use.msvc">
+         <and>
+            <os family="windows" />
+            <isset property="msvc.dir.exists" />
+            <isset property="msvc.sdk.dir.exists" />
+         </and>
+      </condition>
+      <!--<echo message="use.msvc ${use.msvc}"/>-->
+
+      <condition property="use.mingw">
+         <and>
+            <os family="windows" />
+            <isset property="mingw.dir.exists" />
+         </and>
+      </condition>
+      <!--<echo message="use.mingw ${use.mingw}"/>-->
+
+      <fail message="Error:">
+         <condition>
+            <and>
+               <isset property="use.mingw" />
+               <isset property="use.msvc" />
+            </and>
+         </condition>
+         <![CDATA[
+         You will need to edit com.amd.aparapi.jni/build.properties to compile aparapi JNI code
+
+         At present ant is Configured for both MinGW AND Microsoft Visual Studio. You need to pick one or the other :) !
+
+         Just comment out the properties for the compiler that you *do not* wish to use.
+         ]]>
+      </fail>
+
+      <fail message="Error:">
+         <condition>
+            <and>
+               <os family="windows" />
+               <not>
+                  <or>
+                     <isset property="use.mingw" />
+                     <isset property="use.msvc" />
+                  </or>
+               </not>
+            </and>
+         </condition>
+         <![CDATA[
+         You will need to edit com.amd.aparapi.jni/build.properties to compile aparapi JNI code
+
+         This looks like a windows machine so you probably need to Configure either:-
+
+         * msvc.dir and msvc.sdk.dir if you wish to use Microsoft Visual Studio compiler
+
+         * mingw.dir if you prefer if you prefer to use MinGW 
+         ]]>
+      </fail>
+
+      <condition property="use.gcc">
+         <and>
+            <os family="unix" />
+            <not>
+               <os family="mac" />
+            </not>
+         </and>
+      </condition>
+
+      <condition property="use.gcc_mac">
+         <os family="mac" />
+      </condition>
+
+      <condition property="x86_or_x86_64" value="x86" else="x86_64">
+         <or>
+            <os arch="x86" />
+            <os arch="i386" />
+         </or>
+      </condition>
+
+      <condition property="optional.amd64.subdir" value="" else="amd64\">
+         <or>
+            <os arch="x86" />
+            <os arch="i386" />
+         </or>
+      </condition>
+
+      <condition property="optional.x64.subdir" value="" else="x64\">
+         <or>
+            <os arch="x86" />
+            <os arch="i386" />
+         </or>
+      </condition>
+
+
+      <available file="${msvc.dir}\vc\bin\${optional.amd64.subdir}cl.exe" type="file" property="cl.exists" />
+
+      <fail message="Error:">
+         <condition>
+            <and>
+               <isset property="use.msvc" />
+               <not>
+                  <isset property="cl.exists" />
+               </not>
+            </and>
+         </condition>
+         <![CDATA[
+         You will need to edit com.amd.aparapi.jni/build.properties to compile aparapi JNI code
+
+         Could not find vc\bin\${optional.amd64.subdir}cl under Configured msvc.dir. Check if msvc.dir is pointing
+         to a valid visual studio installation
+         ]]>
+      </fail>
+
+      <fail message="Error:">
+         <condition>
+            <and>
+               <not>
+                  <os family="mac" />
+               </not>
+               <not>
+                  <isset property="amd.app.sdk.dir" />
+               </not>
+            </and>
+         </condition>
+         <![CDATA[
+         You will need to edit com.amd.aparapi.jni/build.properties to compile aparapi JNI code
+
+         You need to set amd.app.sdk.dir to point to the location where AMD APP SDK is installed
+         ]]>
+      </fail>
+      <available file="${amd.app.sdk.dir}" type="dir" property="amd.app.sdk.dir.exists" />
+
+      <fail message="Error:">
+         <condition>
+            <and>
+               <not>
+                  <os family="mac" />
+               </not>
+               <not>
+                  <isset property="amd.app.sdk.dir.exists" />
+               </not>
+            </and>
+         </condition>
+         <![CDATA[
+         You will need to edit com.amd.aparapi.jni/build.properties to compile aparapi JNI code
+
+         At present amd.app.sdk.dir is set (to ${amd.app.sdk.dir}) but that dir does not exist
+         ]]>
+      </fail>
+   </target>
+
+   <target name="clean" depends="check">
+      <delete dir="include" />
+      <delete dir="${basedir}/dist" />
+      <!-- Legacy cleanup -->
+      <delete file="libaparapi_${x86_or_x86_64}.dylib" />
+      <delete file="libaparapi_${x86_or_x86_64}.so" />
+      <delete file="aparapi_${x86_or_x86_64}.dll" />
+      <delete file="aparapi.dll" />
+      <delete file="aparapi.obj" />
+      <delete file="aparapi.o" />
+      <delete file="aparapi.lib" />
+      <delete file="aparapi.exp" />
+      <delete file="OpenCLJNI.obj" />
+      <delete file="OpenCLJNI.o" />
+      <delete file="Config.obj" />
+      <delete file="Config.o" />
+      <delete file="ProfileInfo.obj" />
+      <delete file="ProfileInfo.o" />
+      <delete file="ArrayBuffer.obj" />
+      <delete file="ArrayBuffer.o" />
+      <delete file="AparapiBuffer.obj" />
+      <delete file="AparapiBuffer.o" />
+      <delete file="JNIHelper.obj" />
+      <delete file="JNIHelper.o" />
+      <delete file="CLHelper.obj" />
+      <delete file="CLHelper.o" />
+      <delete file="JNIContext.obj" />
+      <delete file="JNIContext.o" />
+      <delete file="KernelArg.obj" />
+      <delete file="KernelArg.o" />
+      <delete file="Range.obj" />
+      <delete file="Range.o" />
+      <delete file="OpenCLArgDescriptor.obj" />
+      <delete file="OpenCLArgDescriptor.o" />
+      <delete file="agent.obj" />
+      <delete file="agent.o" />
+      <delete file="classtools.obj" />
+      <delete file="classtools.o" />
+      <delete file="OpenCLMem.obj" />
+      <delete file="OpenCLMem.o" />
+   </target>
+
+   <target name="javah">
+      <mkdir dir="include" />
+      <javah classpath="..\com.amd.aparapi\classes" destdir="include" force="true">
+         <class name="com.amd.aparapi.internal.jni.ConfigJNI" />
+         <class name="com.amd.aparapi.internal.jni.KernelArgJNI" />
+         <class name="com.amd.aparapi.internal.jni.KernelRunnerJNI" />
+         <class name="com.amd.aparapi.internal.jni.OpenCLJNI" />
+         <class name="com.amd.aparapi.internal.jni.RangeJNI" />
+         <!-- Non-Native Classes -->
+         <class name="com.amd.aparapi.Kernel"/>
+         <class name="com.amd.aparapi.Range"/>
+         <class name="com.amd.aparapi.Config" />
+         <class name="com.amd.aparapi.device.Device" />
+         <class name="com.amd.aparapi.device.OpenCLDevice" />
+         <class name="com.amd.aparapi.internal.kernel.KernelRunner"/>
+         <class name="com.amd.aparapi.internal.opencl.OpenCLArgDescriptor" />
+         <class name="com.amd.aparapi.internal.opencl.OpenCLMem" />
+      </javah>
+   </target>
+
+
+   <target name="gcc" if="use.gcc">
+      <mkdir dir="${basedir}/dist"/>
+      <echo message="linuxcc ${os.arch}" />
+      <exec executable="g++">
+        <!-- !!! oren change -> add debug info, no optimizations 
+         <arg value="-O3" />
+         <arg value="-O0" />
+        -->
+         <arg value="-O3" />
+         <arg value="-g" />
+         <arg value="-fPIC" />
+         <arg value="-DCL_USE_DEPRECATED_OPENCL_1_1_APIS"/>
+         <arg value="-DALTERA_OPENCL"/>
+         <arg value="-I${java.home}/../include" />
+         <arg value="-I${java.home}/../include/linux" />
+         <arg value="-Iinclude" />
+         <arg value="-I${amd.app.sdk.dir}/host/include" />
+         <arg value="-Isrc/cpp" />
+         <arg value="-Isrc/cpp/runKernel" />
+         <arg value="-Isrc/cpp/invoke" />
+         <arg value="-shared" />
+         <arg value="-o"/> 
+         <arg value="${basedir}/dist/libaparapi_${x86_or_x86_64}.so" />
+         <arg value="src/cpp/runKernel/Aparapi.cpp" />
+         <arg value="src/cpp/runKernel/ArrayBuffer.cpp" />
+         <arg value="src/cpp/runKernel/AparapiBuffer.cpp" />
+         <arg value="src/cpp/runKernel/Config.cpp" />
+         <arg value="src/cpp/runKernel/JNIContext.cpp" />
+         <arg value="src/cpp/runKernel/KernelArg.cpp" />
+         <arg value="src/cpp/runKernel/ProfileInfo.cpp" />
+         <arg value="src/cpp/runKernel/Range.cpp" />
+         <arg value="src/cpp/invoke/OpenCLJNI.cpp" />
+         <arg value="src/cpp/invoke/OpenCLArgDescriptor.cpp" />
+         <arg value="src/cpp/invoke/OpenCLMem.cpp" />
+         <arg value="src/cpp/CLHelper.cpp" />
+         <arg value="src/cpp/classtools.cpp" />
+         <arg value="src/cpp/JNIHelper.cpp" />
+         <arg value="src/cpp/agent.cpp" />
+         <!--  11.1.14 Nallatch old -> <arg value="-L${amd.app.sdk.dir}/linux64/lib" /> -->
+         <arg value="-L${amd.app.bsp.dir}/linux64/lib" />
+         <arg value="-L${amd.app.sdk.dir}/host/linux64/lib" />
+         <arg value="-lalterahalmmd" />
+         <!--  11.1.14 Nallatch old -> <arg value="-lalterammdpcie" /> -->
+         <arg value="-laltera_apb_14_0_mmd" />
+         <!--  11.1.14 Nallatch old -><arg value="-lpkg_editor" /> -->
+         <arg value="-lalteracl" />
+         <arg value="-lelf" />
+         <arg value="-lrt" />
+         <arg value="-lstdc++" />
+      </exec>
+   </target>
+
+   <target name="gcc_mac" if="use.gcc_mac">
+      <mkdir dir="${basedir}/dist"/>
+      <echo message="gcc ${os.arch}" />
+      <exec executable="g++">
+         <arg value="-O3" />
+         <arg value="-g" />
+         <arg value="-fPIC" />
+         <!-- <arg value="-fopenmp"/> -->
+         <arg value="-DCL_USE_DEPRECATED_OPENCL_1_1_APIS"/>
+         <arg value="-I/System/Library/Frameworks/JavaVM.framework/Headers" />
+         <arg value="-Iinclude" />
+         <arg value="-Isrc/cpp" />
+         <arg value="-Isrc/cpp/runKernel" />
+         <arg value="-Isrc/cpp/invoke" />
+         <arg value="-shared" />
+         <arg value="-o" />
+         <arg value="${basedir}/dist/libaparapi_${x86_or_x86_64}.dylib" />
+         <arg value="src/cpp/runKernel/Aparapi.cpp" />
+         <arg value="src/cpp/runKernel/ArrayBuffer.cpp" />
+         <arg value="src/cpp/runKernel/AparapiBuffer.cpp" />
+         <arg value="src/cpp/runKernel/Config.cpp" />
+         <arg value="src/cpp/runKernel/JNIContext.cpp" />
+         <arg value="src/cpp/runKernel/KernelArg.cpp" />
+         <arg value="src/cpp/runKernel/ProfileInfo.cpp" />
+         <arg value="src/cpp/runKernel/Range.cpp" />
+         <arg value="src/cpp/invoke/OpenCLJNI.cpp" />
+         <arg value="src/cpp/invoke/OpenCLArgDescriptor.cpp" />
+         <arg value="src/cpp/invoke/OpenCLMem.cpp" />
+         <arg value="src/cpp/CLHelper.cpp" />
+         <arg value="src/cpp/classtools.cpp" />
+         <arg value="src/cpp/JNIHelper.cpp" />
+         <arg value="src/cpp/agent.cpp" />
+         <arg value="-framework" />
+         <arg value="OpenCL" />
+         <arg value="-Wno-write-strings" />
+      </exec>
+   </target>
+
+   <target name="msvc" if="use.msvc">
+      <mkdir dir="${basedir}\dist"/>
+      <echo message="msvc ${os.arch}" />
+      <exec executable="${msvc.dir}\vc\bin\${optional.amd64.subdir}cl.exe">
+         <env key="PATH" path="${env.PATH};${msvc.dir}\\Common7\\IDE" />
+         <arg value="/nologo" />
+         <arg value="/TP" />
+         <arg value="/Ox" />
+         <!-- <arg value="/openmp" /> -->
+         <arg value="-DCL_USE_DEPRECATED_OPENCL_1_1_APIS"/>
+         <arg value="/EHsc" />
+         <arg value="/I${msvc.dir}\vc\include" />
+         <arg value="/I${msvc.sdk.dir}\include" />
+         <arg value="/I${java.home}\..\include" />
+         <arg value="/I${java.home}\..\include\win32" />
+         <arg value="/Iinclude" />
+         <arg value="/I${amd.app.sdk.dir}\include" />
+         <arg value="/Isrc/cpp" />
+         <arg value="/Isrc/cpp/runKernel" />
+         <arg value="/Isrc/cpp/invoke" />
+         <arg value="src/cpp/runKernel/Aparapi.cpp" />
+         <arg value="src/cpp/runKernel/ArrayBuffer.cpp" />
+         <arg value="src/cpp/runKernel/AparapiBuffer.cpp" />
+         <arg value="src/cpp/runKernel/Config.cpp" />
+         <arg value="src/cpp/runKernel/JNIContext.cpp" />
+         <arg value="src/cpp/runKernel/KernelArg.cpp" />
+         <arg value="src/cpp/runKernel/ProfileInfo.cpp" />
+         <arg value="src/cpp/runKernel/Range.cpp" />
+         <arg value="src/cpp/invoke/OpenCLJNI.cpp" />
+         <arg value="src/cpp/invoke/OpenCLArgDescriptor.cpp" />
+         <arg value="src/cpp/invoke/OpenCLMem.cpp" />
+         <arg value="src/cpp/CLHelper.cpp" />
+         <arg value="src/cpp/classtools.cpp" />
+         <arg value="src/cpp/JNIHelper.cpp" />
+         <arg value="src/cpp/agent.cpp" />
+         <arg value="/LD" />
+         <arg value="/link" />
+         <arg value="/libpath:${msvc.dir}\vc\lib\${optional.amd64.subdir}" />
+         <arg value="/libpath:${msvc.sdk.dir}\lib\${optional.x64.subdir}" />
+         <arg value="/libpath:${amd.app.sdk.dir}\lib\${x86_or_x86_64}" />
+         <arg value="OpenCL.lib" />
+         <arg value="/out:${basedir}\dist\aparapi_${x86_or_x86_64}.dll" />
+      </exec>
+   </target>
+
+   <target name="mingw" if="use.mingw">
+      <mkdir dir="${basedir}\dist"/>
+      <echo message="mingw ${os.arch}" /> 
+      <exec executable="${mingw.dir}/bin/g++">
+         <env key="PATH" path="${env.PATH};${mingw.dir}/bin" />
+         <arg value="-Wall" />
+         <arg value="-O3" />
+         <arg value="-Wl,--kill-at" />
+         <arg value="-DCL_USE_DEPRECATED_OPENCL_1_1_APIS"/>
+         <arg value="-I${java.home}\..\include" />
+         <arg value="-I${java.home}\..\include\win32" />
+         <arg value="-Iinclude" />
+         <arg value="-I${amd.app.sdk.dir}\include" />
+         <arg value="-Isrc/cpp" />
+         <arg value="-Isrc/cpp/runKernel" />
+         <arg value="-Isrc/cpp/invoke" />
+         <arg value="-shared" />
+         <arg value="-o" />
+         <arg value="${basedir}\dist\aparapi_${x86_or_x86_64}.dll" />
+         <arg value="src/cpp/runKernel/Aparapi.cpp" />
+         <arg value="src/cpp/runKernel/ArrayBuffer.cpp" />
+         <arg value="src/cpp/runKernel/AparapiBuffer.cpp" />
+         <arg value="src/cpp/runKernel/Config.cpp" />
+         <arg value="src/cpp/runKernel/JNIContext.cpp" />
+         <arg value="src/cpp/runKernel/KernelArg.cpp" />
+         <arg value="src/cpp/runKernel/ProfileInfo.cpp" />
+         <arg value="src/cpp/runKernel/Range.cpp" />
+         <arg value="src/cpp/invoke/OpenCLJNI.cpp" />
+         <arg value="src/cpp/invoke/OpenCLArgDescriptor.cpp" />
+         <arg value="src/cpp/invoke/OpenCLMem.cpp" />
+         <arg value="src/cpp/CLHelper.cpp" />
+         <arg value="src/cpp/classtools.cpp" />
+         <arg value="src/cpp/JNIHelper.cpp" />
+         <arg value="src/cpp/agent.cpp" />
+         <arg value="-L${amd.app.sdk.dir}\lib\${x86_or_x86_64}" />
+         <arg value="-lOpenCL" />
+      </exec>
+   </target>
+
+   <target name="build" depends="clean, javah, msvc, mingw, gcc, gcc_mac" />
+
+   <target name="msvc_cltest" if="use.msvc">
+      <mkdir dir="${basedir}\dist"/>
+      <echo message="msvc_cltest ${os.arch}" />
+      <exec executable="${msvc.dir}\vc\bin\${optional.amd64.subdir}cl.exe">
+         <env key="PATH" path="${env.PATH};${msvc.dir}\\Common7\\IDE" />
+         <arg value="/nologo" />
+         <arg value="/TP" />
+         <arg value="/Ox" />
+         <arg value="-DCL_USE_DEPRECATED_OPENCL_1_1_APIS"/>
+         <arg value="/I${msvc.dir}\vc\include" />
+         <arg value="/I${msvc.sdk.dir}\include" />
+         <arg value="/I${amd.app.sdk.dir}\include" />
+         <arg value="/Isrc/cpp" />
+         <arg value="/Isrc/cpp/runKernel" />
+         <arg value="/Isrc/cpp/invoke" />
+         <arg value="src\cpp\CLTest.cpp" />
+         <arg value="/link" />
+         <arg value="/libpath:${msvc.dir}\vc\lib\${optional.amd64.subdir}" />
+         <arg value="/libpath:${msvc.sdk.dir}\lib\${optional.x64.subdir}" />
+         <arg value="/libpath:${amd.app.sdk.dir}\lib\${x86_or_x86_64}" />
+         <arg value="OpenCL.lib" />
+         <arg value="/out:${basedir}/dist/cltest_${x86_or_x86_64}.exe" />
+      </exec>
+   </target>
+
+   <target name="mac_cltest" if="use.gcc_mac">
+      <mkdir dir="${basedir}/dist"/>
+      <echo message="gcc cltest ${os.arch}" />
+      <exec executable="g++">
+         <arg value="-O3" />
+         <arg value="-g" />
+         <arg value="-fPIC" />
+         <arg value="-DCL_USE_DEPRECATED_OPENCL_1_1_APIS"/>
+         <arg value="-I/System/Library/Frameworks/JavaVM.framework/Headers" />
+         <arg value="-Iinclude" />
+         <arg value="-Isrc/cpp" />
+         <arg value="-Isrc/cpp/runKernel" />
+         <arg value="-Isrc/cpp/invoke" />
+         <arg value="-o" />
+         <arg value="${basedir}/dist/cltest" />
+         <arg value="src/cpp/CLTest.cpp" />
+         <arg value="-framework" />
+         <arg value="OpenCL" />
+      </exec>
+   </target>
+
+   <target name="gcc_cltest" if="use.gcc">
+      <mkdir dir="${basedir}/dist"/>
+      <echo message="gcc cltest ${os.arch}" />
+      <exec executable="g++">
+         <arg value="-O3" />
+         <arg value="-g" />
+         <arg value="-fPIC" />
+         <arg value="-DCL_USE_DEPRECATED_OPENCL_1_1_APIS"/>
+         <arg value="-I${java.home}/../include" />
+         <arg value="-I${java.home}/../include/linux" />
+         <arg value="-I${amd.app.sdk.dir}/include" />
+         <arg value="src/cpp/cltest.cpp" />
+         <arg value="-L${amd.app.sdk.dir}/lib/${x86_or_x86_64}" />
+         <arg value="-lOpenCL" />
+         <arg value="-o" />
+         <arg value="${basedir}/cltest_${x86_or_x86_64}" />
+      </exec>
+  </target>
+
+   <target name="gcc_clt" if="use.gcc">
+      <mkdir dir="${basedir}/dist"/>
+      <echo message="gcc cltest ${os.arch}" />
+      <exec executable="g++">
+         <arg value="-O3" />
+         <arg value="-g" />
+         <arg value="-fPIC" />
+         <arg value="src/cpp/classtools.cpp" />
+         <arg value="src/cpp/classtoolstest.cpp" />
+         <arg value="-o" />
+         <arg value="${basedir}/clt" />
+      </exec>
+  </target>
+
+
+   <target name="mac_clt" if="use.gcc_mac">
+      <mkdir dir="${basedir}/dist"/>
+      <echo message="gcc clt ${os.arch}" />
+      <exec executable="g++">
+         <arg value="-O3" />
+         <arg value="-g" />
+         <arg value="-fPIC" />
+         <arg value="src/cpp/classtools.cpp" />
+         <arg value="src/cpp/classtoolstest.cpp" />
+         <arg value="-o" />
+         <arg value="${basedir}/clt" />
+      </exec>
+   </target>
+
+   <target name="cltest" depends="check,msvc_cltest,mac_cltest,gcc_cltest" />
+   <target name="clt" depends="check,gcc_clt,mac_clt" />
+</project>
diff --git a/src/aparapi/com.amd.aparapi.jni/build_intel_ocl.xml b/src/aparapi/com.amd.aparapi.jni/build_intel_ocl.xml
new file mode 100644
index 0000000000000000000000000000000000000000..65ba29b88c581555865274a249520ba1d965af95
--- /dev/null
+++ b/src/aparapi/com.amd.aparapi.jni/build_intel_ocl.xml
@@ -0,0 +1,860 @@
+<?xml version="1.0"?>
+
+<!--
+You should not have to edit this file
+First consider editing the properties in build.properties
+-->
+<project name="com.amd.aparapi.jni" default="build" basedir=".">
+
+   <!-- 
+   DO NOT EDIT BELOW THIS LINE 
+   -->
+   <echo>OS Name:    ${os.name}</echo>
+   <echo>OS Version: ${os.version}</echo>
+   <echo>OS Arch:    ${os.arch}</echo>
+
+   <!--<property name="build.compiler" value="javac1.6"/>-->
+   <!--  <property name="ant.build.javac.source" value="1.6"/>-->
+   <!-- <property name="ant.build.javac.target" value="1.6"/> -->
+
+   <property environment="env" />
+   <!-- we need env.PATH for msvc only -->
+
+   <!-- uncomment this if you want to use mingw! -->
+   <!--<property name="mingw.dir" value="c:\\MinGW"/>-->
+
+   <target name="init">
+      <available property="win32.amd.app.sdk.exists" file="C:/Program Files/AMD APP" type="dir"/>
+
+      <condition property="amd.app.sdk.dir" value="C:/Program Files/AMD APP">
+         <and>
+            <os family="windows" />
+            <isset property="win32.amd.app.sdk.exists" />
+            <not>
+               <isset property="amd.app.sdk.dir" />
+            </not>
+         </and>
+      </condition>
+
+      <available property="win64.amd.app.sdk.exists" file="C:/Program Files (x86)/AMD APP" type="dir"/>
+      <condition property="amd.app.sdk.dir" value="C:/Program Files (x86)/AMD APP">
+         <and>
+            <os family="windows" />
+            <isset property="win64.amd.app.sdk.exists" />
+            <not>
+               <isset property="win32.amd.app.sdk.exists" />
+            </not>
+         </and>
+      </condition>
+
+      <available property="linux.amd.app.sdk.exists" file="/opt/intel/opencl" type="dir"/>
+      <condition property="amd.app.sdk.dir" value="/opt/intel/opencl">
+         <and>
+            <os family="unix" />
+            <not>
+               <os family="mac" />
+            </not>
+            <isset property="linux.amd.app.sdk.exists" />
+            <not>
+               <isset property="win32.amd.app.sdk.exists" />
+            </not>
+            <not>
+               <isset property="win64.amd.app.sdk.exists" />
+            </not>
+         </and>
+      </condition>
+
+      <echo message=" amd.app.sdk.dir ${amd.app.sdk.dir}"/>
+
+	  <!-- Check for Visual Studio -->
+	  <!-- This needs to be in descending order to properly handle multiple installations -->
+	  
+      <available property="msvc.32.11.0.exists" file="c:/Program Files (x86)/Microsoft Visual Studio 11.0\VC\bin" type="dir"/>
+      <condition property="msvc.dir" value="c:/Program Files (x86)/Microsoft Visual Studio 11.0">
+         <and>
+            <not>
+               <or>
+                  <os arch="x86" />
+                  <os arch="i386" />
+               </or>
+            </not>
+            <os family="windows" />
+            <isset property="msvc.32.11.0.exists" />
+            <not>
+               <isset property="msvc.dir" />
+            </not>
+            <not>
+               <isset property="mingw.dir" />
+            </not>
+         </and>
+      </condition>
+      
+      <available property="msvc.64.10.0.exists" file="c:/Program Files/Microsoft Visual Studio 10.0\vc\bin" type="dir"/>
+      <condition property="msvc.dir" value="c:/Program Files/Microsoft Visual Studio 10.0">
+         <and>
+            <or>
+               <os arch="x86" />
+               <os arch="i386" />
+            </or>
+            <os family="windows" />
+            <isset property="msvc.64.10.0.exists" />
+            <not>
+               <isset property="msvc.dir" />
+            </not>
+            <not>
+               <isset property="mingw.dir" />
+            </not>
+         </and>
+      </condition>
+      
+      <available property="msvc.32.10.0.exists" file="c:/Program Files (x86)/Microsoft Visual Studio 10.0\vc\bin" type="dir"/>
+      <condition property="msvc.dir" value="c:/Program Files (x86)/Microsoft Visual Studio 10.0">
+         <and>
+            <not>
+               <or>
+                  <os arch="x86" />
+                  <os arch="i386" />
+               </or>
+            </not>
+            <os family="windows" />
+            <isset property="msvc.32.10.0.exists" />
+            <not>
+               <isset property="msvc.dir" />
+            </not>
+            <not>
+               <isset property="mingw.dir" />
+            </not>
+         </and>
+      </condition>
+      
+      <available property="msvc.32.9.0.exists" file="c:/Program Files/Microsoft Visual Studio 9.0\vc\bin" type="dir"/>
+      <condition property="msvc.dir" value="c:/Program Files/Microsoft Visual Studio 9.0">
+         <and>
+            <or>
+               <os arch="x86" />
+               <os arch="i386" />
+            </or>
+            <os family="windows" />
+            <isset property="msvc.32.9.0.exists" />
+            <not>
+               <isset property="msvc.dir" />
+            </not>
+            <not>
+               <isset property="mingw.dir" />
+            </not>
+         </and>
+      </condition>
+
+	  <!-- Check for SDKs -->
+	  <!-- This needs to be in descending order to properly handle multiple installations -->
+	  
+      <!-- <available property="msvc.sdk.8.0A.32.exists" file="C:/Program Files (x86)/Microsoft SDKs/Windows/v8.0A" type="dir"/>
+      <condition property="msvc.sdk.dir" value="C:/Program Files (x86)/Microsoft SDKs/Windows/v8.0A">
+         <and>
+            <os family="windows" />
+            <isset property="msvc.sdk.8.0A.32.exists" />
+            <not>
+               <isset property="msvc.sdk.dir" />
+            </not>
+            <not>
+               <isset property="mingw.dir" />
+            </not>
+         </and>
+      </condition>
+      
+      <available property="msvc.sdk.8.0.32.exists" file="C:/Program Files (x86)/Microsoft SDKs/Windows/v8.0" type="dir"/>
+      <condition property="msvc.sdk.dir" value="C:/Program Files (x86)/Microsoft SDKs/Windows/v8.0">
+         <and>
+            <os family="windows" />
+            <isset property="msvc.sdk.8.0.32.exists" />
+            <not>
+               <isset property="msvc.sdk.dir" />
+            </not>
+            <not>
+               <isset property="mingw.dir" />
+            </not>
+         </and>
+      </condition> -->
+      
+      <available property="msvc.sdk.7.1A.exists" file="C:/Program Files/Microsoft SDKs/Windows/v7.1A" type="dir"/>
+      <condition property="msvc.sdk.dir" value="C:/Program Files/Microsoft SDKs/Windows/v7.1A">
+         <and>
+            <os family="windows" />
+            <isset property="msvc.sdk.7.1A.exists" />
+            <not>
+               <isset property="msvc.sdk.dir" />
+            </not>
+            <not>
+               <isset property="mingw.dir" />
+            </not>
+         </and>
+      </condition>
+      
+      <available property="msvc.sdk.7.1A.32.exists" file="C:/Program Files (x86)/Microsoft SDKs/Windows/v7.1A" type="dir"/>
+      <condition property="msvc.sdk.dir" value="C:/Program Files (x86)/Microsoft SDKs/Windows/v7.1A">
+         <and>
+            <os family="windows" />
+            <isset property="msvc.sdk.7.1A.32.exists" />
+            <not>
+               <isset property="msvc.sdk.dir" />
+            </not>
+            <not>
+               <isset property="mingw.dir" />
+            </not>
+         </and>
+      </condition>
+      
+      <available property="msvc.sdk.7.1.exists" file="C:/Program Files/Microsoft SDKs/Windows/v7.1" type="dir"/>
+      <condition property="msvc.sdk.dir" value="C:/Program Files/Microsoft SDKs/Windows/v7.1">
+         <and>
+            <os family="windows" />
+            <isset property="msvc.sdk.7.1.exists" />
+            <not>
+               <isset property="msvc.sdk.dir" />
+            </not>
+            <not>
+               <isset property="mingw.dir" />
+            </not>
+         </and>
+      </condition>
+
+	  <available property="msvc.sdk.7.1.32.exists" file="C:/Program Files (x86)/Microsoft SDKs/Windows/v7.1" type="dir"/>
+      <condition property="msvc.sdk.dir" value="C:/Program Files (x86)/Microsoft SDKs/Windows/v7.1">
+         <and>
+            <os family="windows" />
+            <isset property="msvc.sdk.7.1.32.exists" />
+            <not>
+               <isset property="msvc.sdk.dir" />
+            </not>
+            <not>
+               <isset property="mingw.dir" />
+            </not>
+         </and>
+      </condition>
+
+      <available property="msvc.sdk.7.0A.exists" file="C:/Program Files/Microsoft SDKs/Windows/v7.0A" type="dir"/>
+      <condition property="msvc.sdk.dir" value="C:/Program Files/Microsoft SDKs/Windows/v7.0A">
+         <and>
+            <os family="windows" />
+            <isset property="msvc.sdk.7.0A.exists" />
+            <not>
+               <isset property="msvc.sdk.dir" />
+            </not>
+            <not>
+               <isset property="mingw.dir" />
+            </not>
+         </and>
+      </condition>
+
+      <available property="msvc.sdk.7.0A.32.exists" file="C:/Program Files (x86)/Microsoft SDKs/Windows/v7.0A" type="dir"/>
+      <condition property="msvc.sdk.dir" value="C:/Program Files (x86)/Microsoft SDKs/Windows/v7.0A">
+         <and>
+            <os family="windows" />
+            <isset property="msvc.sdk.7.0A.32.exists" />
+            <not>
+               <isset property="msvc.sdk.dir" />
+            </not>
+            <not>
+               <isset property="mingw.dir" />
+            </not>
+         </and>
+      </condition>
+      
+      <available property="msvc.sdk.7.0.exists" file="C:/Program Files/Microsoft SDKs/Windows/v7.0" type="dir"/>
+      <condition property="msvc.sdk.dir" value="C:/Program Files/Microsoft SDKs/Windows/v7.0">
+         <and>
+            <os family="windows" />
+            <isset property="msvc.sdk.7.0.exists" />
+            <not>
+               <isset property="msvc.sdk.dir" />
+            </not>
+            <not>
+               <isset property="mingw.dir" />
+            </not>
+         </and>
+      </condition>
+
+      <available property="msvc.sdk.6.0A.exists" file="C:/Program Files/Microsoft SDKs/Windows/v6.0A" type="dir"/>
+      <condition property="msvc.sdk.dir" value="C:/Program Files/Microsoft SDKs/Windows/v6.0A">
+         <and>
+            <os family="windows" />
+            <isset property="msvc.sdk.6.0A.exists" />
+            <not>
+               <isset property="msvc.sdk.dir" />
+            </not>
+            <not>
+               <isset property="mingw.dir" />
+            </not>
+         </and>
+      </condition>
+
+      <echo message=" msvc.dir ${msvc.dir}"/>
+      <echo message=" msvc.sdk.dir ${msvc.sdk.dir}"/>
+   </target>
+
+   <target name="check" depends="init">
+
+      <fail message="Error:">
+         <condition>
+            <and>
+               <os family="windows" />
+               <isset property="msvc.dir" />
+               <not>
+                  <isset property="msvc.sdk.dir" />
+               </not>
+            </and>
+         </condition>
+         <![CDATA[
+         You will need to edit com.amd.aparapi.jni/build.properties to compile aparapi JNI code
+
+         At present msvc.dir seems to be Configured but not msvc.sdk.dir
+         ]]>
+      </fail>
+
+      <fail message="Error:">
+         <condition>
+            <and>
+               <os family="windows" />
+               <not>
+                  <isset property="msvc.dir" />
+               </not>
+               <isset property="msvc.sdk.dir" />
+            </and>
+         </condition>
+         <![CDATA[
+         You will need to edit com.amd.aparapi.jni/build.properties to compile aparapi JNI code
+
+         At present msvc.sdk.dir seems to be Configured but not msvc.dir
+         ]]>
+      </fail>
+      <available file="${msvc.dir}" type="dir" property="msvc.dir.exists" />
+      <available file="${msvc.sdk.dir}" type="dir" property="msvc.sdk.dir.exists" />
+
+      <fail message="Error:">
+         <condition>
+            <and>
+               <os family="windows" />
+               <isset property="msvc.dir" />
+               <not>
+                  <isset property="msvc.dir.exists" />
+               </not>
+            </and>
+         </condition>
+         <![CDATA[
+         You will need to edit com.amd.aparapi.jni/build.properties to compile aparapi JNI code
+
+         At present msvc.dir is set (to ${msvc.dir}) but that dir does not exist
+         ]]>
+      </fail>
+      <fail message="Error:">
+         <condition>
+            <and>
+               <os family="windows" />
+               <isset property="msvc.sdk.dir" />
+               <not>
+                  <isset property="msvc.sdk.dir.exists" />
+               </not>
+            </and>
+         </condition>
+         <![CDATA[
+         You will need to edit com.amd.aparapi.jni/build.properties to compile aparapi JNI code
+
+         At present msvc.sdk.dir is set (to ${msvc.sdk.dir}) but that dir does not exist
+         ]]>
+      </fail>
+
+
+      <available file="${mingw.dir}" type="dir" property="mingw.dir.exists" />
+      <fail message="Error:">
+         <condition>
+            <and>
+               <os family="windows" />
+               <isset property="mingw.dir" />
+               <not>
+                  <isset property="mingw.dir.exists" />
+               </not>
+            </and>
+         </condition>
+         <![CDATA[
+         You will need to edit com.amd.aparapi.jni/build.properties to compile aparapi JNI code
+
+         At present mingw.dir is set (to ${mingw.dir}) but that dir does not exist
+         ]]>
+      </fail>
+      <!--<echo message="java.home ${java.home}"/>-->
+      <!--<echo message="msvc.dir.exists ${msvc.dir.exists}"/>-->
+      <!--<echo message="msvc.sdk.dir.exists ${msvc.sdk.dir.exists}"/>-->
+      <!--<echo message="mingw.dir.exists ${mingw.dir.exists}"/>-->
+      <condition property="use.msvc">
+         <and>
+            <os family="windows" />
+            <isset property="msvc.dir.exists" />
+            <isset property="msvc.sdk.dir.exists" />
+         </and>
+      </condition>
+      <!--<echo message="use.msvc ${use.msvc}"/>-->
+
+      <condition property="use.mingw">
+         <and>
+            <os family="windows" />
+            <isset property="mingw.dir.exists" />
+         </and>
+      </condition>
+      <!--<echo message="use.mingw ${use.mingw}"/>-->
+
+      <fail message="Error:">
+         <condition>
+            <and>
+               <isset property="use.mingw" />
+               <isset property="use.msvc" />
+            </and>
+         </condition>
+         <![CDATA[
+         You will need to edit com.amd.aparapi.jni/build.properties to compile aparapi JNI code
+
+         At present ant is Configured for both MinGW AND Microsoft Visual Studio. You need to pick one or the other :) !
+
+         Just comment out the properties for the compiler that you *do not* wish to use.
+         ]]>
+      </fail>
+
+      <fail message="Error:">
+         <condition>
+            <and>
+               <os family="windows" />
+               <not>
+                  <or>
+                     <isset property="use.mingw" />
+                     <isset property="use.msvc" />
+                  </or>
+               </not>
+            </and>
+         </condition>
+         <![CDATA[
+         You will need to edit com.amd.aparapi.jni/build.properties to compile aparapi JNI code
+
+         This looks like a windows machine so you probably need to Configure either:-
+
+         * msvc.dir and msvc.sdk.dir if you wish to use Microsoft Visual Studio compiler
+
+         * mingw.dir if you prefer if you prefer to use MinGW 
+         ]]>
+      </fail>
+
+      <condition property="use.gcc">
+         <and>
+            <os family="unix" />
+            <not>
+               <os family="mac" />
+            </not>
+         </and>
+      </condition>
+
+      <condition property="use.gcc_mac">
+         <os family="mac" />
+      </condition>
+
+      <condition property="x86_or_x86_64" value="x86" else="x86_64">
+         <or>
+            <os arch="x86" />
+            <os arch="i386" />
+         </or>
+      </condition>
+
+      <condition property="optional.amd64.subdir" value="" else="amd64\">
+         <or>
+            <os arch="x86" />
+            <os arch="i386" />
+         </or>
+      </condition>
+
+      <condition property="optional.x64.subdir" value="" else="x64\">
+         <or>
+            <os arch="x86" />
+            <os arch="i386" />
+         </or>
+      </condition>
+
+
+      <available file="${msvc.dir}\vc\bin\${optional.amd64.subdir}cl.exe" type="file" property="cl.exists" />
+
+      <fail message="Error:">
+         <condition>
+            <and>
+               <isset property="use.msvc" />
+               <not>
+                  <isset property="cl.exists" />
+               </not>
+            </and>
+         </condition>
+         <![CDATA[
+         You will need to edit com.amd.aparapi.jni/build.properties to compile aparapi JNI code
+
+         Could not find vc\bin\${optional.amd64.subdir}cl under Configured msvc.dir. Check if msvc.dir is pointing
+         to a valid visual studio installation
+         ]]>
+      </fail>
+
+      <fail message="Error:">
+         <condition>
+            <and>
+               <not>
+                  <os family="mac" />
+               </not>
+               <not>
+                  <isset property="amd.app.sdk.dir" />
+               </not>
+            </and>
+         </condition>
+         <![CDATA[
+         You will need to edit com.amd.aparapi.jni/build.properties to compile aparapi JNI code
+
+         You need to set amd.app.sdk.dir to point to the location where AMD APP SDK is installed
+         ]]>
+      </fail>
+      <available file="${amd.app.sdk.dir}" type="dir" property="amd.app.sdk.dir.exists" />
+
+      <fail message="Error:">
+         <condition>
+            <and>
+               <not>
+                  <os family="mac" />
+               </not>
+               <not>
+                  <isset property="amd.app.sdk.dir.exists" />
+               </not>
+            </and>
+         </condition>
+         <![CDATA[
+         You will need to edit com.amd.aparapi.jni/build.properties to compile aparapi JNI code
+
+         At present amd.app.sdk.dir is set (to ${amd.app.sdk.dir}) but that dir does not exist
+         ]]>
+      </fail>
+   </target>
+
+   <target name="clean" depends="check">
+      <delete dir="include" />
+      <delete dir="${basedir}/dist" />
+      <!-- Legacy cleanup -->
+      <delete file="libaparapi_${x86_or_x86_64}.dylib" />
+      <delete file="libaparapi_${x86_or_x86_64}.so" />
+      <delete file="aparapi_${x86_or_x86_64}.dll" />
+      <delete file="aparapi.dll" />
+      <delete file="aparapi.obj" />
+      <delete file="aparapi.o" />
+      <delete file="aparapi.lib" />
+      <delete file="aparapi.exp" />
+      <delete file="OpenCLJNI.obj" />
+      <delete file="OpenCLJNI.o" />
+      <delete file="Config.obj" />
+      <delete file="Config.o" />
+      <delete file="ProfileInfo.obj" />
+      <delete file="ProfileInfo.o" />
+      <delete file="ArrayBuffer.obj" />
+      <delete file="ArrayBuffer.o" />
+      <delete file="AparapiBuffer.obj" />
+      <delete file="AparapiBuffer.o" />
+      <delete file="JNIHelper.obj" />
+      <delete file="JNIHelper.o" />
+      <delete file="CLHelper.obj" />
+      <delete file="CLHelper.o" />
+      <delete file="JNIContext.obj" />
+      <delete file="JNIContext.o" />
+      <delete file="KernelArg.obj" />
+      <delete file="KernelArg.o" />
+      <delete file="Range.obj" />
+      <delete file="Range.o" />
+      <delete file="OpenCLArgDescriptor.obj" />
+      <delete file="OpenCLArgDescriptor.o" />
+      <delete file="agent.obj" />
+      <delete file="agent.o" />
+      <delete file="classtools.obj" />
+      <delete file="classtools.o" />
+      <delete file="OpenCLMem.obj" />
+      <delete file="OpenCLMem.o" />
+   </target>
+
+   <target name="javah">
+      <mkdir dir="include" />
+      <javah classpath="..\com.amd.aparapi\classes" destdir="include" force="true">
+         <class name="com.amd.aparapi.internal.jni.ConfigJNI" />
+         <class name="com.amd.aparapi.internal.jni.KernelArgJNI" />
+         <class name="com.amd.aparapi.internal.jni.KernelRunnerJNI" />
+         <class name="com.amd.aparapi.internal.jni.OpenCLJNI" />
+         <class name="com.amd.aparapi.internal.jni.RangeJNI" />
+         <!-- Non-Native Classes -->
+         <class name="com.amd.aparapi.Kernel"/>
+         <class name="com.amd.aparapi.Range"/>
+         <class name="com.amd.aparapi.Config" />
+         <class name="com.amd.aparapi.device.Device" />
+         <class name="com.amd.aparapi.device.OpenCLDevice" />
+         <class name="com.amd.aparapi.internal.kernel.KernelRunner"/>
+         <class name="com.amd.aparapi.internal.opencl.OpenCLArgDescriptor" />
+         <class name="com.amd.aparapi.internal.opencl.OpenCLMem" />
+      </javah>
+   </target>
+
+
+   <target name="gcc" if="use.gcc">
+      <mkdir dir="${basedir}/dist"/>
+      <echo message="linuxcc ${os.arch}" />
+      <exec executable="g++">
+        <!-- !!! oren change -> add debug info, no optimizations 
+         <arg value="-O3" />
+        -->
+         <arg value="-O0" />
+         <arg value="-g" />
+         <arg value="-fPIC" />
+         <arg value="-DCL_USE_DEPRECATED_OPENCL_1_1_APIS"/>
+         <arg value="-I${java.home}/../include" />
+         <arg value="-I${java.home}/../include/linux" />
+         <arg value="-Iinclude" />
+         <arg value="-I${amd.app.sdk.dir}/include" />
+         <arg value="-Isrc/cpp" />
+         <arg value="-Isrc/cpp/runKernel" />
+         <arg value="-Isrc/cpp/invoke" />
+         <arg value="-shared" />
+         <arg value="-o"/> 
+         <arg value="${basedir}/dist/libaparapi_${x86_or_x86_64}.so" />
+         <arg value="src/cpp/runKernel/Aparapi.cpp" />
+         <arg value="src/cpp/runKernel/ArrayBuffer.cpp" />
+         <arg value="src/cpp/runKernel/AparapiBuffer.cpp" />
+         <arg value="src/cpp/runKernel/Config.cpp" />
+         <arg value="src/cpp/runKernel/JNIContext.cpp" />
+         <arg value="src/cpp/runKernel/KernelArg.cpp" />
+         <arg value="src/cpp/runKernel/ProfileInfo.cpp" />
+         <arg value="src/cpp/runKernel/Range.cpp" />
+         <arg value="src/cpp/invoke/OpenCLJNI.cpp" />
+         <arg value="src/cpp/invoke/OpenCLArgDescriptor.cpp" />
+         <arg value="src/cpp/invoke/OpenCLMem.cpp" />
+         <arg value="src/cpp/CLHelper.cpp" />
+         <arg value="src/cpp/classtools.cpp" />
+         <arg value="src/cpp/JNIHelper.cpp" />
+         <arg value="src/cpp/agent.cpp" />
+         <arg value="-L${amd.app.sdk.dir}/lib/${x86_or_x86_64}" />
+         <arg value="-lOpenCL" />
+      </exec>
+   </target>
+
+   <target name="gcc_mac" if="use.gcc_mac">
+      <mkdir dir="${basedir}/dist"/>
+      <echo message="gcc ${os.arch}" />
+      <exec executable="g++">
+         <arg value="-O3" />
+         <arg value="-g" />
+         <arg value="-fPIC" />
+         <!-- <arg value="-fopenmp"/> -->
+         <arg value="-DCL_USE_DEPRECATED_OPENCL_1_1_APIS"/>
+         <arg value="-I/System/Library/Frameworks/JavaVM.framework/Headers" />
+         <arg value="-Iinclude" />
+         <arg value="-Isrc/cpp" />
+         <arg value="-Isrc/cpp/runKernel" />
+         <arg value="-Isrc/cpp/invoke" />
+         <arg value="-shared" />
+         <arg value="-o" />
+         <arg value="${basedir}/dist/libaparapi_${x86_or_x86_64}.dylib" />
+         <arg value="src/cpp/runKernel/Aparapi.cpp" />
+         <arg value="src/cpp/runKernel/ArrayBuffer.cpp" />
+         <arg value="src/cpp/runKernel/AparapiBuffer.cpp" />
+         <arg value="src/cpp/runKernel/Config.cpp" />
+         <arg value="src/cpp/runKernel/JNIContext.cpp" />
+         <arg value="src/cpp/runKernel/KernelArg.cpp" />
+         <arg value="src/cpp/runKernel/ProfileInfo.cpp" />
+         <arg value="src/cpp/runKernel/Range.cpp" />
+         <arg value="src/cpp/invoke/OpenCLJNI.cpp" />
+         <arg value="src/cpp/invoke/OpenCLArgDescriptor.cpp" />
+         <arg value="src/cpp/invoke/OpenCLMem.cpp" />
+         <arg value="src/cpp/CLHelper.cpp" />
+         <arg value="src/cpp/classtools.cpp" />
+         <arg value="src/cpp/JNIHelper.cpp" />
+         <arg value="src/cpp/agent.cpp" />
+         <arg value="-framework" />
+         <arg value="OpenCL" />
+         <arg value="-Wno-write-strings" />
+      </exec>
+   </target>
+
+   <target name="msvc" if="use.msvc">
+      <mkdir dir="${basedir}\dist"/>
+      <echo message="msvc ${os.arch}" />
+      <exec executable="${msvc.dir}\vc\bin\${optional.amd64.subdir}cl.exe">
+         <env key="PATH" path="${env.PATH};${msvc.dir}\\Common7\\IDE" />
+         <arg value="/nologo" />
+         <arg value="/TP" />
+         <arg value="/Ox" />
+         <!-- <arg value="/openmp" /> -->
+         <arg value="-DCL_USE_DEPRECATED_OPENCL_1_1_APIS"/>
+         <arg value="/EHsc" />
+         <arg value="/I${msvc.dir}\vc\include" />
+         <arg value="/I${msvc.sdk.dir}\include" />
+         <arg value="/I${java.home}\..\include" />
+         <arg value="/I${java.home}\..\include\win32" />
+         <arg value="/Iinclude" />
+         <arg value="/I${amd.app.sdk.dir}\include" />
+         <arg value="/Isrc/cpp" />
+         <arg value="/Isrc/cpp/runKernel" />
+         <arg value="/Isrc/cpp/invoke" />
+         <arg value="src/cpp/runKernel/Aparapi.cpp" />
+         <arg value="src/cpp/runKernel/ArrayBuffer.cpp" />
+         <arg value="src/cpp/runKernel/AparapiBuffer.cpp" />
+         <arg value="src/cpp/runKernel/Config.cpp" />
+         <arg value="src/cpp/runKernel/JNIContext.cpp" />
+         <arg value="src/cpp/runKernel/KernelArg.cpp" />
+         <arg value="src/cpp/runKernel/ProfileInfo.cpp" />
+         <arg value="src/cpp/runKernel/Range.cpp" />
+         <arg value="src/cpp/invoke/OpenCLJNI.cpp" />
+         <arg value="src/cpp/invoke/OpenCLArgDescriptor.cpp" />
+         <arg value="src/cpp/invoke/OpenCLMem.cpp" />
+         <arg value="src/cpp/CLHelper.cpp" />
+         <arg value="src/cpp/classtools.cpp" />
+         <arg value="src/cpp/JNIHelper.cpp" />
+         <arg value="src/cpp/agent.cpp" />
+         <arg value="/LD" />
+         <arg value="/link" />
+         <arg value="/libpath:${msvc.dir}\vc\lib\${optional.amd64.subdir}" />
+         <arg value="/libpath:${msvc.sdk.dir}\lib\${optional.x64.subdir}" />
+         <arg value="/libpath:${amd.app.sdk.dir}\lib\${x86_or_x86_64}" />
+         <arg value="OpenCL.lib" />
+         <arg value="/out:${basedir}\dist\aparapi_${x86_or_x86_64}.dll" />
+      </exec>
+   </target>
+
+   <target name="mingw" if="use.mingw">
+      <mkdir dir="${basedir}\dist"/>
+      <echo message="mingw ${os.arch}" /> 
+      <exec executable="${mingw.dir}/bin/g++">
+         <env key="PATH" path="${env.PATH};${mingw.dir}/bin" />
+         <arg value="-Wall" />
+         <arg value="-O3" />
+         <arg value="-Wl,--kill-at" />
+         <arg value="-DCL_USE_DEPRECATED_OPENCL_1_1_APIS"/>
+         <arg value="-I${java.home}\..\include" />
+         <arg value="-I${java.home}\..\include\win32" />
+         <arg value="-Iinclude" />
+         <arg value="-I${amd.app.sdk.dir}\include" />
+         <arg value="-Isrc/cpp" />
+         <arg value="-Isrc/cpp/runKernel" />
+         <arg value="-Isrc/cpp/invoke" />
+         <arg value="-shared" />
+         <arg value="-o" />
+         <arg value="${basedir}\dist\aparapi_${x86_or_x86_64}.dll" />
+         <arg value="src/cpp/runKernel/Aparapi.cpp" />
+         <arg value="src/cpp/runKernel/ArrayBuffer.cpp" />
+         <arg value="src/cpp/runKernel/AparapiBuffer.cpp" />
+         <arg value="src/cpp/runKernel/Config.cpp" />
+         <arg value="src/cpp/runKernel/JNIContext.cpp" />
+         <arg value="src/cpp/runKernel/KernelArg.cpp" />
+         <arg value="src/cpp/runKernel/ProfileInfo.cpp" />
+         <arg value="src/cpp/runKernel/Range.cpp" />
+         <arg value="src/cpp/invoke/OpenCLJNI.cpp" />
+         <arg value="src/cpp/invoke/OpenCLArgDescriptor.cpp" />
+         <arg value="src/cpp/invoke/OpenCLMem.cpp" />
+         <arg value="src/cpp/CLHelper.cpp" />
+         <arg value="src/cpp/classtools.cpp" />
+         <arg value="src/cpp/JNIHelper.cpp" />
+         <arg value="src/cpp/agent.cpp" />
+         <arg value="-L${amd.app.sdk.dir}\lib\${x86_or_x86_64}" />
+         <arg value="-lOpenCL" />
+      </exec>
+   </target>
+
+   <target name="build" depends="clean, javah, msvc, mingw, gcc, gcc_mac" />
+
+   <target name="msvc_cltest" if="use.msvc">
+      <mkdir dir="${basedir}\dist"/>
+      <echo message="msvc_cltest ${os.arch}" />
+      <exec executable="${msvc.dir}\vc\bin\${optional.amd64.subdir}cl.exe">
+         <env key="PATH" path="${env.PATH};${msvc.dir}\\Common7\\IDE" />
+         <arg value="/nologo" />
+         <arg value="/TP" />
+         <arg value="/Ox" />
+         <arg value="-DCL_USE_DEPRECATED_OPENCL_1_1_APIS"/>
+         <arg value="/I${msvc.dir}\vc\include" />
+         <arg value="/I${msvc.sdk.dir}\include" />
+         <arg value="/I${amd.app.sdk.dir}\include" />
+         <arg value="/Isrc/cpp" />
+         <arg value="/Isrc/cpp/runKernel" />
+         <arg value="/Isrc/cpp/invoke" />
+         <arg value="src\cpp\CLTest.cpp" />
+         <arg value="/link" />
+         <arg value="/libpath:${msvc.dir}\vc\lib\${optional.amd64.subdir}" />
+         <arg value="/libpath:${msvc.sdk.dir}\lib\${optional.x64.subdir}" />
+         <arg value="/libpath:${amd.app.sdk.dir}\lib\${x86_or_x86_64}" />
+         <arg value="OpenCL.lib" />
+         <arg value="/out:${basedir}/dist/cltest_${x86_or_x86_64}.exe" />
+      </exec>
+   </target>
+
+   <target name="mac_cltest" if="use.gcc_mac">
+      <mkdir dir="${basedir}/dist"/>
+      <echo message="gcc cltest ${os.arch}" />
+      <exec executable="g++">
+         <arg value="-O3" />
+         <arg value="-g" />
+         <arg value="-fPIC" />
+         <arg value="-DCL_USE_DEPRECATED_OPENCL_1_1_APIS"/>
+         <arg value="-I/System/Library/Frameworks/JavaVM.framework/Headers" />
+         <arg value="-Iinclude" />
+         <arg value="-Isrc/cpp" />
+         <arg value="-Isrc/cpp/runKernel" />
+         <arg value="-Isrc/cpp/invoke" />
+         <arg value="-o" />
+         <arg value="${basedir}/dist/cltest" />
+         <arg value="src/cpp/CLTest.cpp" />
+         <arg value="-framework" />
+         <arg value="OpenCL" />
+      </exec>
+   </target>
+
+   <target name="gcc_cltest" if="use.gcc">
+      <mkdir dir="${basedir}/dist"/>
+      <echo message="gcc cltest ${os.arch}" />
+      <exec executable="g++">
+         <arg value="-O3" />
+         <arg value="-g" />
+         <arg value="-fPIC" />
+         <arg value="-DCL_USE_DEPRECATED_OPENCL_1_1_APIS"/>
+         <arg value="-I${java.home}/../include" />
+         <arg value="-I${java.home}/../include/linux" />
+         <arg value="-I${amd.app.sdk.dir}/include" />
+         <arg value="src/cpp/cltest.cpp" />
+         <arg value="-L${amd.app.sdk.dir}/lib/${x86_or_x86_64}" />
+         <arg value="-lOpenCL" />
+         <arg value="-o" />
+         <arg value="${basedir}/cltest_${x86_or_x86_64}" />
+      </exec>
+  </target>
+
+   <target name="gcc_clt" if="use.gcc">
+      <mkdir dir="${basedir}/dist"/>
+      <echo message="gcc cltest ${os.arch}" />
+      <exec executable="g++">
+         <arg value="-O3" />
+         <arg value="-g" />
+         <arg value="-fPIC" />
+         <arg value="src/cpp/classtools.cpp" />
+         <arg value="src/cpp/classtoolstest.cpp" />
+         <arg value="-o" />
+         <arg value="${basedir}/clt" />
+      </exec>
+  </target>
+
+
+   <target name="mac_clt" if="use.gcc_mac">
+      <mkdir dir="${basedir}/dist"/>
+      <echo message="gcc clt ${os.arch}" />
+      <exec executable="g++">
+         <arg value="-O3" />
+         <arg value="-g" />
+         <arg value="-fPIC" />
+         <arg value="src/cpp/classtools.cpp" />
+         <arg value="src/cpp/classtoolstest.cpp" />
+         <arg value="-o" />
+         <arg value="${basedir}/clt" />
+      </exec>
+   </target>
+
+   <target name="cltest" depends="check,msvc_cltest,mac_cltest,gcc_cltest" />
+   <target name="clt" depends="check,gcc_clt,mac_clt" />
+</project>