From ae0a9ae70f9cb49e621c580829561f67fcc6dc50 Mon Sep 17 00:00:00 2001
From: Barney <barney@frontofficedeveloper.com>
Date: Thu, 3 Sep 2015 16:40:30 +0100
Subject: [PATCH] beta version of Device configuration changes and introduction
 of KernelManager - reverting some accidentally commited files

---
 com.amd.aparapi.jni/Aparapi.suo               | Bin 22528 -> 20992 bytes
 com.amd.aparapi.jni/Aparapi.vcxproj           |  10 +-
 com.amd.aparapi.jni/Aparapi.vcxproj.filters   |   8 +-
 com.amd.aparapi.jni/build.xml                 | 471 +++++++-----------
 .../src/cpp/runKernel/Aparapi.cpp             |  50 +-
 5 files changed, 201 insertions(+), 338 deletions(-)

diff --git a/com.amd.aparapi.jni/Aparapi.suo b/com.amd.aparapi.jni/Aparapi.suo
index 117d265b9625f6dc443e9f6dde562abcf51f7ded..79b046879bc8389cd16d5fd8594758cf385c92b2 100644
GIT binary patch
delta 1564
zcmah}|4&<06u-B9@Ab9xl>%Mcbz7+&o1MUDS>sqG<rSW^fJhtB_=7({DuyA0%9mu@
z5BjFj7_(&1qsy`=W?!-&44aHMqsGP6gdbco;}Z7|_#ez<KNyYRIgi%}Nf&SPx%YhU
zIp^N<^fj(u=WCa2;^x-Y*5>U(k(Y&OPrN(T_(}2?ZfCfT!CB$HlQ$x{2LYAgSXmL^
zv^XSkFA44rw}D<Sz@MVpUXKDZ6ow;@CWH?`o+J-gC(%<dAssw&aEIhD($6Adh+#w?
z(TX7J0^F89@V<=Ph$SH@XpS*?9tCeBVAZjopNIR7<K7QP3V$DZE3dx)&2M*(bzB~X
zf*dzgS+)rx8Db5v;CcvJEG{Z2I1gv)hU6$xvZZ!YX~fV1?o1j<x0l;>WX`p}2cIi4
z%qekfkbt4HRKMZ&ggLAn2qEL!fgp^@v9dQOv`{4cXWjsd-d|-2Sx;5uhsA~w*^jK-
z5-C9>stIuXlOCsw=`O}3_B}M`o`HJRZ>WtrFZ(uR?8H``<tXh%;v*OQ<r|dgI;g(w
zg7@fkA!Md(xS{M`QwCN-DM<NCO>vfCan{F9;NEZk`rt~o8B=c&3lYXv%&IR3S~yXG
za!`{6j6v5+u|=xQ24{kUPDYQ0awoa*B<SW49Z*3HRk+vS`+Dur7fVQOXb^TAXTyVn
z&_Krch>R!EQAwcWOxJ}Y4>-&Pa`3U%RX@!p7+tfq;ETY47l;nA9BRhdo4C)hh^7AT
z2(ee#EL%if5iKHE*-3`6;7Z+ILvMA7d=uVD{tk~5qxRzI5{##t;c90X@~X!<Tbh_D
zPEXC8gr9oac(vydm`n$&Hg?kfnCax-S~s#w%f~^{cIX_h&QHwEzmWwsp_h+FxeR<?
z55(KNu+*v<`J{`lAMfIk3z+>9Vi{3J0OC``XNZf$zuxuI{;!bu8nKGFiMWNJd04{}
zDqSVWo$xM?Rn}9gO`JrT1b?*t0Lz^nRGOK#Cllv)YNag~XHT7)ojE!QrQR6-u9gYh
z%_Je6QEGQ(cjp9&X-{uY&L5$HG*_hZF3tpf18O@|(}o_+54U>Vt~8p`3)KF%jx<F3
zeKxJ;CGJj_g8QE{^V!}Kc+l&v?Oc5UrrQFq`aQmP6X_0eds+iS*D4x^b83iO6}s^1
zx&;5cn3bK#9ztx7ZvP_zN8e(yU*cT0!_q($x}V>G%3&XjcCW&c;)Y5h0@JxLzkySF
y0UoCOur?sUBcWw|Xu~c$Fa&*H&5`{Xi3j*y8G_}}4h&c@&$ysm&GT#d*Z98)+O2K?

delta 2857
zcmb_eeN0nV6u%E%+gDnkr7d4Fq~$|ODHcUO2eeQGOA#8UZVA~$frz8fRWyRAjb@o9
zbAz63E=EU~Zp#ev)n&;(VyZLCOmu)-wq<b%E?H*$W4go`r;hHNwli5K88v$^zjx0)
z_nvdlJ@=e*pXW5^ndBzlj#B0_#`K7VKp>Du?UZ9P=jFTOn9FwdQ12`kjZAYf4Dgqv
zOoy}t0sf|3Z!8acM2#Y*AjaoS`QVS|;hxBBBvk|@4kRE{2sMIuiQ$&$w~$VS4soWQ
zdRf@pfyhCuK#*Zgh)IM2L37r_l=zV14ECB4EeHn!tdcFli%8HE7?Y%NJK>U~MB%u4
zP*uGkYo5+a{Q2082Y10Cn0#hIh~mjI+5_~(%nAkAi3>ACu}Ex%ep#cSK}ra-<?-PT
zHVimvk*`Ru;0&9vSIf#-D{E&RY&W)T%!P0V+b(8gPS(#lSub-#yvZmcX$GUQ%VYT<
z8TvRuX)?fMyxM1vOXoCQI6Z?EG7~F6wBiE2%n1kLpF{tu3Eo(<SJA*rNf({NGCT*x
zWdZjdATx=_X<(PKS)k3x!z@h_60{$BVpujB6U|P+OO+))PlAW@CYrtKi-H&j>4->)
zI2j3p2=1$GJVi$EjQcbmSqgS`MBxW{ZK?_wNOT>bC}FGuH8W;m+gKm#LWgW%S+YMZ
zhNI^jrhYs#qk3<1yq(2eO6`6q&1@bDymD{m!s$Aav$J2-*;gkrGwVP8<@&xATb)J3
zWhh_TslKpqA>DrZWc&EB^jl?%$Xgdt;K*QTN(5&F+YK2;4wsHZD#e>@73g#+(#dtA
zOe79Mf3i&)%pdY3@qKra<s3}Ms&Sbt$$GYzm9P@1PCd_QeB82{X!wFJ6zAjQYjM7T
zbQ{l8oRHsrcXZE)c}k|Bnm+wyuDTY(qmUJ`I&`>^72__~uvJJEvDG+2yi$A%aomXg
zVjNw~YFHVf4yiI2U9%B}?5V!-{1d!>e*{jdgrSyXECZB93t(9{2WhL?;kT8kUZW1f
z0=86DK|x(RY*{1L4@II^>1MlF4{O9^a%0=Uy5W413TABrrvh$SHF%P&;IGI7Me%Jg
zKkbK%!Wi(|l3{DZ#p#k#E`tid5Lz`%mQgXl_6@|FfA^m)wWra*1Tw}DXA$G!!JvS@
z)TOzCjIYDYS#0Ns9(Jgt-y`uus53HMZjJ(fjvC6>jpYt3J;F99@1F83T$xKz-6}br
z@{R6>BonS@sbHj1n>)C4HNi7b-kg)bHRn$`6YoEG*SWWDuMkw#R<#`bLLkkxZI8>{
zyJN7nytTb!cWaxg&E4keGCKP^d)+X(DjmkEinuW>0T$(B$2IO<J&hgio{sKTOGvh0
zo67}UO)fXOxD;xYLVcwk=Br{kDlm&^r`7prX8n&T5MP@J&s*d%<>+|2f2>Pc8-)_-
zRtr5^|4Jm%5Y{KzZdGFMqk5g;A4Hn&Ck*ttYK_Q>nY9mIHdLJQTRBBH2JOz^VCVxD
zv&p;GDp0k|CJ`(G(6{zmUiPR{KO)!qKS8BruXP$7riI&u`H)~s*AGOJJ<+wy4i1xw
zQ-jeqp&yJucB4^&i=T)<qSErOT*bS}@{jAU2D7;nU&`hJyc1mbhW-dx_)64HH(rbu
zvXDz2CFjV$LgF%l9&b#V%!=Z>gV&(}w0w#@k3}&|-~e4TBp~u45rBT3o-4))Pk~t>
z@Ki#BgRden;`^gn!s%b*BFL^qD$#toSo!G-+m8gs4<AzU_a~F2O&?e&=e*^-iMH2@
zzc722zD_cDbULmiXt!TcB)pF1j*{&UwK<?$s{^adB$`3S$>0Xd!V`Ic;@L<O$phrB
zkAf3QLla~?Pk&5wamc?z!jGT_9L8*{-3hAgY)W&t<wM8H%J!Qp#>R!;KZ~Ya7(-`7
z{~UJKK=l{56gs`fNlY~r|8HLHdB-_&?p*zmIF<Ix;lQRD^6GN^@kq|B{>dUzJaw;S
d*we7T;Yy|7a&%Zz4O30czWJ664(40h{{mFW1aklY

diff --git a/com.amd.aparapi.jni/Aparapi.vcxproj b/com.amd.aparapi.jni/Aparapi.vcxproj
index 279e7ab8..3023d478 100644
--- a/com.amd.aparapi.jni/Aparapi.vcxproj
+++ b/com.amd.aparapi.jni/Aparapi.vcxproj
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
   <ItemGroup Label="ProjectConfigurations">
     <ProjectConfiguration Include="Debug|Win32">
       <Configuration>Debug</Configuration>
@@ -18,12 +18,12 @@
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
     <ConfigurationType>DynamicLibrary</ConfigurationType>
     <UseDebugLibraries>true</UseDebugLibraries>
-    <PlatformToolset>v140</PlatformToolset>
+    <PlatformToolset>v110</PlatformToolset>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
     <ConfigurationType>DynamicLibrary</ConfigurationType>
     <UseDebugLibraries>false</UseDebugLibraries>
-    <PlatformToolset>v140</PlatformToolset>
+    <PlatformToolset>v110</PlatformToolset>
   </PropertyGroup>
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
   <ImportGroup Label="ExtensionSettings">
@@ -78,10 +78,10 @@
     </Link>
   </ItemDefinitionGroup>
   <ItemGroup>
+    <ClCompile Include="src\cpp\aparapi.cpp" />
     <ClCompile Include="src\cpp\clHelper.cpp" />
     <ClCompile Include="src\cpp\jniHelper.cpp" />
-    <ClCompile Include="src\cpp\runKernel\Aparapi.cpp" />
-    <ClCompile Include="src\cpp\runKernel\JNIContext.cpp" />
+    <ClCompile Include="src\cpp\opencljni.cpp" />
   </ItemGroup>
   <ItemGroup>
     <ClInclude Include="include\com_amd_aparapi_KernelRunner.h" />
diff --git a/com.amd.aparapi.jni/Aparapi.vcxproj.filters b/com.amd.aparapi.jni/Aparapi.vcxproj.filters
index 686086d6..2de182d5 100644
--- a/com.amd.aparapi.jni/Aparapi.vcxproj.filters
+++ b/com.amd.aparapi.jni/Aparapi.vcxproj.filters
@@ -15,16 +15,16 @@
     </Filter>
   </ItemGroup>
   <ItemGroup>
-    <ClCompile Include="src\cpp\jniHelper.cpp">
+    <ClCompile Include="src\cpp\aparapi.cpp">
       <Filter>Source Files</Filter>
     </ClCompile>
-    <ClCompile Include="src\cpp\clHelper.cpp">
+    <ClCompile Include="src\cpp\jniHelper.cpp">
       <Filter>Source Files</Filter>
     </ClCompile>
-    <ClCompile Include="src\cpp\runKernel\Aparapi.cpp">
+    <ClCompile Include="src\cpp\clHelper.cpp">
       <Filter>Source Files</Filter>
     </ClCompile>
-    <ClCompile Include="src\cpp\runKernel\JNIContext.cpp">
+    <ClCompile Include="src\cpp\opencljni.cpp">
       <Filter>Source Files</Filter>
     </ClCompile>
   </ItemGroup>
diff --git a/com.amd.aparapi.jni/build.xml b/com.amd.aparapi.jni/build.xml
index de7ee800..035bc928 100644
--- a/com.amd.aparapi.jni/build.xml
+++ b/com.amd.aparapi.jni/build.xml
@@ -14,21 +14,26 @@ First consider editing the properties in build.properties
    <echo>OS Arch:    ${os.arch}</echo>
    <echo>Java Ver:   ${java.version}</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"/> -->
-
+   <!-- Ideally this would be the latest version of Java but not everyone is going to have it installed -->
+   <!-- Additionally we want to avoid "Class not found: javac1.8" errors from old Ant versions (i.e. Eclipse) -->
+   <property name="build.compiler" value="javac1.7"/>
+   <property name="ant.build.javac.source" value="1.7"/>
+   <property name="ant.build.javac.target" value="1.7"/>
+
+   <property name="amd.app.sdk.version" value="2.9-1"/>
+   
    <property environment="env" />
-   <property name="msvc.dir" value="C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin" />
-   <!-- we need env.PATH for msvc only -->
-
-   <!-- uncomment this if you want to use mingw! -->
-   <!--<property name="mingw.dir" value="c:\\MinGW"/>-->
+   
+   <!-- Check for AMD APP SDK -->
+   <echo>
+      Note: Since AMD APP SDK 2.9 you can have multiple versions installed/co-exist on same machine, 
+      so AMD introduced a completely new naming convention for their installation directories
+      For example C:/Program Files/AMD APP SDK/2.9-1
+   </echo>
 
    <target name="init">
-      <available property="win32.amd.app.sdk.exists" file="C:\Program Files (x86)\AMD APP SDK\2.9-1" type="dir"/>
-
-      <condition property="amd.app.sdk.dir" value="C:\Program Files (x86)\AMD APP SDK\2.9-1">
+      <available property="win32.amd.app.sdk.exists" file="C:/Program Files/AMD APP SDK/${amd.app.sdk.version}" type="dir"/>
+      <condition property="amd.app.sdk.dir" value="C:/Program Files/AMD APP SDK/${amd.app.sdk.version}">
          <and>
             <os family="windows" />
             <isset property="win32.amd.app.sdk.exists" />
@@ -38,8 +43,8 @@ First consider editing the properties in build.properties
          </and>
       </condition>
 
-      <available property="win64.amd.app.sdk.exists" file="C:\Program Files (x86)\AMD APP SDK\2.9-1" type="dir"/>
-      <condition property="amd.app.sdk.dir" value="C:\Program Files (x86)\AMD APP SDK\2.9-1">
+      <available property="win64.amd.app.sdk.exists" file="C:/Program Files (x86)/AMD APP SDK/${amd.app.sdk.version}" type="dir"/>
+      <condition property="amd.app.sdk.dir" value="C:/Program Files (x86)/AMD APP SDK/${amd.app.sdk.version}">
          <and>
             <os family="windows" />
             <isset property="win64.amd.app.sdk.exists" />
@@ -49,8 +54,8 @@ First consider editing the properties in build.properties
          </and>
       </condition>
 
-      <available property="linux.amd.app.sdk.exists" file="/opt/AMDAPP" type="dir"/>
-      <condition property="amd.app.sdk.dir" value="/opt/AMDAPP">
+      <available property="linux.amd.app.sdk.exists" file="/opt/AMDAPPSDK-${amd.app.sdk.version}" type="dir"/>
+      <condition property="amd.app.sdk.dir" value="/opt/AMDAPPSDK-${amd.app.sdk.version}">
          <and>
             <os family="unix" />
             <not>
@@ -66,227 +71,191 @@ First consider editing the properties in build.properties
          </and>
       </condition>
 
-      <echo message=" amd.app.sdk.dir ${amd.app.sdk.dir}"/>
+      <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">
+      <available property="linux.intel.app.sdk.exists" file="/opt/intel/opencl" type="dir"/>
+      <condition property="intel.app.sdk.dir" value="/opt/intel/opencl">
          <and>
+            <os family="unix" />
             <not>
-               <or>
-                  <os arch="x86" />
-                  <os arch="i386" />
-               </or>
+               <os family="mac" />
             </not>
-            <os family="windows" />
-            <isset property="msvc.32.11.0.exists" />
+            <isset property="linux.intel.app.sdk.exists" />
             <not>
-               <isset property="msvc.dir" />
+               <isset property="win32.amd.app.sdk.exists" />
             </not>
             <not>
-               <isset property="mingw.dir" />
+               <isset property="win64.amd.app.sdk.exists" />
             </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">
+
+      <echo message=" intel.app.sdk.dir ${intel.app.sdk.dir}"/>
+
+      <condition property="vendor.name" value="amd">
+         <isset property="amd.app.sdk.dir" /> 
+      </condition>
+
+      <condition property="vendor.name" value="intel">
          <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>
+            <isset property="intel.app.sdk.dir" /> 
             <not>
-               <isset property="mingw.dir" />
+                <isset property="amd.app.sdk.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">
+
+      <echo message=" vendor.name ${vendor.name}"/>
+  
+      <condition property="app.sdk.dir" value="${amd.app.sdk.dir}">
+         <isset property="amd.app.sdk.dir" /> 
+      </condition>
+
+      <condition property="app.sdk.dir" value="${intel.app.sdk.dir}">
          <and>
+            <isset property="intel.app.sdk.dir" /> 
             <not>
-               <or>
-                  <os arch="x86" />
-                  <os arch="i386" />
-               </or>
+                <isset property="app.sdk.dir" /> 
             </not>
+         </and>
+      </condition>
+
+      <echo message="app.sdk.dir ${app.sdk.dir}"/>
+
+	  <!-- Check for Visual Studio Compiler -->
+	  <!-- This needs to be in descending order to properly handle multiple installations -->
+	  <available property="msvc.32.12.0.exists" file="C:/Program Files/Microsoft Visual Studio 12.0\VC\bin" type="dir"/>
+      <condition property="msvc.dir" value="c:/Program Files/Microsoft Visual Studio 12.0">
+         <and>
             <os family="windows" />
-            <isset property="msvc.32.10.0.exists" />
+            <isset property="msvc.32.12.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">
+      <available property="msvc.64.12.0.exists" file="C:/Program Files (x86)/Microsoft Visual Studio 12.0\VC\bin" type="dir"/>
+      <condition property="msvc.dir" value="c:/Program Files (x86)/Microsoft Visual Studio 12.0">
          <and>
-            <or>
-               <os arch="x86" />
-               <os arch="i386" />
-            </or>
             <os family="windows" />
-            <isset property="msvc.32.9.0.exists" />
+            <isset property="msvc.64.12.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">
+      
+	  <available property="msvc.32.11.0.exists" file="C:/Program Files/Microsoft Visual Studio 11.0\VC\bin" type="dir"/>
+      <condition property="msvc.dir" value="c:/Program Files/Microsoft Visual Studio 11.0">
          <and>
             <os family="windows" />
-            <isset property="msvc.sdk.8.0A.32.exists" />
-            <not>
-               <isset property="msvc.sdk.dir" />
-            </not>
+            <isset property="msvc.32.11.0.exists" />
             <not>
-               <isset property="mingw.dir" />
+               <isset property="msvc.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">
+      <available property="msvc.64.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>
             <os family="windows" />
-            <isset property="msvc.sdk.8.0.32.exists" />
-            <not>
-               <isset property="msvc.sdk.dir" />
-            </not>
+            <isset property="msvc.64.11.0.exists" />
             <not>
-               <isset property="mingw.dir" />
+               <isset property="msvc.dir" />
             </not>
          </and>
-      </condition> -->
+      </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">
+      <available property="msvc.32.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>
             <os family="windows" />
-            <isset property="msvc.sdk.7.1A.exists" />
-            <not>
-               <isset property="msvc.sdk.dir" />
-            </not>
+            <isset property="msvc.32.10.0.exists" />
             <not>
-               <isset property="mingw.dir" />
+               <isset property="msvc.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">
+      <available property="msvc.64.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>
             <os family="windows" />
-            <isset property="msvc.sdk.7.1A.32.exists" />
-            <not>
-               <isset property="msvc.sdk.dir" />
-            </not>
+            <isset property="msvc.64.10.0.exists" />
             <not>
-               <isset property="mingw.dir" />
+               <isset property="msvc.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">
+
+	  <!-- Check for SDKs -->
+	  <!-- This needs to be in descending order to properly handle multiple installations -->
+	
+      <available property="msvc.sdk.7.1A.32.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.1.exists" />
+            <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.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">
+      
+      <available property="msvc.sdk.7.1A.64.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.1.32.exists" />
+            <isset property="msvc.sdk.7.1A.64.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">
+      
+      <available property="msvc.sdk.7.1.32.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.0A.exists" />
+            <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.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">
+	  <available property="msvc.sdk.7.1.64.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.0A.32.exists" />
+            <isset property="msvc.sdk.7.1.64.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">
+
+      <available property="msvc.sdk.7.0A.32.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.0.exists" />
+            <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.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">
+      <available property="msvc.sdk.7.0A.64.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.6.0A.exists" />
+            <isset property="msvc.sdk.7.0A.64.exists" />
             <not>
                <isset property="msvc.sdk.dir" />
             </not>
-            <not>
-               <isset property="mingw.dir" />
-            </not>
          </and>
       </condition>
 
@@ -295,7 +264,6 @@ First consider editing the properties in build.properties
    </target>
 
    <target name="check" depends="init">
-
       <fail message="Error:">
          <condition>
             <and>
@@ -307,9 +275,9 @@ First consider editing the properties in build.properties
             </and>
          </condition>
          <![CDATA[
-         You will need to edit com.amd.aparapi.jni/build.properties to compile aparapi JNI code
+         You will need to edit com.amd.aparapi.jni/build.xml to compile aparapi JNI code
 
-         At present msvc.dir seems to be Configured but not msvc.sdk.dir
+         At present msvc.dir seems to be configured but not msvc.sdk.dir
          ]]>
       </fail>
 
@@ -324,11 +292,12 @@ First consider editing the properties in build.properties
             </and>
          </condition>
          <![CDATA[
-         You will need to edit com.amd.aparapi.jni/build.properties to compile aparapi JNI code
+         You will need to edit com.amd.aparapi.jni/build.xml to compile aparapi JNI code
 
-         At present msvc.sdk.dir seems to be Configured but not msvc.dir
+         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" />
 
@@ -343,11 +312,12 @@ First consider editing the properties in build.properties
             </and>
          </condition>
          <![CDATA[
-         You will need to edit com.amd.aparapi.jni/build.properties to compile aparapi JNI code
+         You will need to edit com.amd.aparapi.jni/build.xml 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>
@@ -359,34 +329,12 @@ First consider editing the properties in build.properties
             </and>
          </condition>
          <![CDATA[
-         You will need to edit com.amd.aparapi.jni/build.properties to compile aparapi JNI code
+         You will need to edit com.amd.aparapi.jni/build.xml 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" />
@@ -394,54 +342,6 @@ First consider editing the properties in build.properties
             <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>
@@ -464,24 +364,25 @@ First consider editing the properties in build.properties
       </condition>
 
       <condition property="optional.amd64.subdir" value="" else="amd64\">
-         <or>
-            <os arch="x86" />
-            <os arch="i386" />
-         </or>
+         <equals arg1="${x86_or_x86_64}" arg2="x86"/>
       </condition>
 
       <condition property="optional.x64.subdir" value="" else="x64\">
-         <or>
-            <os arch="x86" />
-            <os arch="i386" />
-         </or>
+        <equals arg1="${x86_or_x86_64}" arg2="x86"/>
       </condition>
 
 
-      <available file="${msvc.dir}\${optional.amd64.subdir}cl.exe" type="file" property="cl.exists" />
+      <condition property="optional.app.sdk.lib.subdir" value="lib\" else="lib64\">
+        <equals arg1="${x86_or_x86_64}" arg2="x86"/>
+
+     </condition>
+      
+      <condition property="gcc.m.value" value="32" else="64">
+        <equals arg1="${x86_or_x86_64}" arg2="x86"/>
+      </condition>
+
+      <available file="${msvc.dir}\vc\bin\${optional.amd64.subdir}cl.exe" type="file" property="cl.exists" />
 
-	  <echo message="${msvc.dir}\${optional.amd64.subdir}cl.exe"/>
-	  
       <fail message="Error:">
          <condition>
             <and>
@@ -492,12 +393,10 @@ First consider editing the properties in build.properties
             </and>
          </condition>
          <![CDATA[
-         You will need to edit com.amd.aparapi.jni/build.properties to compile aparapi JNI code
+         You will need to edit com.amd.aparapi.jni/build.xml 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
+         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>
 
@@ -508,17 +407,18 @@ First consider editing the properties in build.properties
                   <os family="mac" />
                </not>
                <not>
-                  <isset property="amd.app.sdk.dir" />
+                  <isset property="app.sdk.dir" />
                </not>
             </and>
          </condition>
          <![CDATA[
-         You will need to edit com.amd.aparapi.jni/build.properties to compile aparapi JNI code
+         You will need to edit com.amd.aparapi.jni/build.xml to compile aparapi JNI code
 
-         You need to set amd.app.sdk.dir to point to the location where AMD APP SDK is installed
+         You need to set app.sdk.dir to point to the location where OpenCL SDK is installed
          ]]>
       </fail>
-      <available file="${amd.app.sdk.dir}" type="dir" property="amd.app.sdk.dir.exists" />
+      
+      <available file="${app.sdk.dir}" type="dir" property="app.sdk.dir.exists" />
 
       <fail message="Error:">
          <condition>
@@ -527,14 +427,14 @@ First consider editing the properties in build.properties
                   <os family="mac" />
                </not>
                <not>
-                  <isset property="amd.app.sdk.dir.exists" />
+                  <isset property="app.sdk.dir.exists" />
                </not>
             </and>
          </condition>
          <![CDATA[
-         You will need to edit com.amd.aparapi.jni/build.properties to compile aparapi JNI code
+         You will need to edit com.amd.aparapi.jni/build.xml to compile aparapi JNI code
 
-         At present amd.app.sdk.dir is set (to ${amd.app.sdk.dir}) but that dir does not exist
+         At present app.sdk.dir is set (to ${app.sdk.dir}) but that dir does not exist
          ]]>
       </fail>
    </target>
@@ -601,11 +501,11 @@ First consider editing the properties in build.properties
       </javah>
    </target>
 
-
    <target name="gcc" if="use.gcc">
       <mkdir dir="${basedir}/dist"/>
       <echo message="linuxcc ${os.arch}" />
-      <exec executable="g++">
+      <exec executable="g++" failonerror="true">
+         <arg value="-m${gcc.m.value}" />
          <arg value="-O3" />
          <arg value="-g" />
          <arg value="-fPIC" />
@@ -613,7 +513,7 @@ First consider editing the properties in build.properties
          <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="-I${app.sdk.dir}/include" />
          <arg value="-Isrc/cpp" />
          <arg value="-Isrc/cpp/runKernel" />
          <arg value="-Isrc/cpp/invoke" />
@@ -635,7 +535,8 @@ First consider editing the properties in build.properties
          <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="-L${app.sdk.dir}/lib/${x86_or_x86_64}" />
+         <arg value="-L${app.sdk.dir}/${optional.app.sdk.lib.subdir}" />
          <arg value="-lOpenCL" />
       </exec>
    </target>
@@ -643,7 +544,7 @@ First consider editing the properties in build.properties
    <target name="gcc_mac" if="use.gcc_mac">
       <mkdir dir="${basedir}/dist"/>
       <echo message="gcc ${os.arch}" />
-      <exec executable="g++">
+      <exec executable="g++" failonerror="true">
          <arg value="-O3" />
          <arg value="-g" />
          <arg value="-fPIC" />
@@ -651,9 +552,9 @@ First consider editing the properties in build.properties
          <arg value="-DCL_USE_DEPRECATED_OPENCL_1_1_APIS"/>
          <!-- JDK 6 -->
          <arg value="-I/System/Library/Frameworks/JavaVM.framework/Headers" />
-         <!-- JDK 7u51 without JDK 6 -->
-         <arg value="-I/Library/Java/JavaVirtualMachines/jdk1.7.0_12.jdk/Contents/Home/include/" />
-         <arg value="-I/Library/Java/JavaVirtualMachines/jdk1.7.0_12.jdk/Contents/Home/include/darwin/" />
+         <!-- LATEST JDK 7 without JDK 6 -->
+         <arg value="-I/Library/Java/JavaVirtualMachines/jdk1.7.0_67.jdk/Contents/Home/include/" />
+         <arg value="-I/Library/Java/JavaVirtualMachines/jdk1.7.0_67.jdk/Contents/Home/include/darwin/" />
          <arg value="-Iinclude" />
          <arg value="-Isrc/cpp" />
          <arg value="-Isrc/cpp/runKernel" />
@@ -685,7 +586,7 @@ First consider editing the properties in build.properties
    <target name="msvc" if="use.msvc">
       <mkdir dir="${basedir}\dist"/>
       <echo message="msvc ${os.arch}" />
-      <exec executable="${msvc.dir}\${optional.amd64.subdir}cl.exe">
+      <exec executable="${msvc.dir}\vc\bin\${optional.amd64.subdir}cl.exe" failonerror="true">
          <env key="PATH" path="${env.PATH};${msvc.dir}\\Common7\\IDE" />
          <arg value="/nologo" />
          <arg value="/TP" />
@@ -698,10 +599,9 @@ First consider editing the properties in build.properties
          <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="/I${app.sdk.dir}\include" />
          <arg value="/IC:\Program Files (x86)\Windows Kits\8.0\Include\shared" />
          <arg value="/IC:\Program Files (x86)\Windows Kits\8.0\Include\um" />
-	 
          <arg value="/Isrc/cpp" />
          <arg value="/Isrc/cpp/runKernel" />
          <arg value="/Isrc/cpp/invoke" />
@@ -724,58 +624,20 @@ First consider editing the properties in build.properties
          <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="/libpath:${app.sdk.dir}\lib\${x86_or_x86_64}" />
+	 <arg value="/libpath:${app.sdk.dir}\${optional.app.sdk.lib.subdir}" />
          <arg value="/libpath:C:\Program Files (x86)\Windows Kits\8.0\Lib\win8\um\x64" />
-         <arg value="C:\Program Files (x86)\AMD APP SDK\2.9-1\lib\x86\OpenCL.lib" />
+         <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="build" depends="clean, javah, msvc, 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">
+      <exec executable="${msvc.dir}\vc\bin\${optional.amd64.subdir}cl.exe" failonerror="true">
          <env key="PATH" path="${env.PATH};${msvc.dir}\\Common7\\IDE" />
          <arg value="/nologo" />
          <arg value="/TP" />
@@ -783,7 +645,7 @@ First consider editing the properties in build.properties
          <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="/I${app.sdk.dir}\include" />
          <arg value="/Isrc/cpp" />
          <arg value="/Isrc/cpp/runKernel" />
          <arg value="/Isrc/cpp/invoke" />
@@ -791,7 +653,8 @@ First consider editing the properties in build.properties
          <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="/libpath:${app.sdk.dir}\lib\${x86_or_x86_64}" />
+         <arg value="/libpath:${app.sdk.dir}\${optional.app.sdk.lib.subdir}" />
          <arg value="OpenCL.lib" />
          <arg value="/out:${basedir}/dist/cltest_${x86_or_x86_64}.exe" />
       </exec>
@@ -800,16 +663,16 @@ First consider editing the properties in build.properties
    <target name="mac_cltest" if="use.gcc_mac">
       <mkdir dir="${basedir}/dist"/>
       <echo message="gcc cltest ${os.arch}" />
-      <exec executable="g++">
+      <exec executable="g++" failonerror="true">
          <arg value="-O3" />
          <arg value="-g" />
          <arg value="-fPIC" />
          <arg value="-DCL_USE_DEPRECATED_OPENCL_1_1_APIS"/>
          <!-- JDK 6 -->
          <arg value="-I/System/Library/Frameworks/JavaVM.framework/Headers" />
-         <!-- JDK 7u51 without JDK 6 -->
-         <arg value="-I/Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home/include/" />
-         <arg value="-I/Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home/include/darwin/" />
+         <!-- Latest JDK 7 without JDK 6 -->
+         <arg value="-I/Library/Java/JavaVirtualMachines/jdk1.7.0_67.jdk/Contents/Home/include/" />
+         <arg value="-I/Library/Java/JavaVirtualMachines/jdk1.7.0_67.jdk/Contents/Home/include/darwin/" />
          <arg value="-Iinclude" />
          <arg value="-Isrc/cpp" />
          <arg value="-Isrc/cpp/runKernel" />
@@ -825,16 +688,17 @@ First consider editing the properties in build.properties
    <target name="gcc_cltest" if="use.gcc">
       <mkdir dir="${basedir}/dist"/>
       <echo message="gcc cltest ${os.arch}" />
-      <exec executable="g++">
+      <exec executable="g++" failonerror="true">
          <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="-I${app.sdk.dir}/include" />
          <arg value="src/cpp/cltest.cpp" />
-         <arg value="-L${amd.app.sdk.dir}/lib/${x86_or_x86_64}" />
+         <arg value="-L${app.sdk.dir}/lib/${x86_or_x86_64}" />
+         <arg value="-L${app.sdk.dir}/${optional.app.sdk.lib.subdir}" />
          <arg value="-lOpenCL" />
          <arg value="-o" />
          <arg value="${basedir}/cltest_${x86_or_x86_64}" />
@@ -844,7 +708,7 @@ First consider editing the properties in build.properties
    <target name="gcc_clt" if="use.gcc">
       <mkdir dir="${basedir}/dist"/>
       <echo message="gcc cltest ${os.arch}" />
-      <exec executable="g++">
+      <exec executable="g++" failonerror="true">
          <arg value="-O3" />
          <arg value="-g" />
          <arg value="-fPIC" />
@@ -855,11 +719,10 @@ First consider editing the properties in build.properties
       </exec>
   </target>
 
-
    <target name="mac_clt" if="use.gcc_mac">
       <mkdir dir="${basedir}/dist"/>
       <echo message="gcc clt ${os.arch}" />
-      <exec executable="g++">
+      <exec executable="g++" failonerror="true">
          <arg value="-O3" />
          <arg value="-g" />
          <arg value="-fPIC" />
diff --git a/com.amd.aparapi.jni/src/cpp/runKernel/Aparapi.cpp b/com.amd.aparapi.jni/src/cpp/runKernel/Aparapi.cpp
index d9c96970..cbad7e81 100644
--- a/com.amd.aparapi.jni/src/cpp/runKernel/Aparapi.cpp
+++ b/com.amd.aparapi.jni/src/cpp/runKernel/Aparapi.cpp
@@ -52,7 +52,7 @@
 
 static const int PASS_ID_PREPARING_EXECUTION = -2;
 static const int PASS_ID_COMPLETED_EXECUTION = -1;
-static const int CANCEL_STATUS_FALSE = 0;
+static const int CANCEL_STATUS_FALSE = 0;
 static const int CANCEL_STATUS_TRUE = 1;
 
 //compiler dependant code
@@ -141,10 +141,10 @@ jint writeProfileInfo(JNIContext* jniContext){
          fprintf(jniContext->profileFile, "%d write %s,", pos++, arg->name);
 
          fprintf(jniContext->profileFile, "%lu,%lu,%lu,%lu,",  
-           (unsigned long)(arg->arrayBuffer->write.queued - currSampleBaseTime)/1000,
-           (unsigned long)(arg->arrayBuffer->write.submit - currSampleBaseTime)/1000,
-           (unsigned long)(arg->arrayBuffer->write.start - currSampleBaseTime)/1000,
-           (unsigned long)(arg->arrayBuffer->write.end - currSampleBaseTime)/1000);
+        	(unsigned long)(arg->arrayBuffer->write.queued - currSampleBaseTime)/1000,
+        	(unsigned long)(arg->arrayBuffer->write.submit - currSampleBaseTime)/1000,
+        	(unsigned long)(arg->arrayBuffer->write.start - currSampleBaseTime)/1000,
+        	(unsigned long)(arg->arrayBuffer->write.end - currSampleBaseTime)/1000);
       }
    }
 
@@ -181,10 +181,10 @@ jint writeProfileInfo(JNIContext* jniContext){
             fprintf(jniContext->profileFile, "%d read %s,", pos++, arg->name);
 
             fprintf(jniContext->profileFile, "%lu,%lu,%lu,%lu,",  
-               (unsigned long)(arg->arrayBuffer->read.queued - currSampleBaseTime)/1000,
-               (unsigned long)(arg->arrayBuffer->read.submit - currSampleBaseTime)/1000,
-               (unsigned long)(arg->arrayBuffer->read.start - currSampleBaseTime)/1000,
-               (unsigned long)(arg->arrayBuffer->read.end - currSampleBaseTime)/1000);
+            	(unsigned long)(arg->arrayBuffer->read.queued - currSampleBaseTime)/1000,
+            	(unsigned long)(arg->arrayBuffer->read.submit - currSampleBaseTime)/1000,
+            	(unsigned long)(arg->arrayBuffer->read.start - currSampleBaseTime)/1000,
+            	(unsigned long)(arg->arrayBuffer->read.end - currSampleBaseTime)/1000);
          }
       }
    }
@@ -789,15 +789,15 @@ void enqueueKernel(JNIContext* jniContext, Range& range, int passes, int argPos,
 
    cl_int status = CL_SUCCESS;
    for (int passid=0; passid < passes; passid++) {
-      
-      int cancelCode = kernelInBytesAsInts[0];
-      kernelOutBytesAsInts[0] = passid;
+	   
+	   int cancelCode = kernelInBytesAsInts[0];
+	   kernelOutBytesAsInts[0] = passid;
 
-      if (cancelCode == CANCEL_STATUS_TRUE) {
-         fprintf(stderr, "received cancellation, aborting at pass %d\n", passid);
-         kernelOutBytes[0] = -1;
-         break;
-      }
+	   if (cancelCode == CANCEL_STATUS_TRUE) {
+		   fprintf(stderr, "received cancellation, aborting at pass %d\n", passid);
+		   kernelOutBytes[0] = -1;
+		   break;
+	   }
 
       //size_t offset = 1; // (size_t)((range.globalDims[0]/jniContext->deviceIdc)*dev);
       status = clSetKernelArg(jniContext->kernel, argPos, sizeof(passid), &(passid));
@@ -1079,16 +1079,16 @@ JNI_JAVA(jint, KernelRunnerJNI, runKernelJNI)
 
       cl_int status = CL_SUCCESS;
       JNIContext* jniContext = JNIContext::getJNIContext(jniContextHandle);
-      jniContext->runKernelInBytes = (jbyte*)jenv->GetDirectBufferAddress(inBuffer);
-      jniContext->runKernelOutBytes = (jbyte*)jenv->GetDirectBufferAddress(outBuffer);
+	  jniContext->runKernelInBytes = (jbyte*)jenv->GetDirectBufferAddress(inBuffer);
+	  jniContext->runKernelOutBytes = (jbyte*)jenv->GetDirectBufferAddress(outBuffer);
 
-      jbyte* kernelInBytes = jniContext->runKernelInBytes;
-      int* kernelInBytesAsInts = reinterpret_cast<int*>(kernelInBytes);
-      kernelInBytesAsInts[0] = CANCEL_STATUS_FALSE;
+	  jbyte* kernelInBytes = jniContext->runKernelInBytes;
+	  int* kernelInBytesAsInts = reinterpret_cast<int*>(kernelInBytes);
+	  kernelInBytesAsInts[0] = CANCEL_STATUS_FALSE;
 
-      jbyte* kernelOutBytes = jniContext->runKernelOutBytes;
-      int* kernelOutBytesAsInts = reinterpret_cast<int*>(kernelOutBytes);
-      kernelOutBytesAsInts[0] = PASS_ID_PREPARING_EXECUTION;
+	  jbyte* kernelOutBytes = jniContext->runKernelOutBytes;
+	  int* kernelOutBytesAsInts = reinterpret_cast<int*>(kernelOutBytes);
+	  kernelOutBytesAsInts[0] = PASS_ID_PREPARING_EXECUTION;
 
       if (jniContext->firstRun && config->isProfilingEnabled()){
          try {
-- 
GitLab