summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile29
-rw-r--r--build.xml11
-rw-r--r--crosscompiler.xml51
-rw-r--r--resources/opencl.h2
-rw-r--r--test/com/mbien/opencl/HighLevelBindingTest.java2
5 files changed, 73 insertions, 22 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 00000000..45bc54f1
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,29 @@
+BITS=32
+
+ifeq ($(BITS),32)
+ CC=gcc32
+ NS=win-x86
+else
+ BITS=64
+ CC=gcc64
+ NS=win-x64
+endif
+
+CFLAGS=-m$(BITS) -shared -c -fno-rtti -fPIC -I/usr/lib/jvm/java-6-sun/include -I../common/platform-libs/jre-include/win32 -Iresources/includes
+LFLAGS=-m$(BITS) -shared -fno-rtti -fPIC -L../common/platform-libs/OpenCL/win/_x64 -lOpenCL
+
+SRC=gensrc/native/CLImpl_JNI.c
+OBJ=build/obj/jocl/$(NS)/CLImpl_JNI.o
+BIN=build/natives/jocl/$(NS)/jocl.dll
+
+all: $(BIN)
+
+$(BIN): $(OBJ)
+ $(CC) $(LFLAGS) $(OBJ) -o $(BIN)
+
+$(OBJ): $(SRC)
+ $(CC) $(CFLAGS) $(SRC) -o $(OBJ)
+
+clean:
+ rm -f $(BIN) $(OBJ)
+
diff --git a/build.xml b/build.xml
index cd8d7351..4634451c 100644
--- a/build.xml
+++ b/build.xml
@@ -80,7 +80,7 @@
<target name="-post-compile" depends="c.compile.default" />
- <target name="c.compile.default" depends="gluegen.cpptasks.detect.os, jocl.c.compile" />
+ <target name="c.compile.default" depends="gluegen.cpptasks.detect.os, gluegen.cpptasks.detect.compiler, jocl.c.compile, c.rename.lib.mingw" />
<target name="jocl.c.compile" depends="c.setup.build">
@@ -152,7 +152,7 @@
<linker id="linker.cfg.win32.mingw.jocl" extends="linker.cfg.win32.mingw">
<linkerarg value="-Wl,--kill-at" /> <!-- remove @ from function names -->
- <syslibset libs="OpenCL"/>
+ <syslibset dir="C:/NVIDIAComputingSDK/OpenCL/common/lib/Win32" libs="OpenCL"/>
</linker>
<linker id="linker.cfg.macosx.jocl">
@@ -220,4 +220,11 @@
</target>
+ <!--cut and paste from gluegen -->
+ <target name="c.rename.lib.mingw" if="isMingW">
+ <!-- FIXME: this is a hack; the cpptask should have an option to change the
+ suffix or at least understand the override from .so to .dll -->
+ <move file="${natives.jocl.dir}/${namespace}/libjocl.so" tofile="${natives.jocl.dir}/${namespace}/jocl.dll" />
+ </target>
+
</project> \ No newline at end of file
diff --git a/crosscompiler.xml b/crosscompiler.xml
index 2b9df491..36eec26e 100644
--- a/crosscompiler.xml
+++ b/crosscompiler.xml
@@ -12,62 +12,65 @@
<import file="build.xml"/>
<!-- TODO remove hardcoded path -->
- <property name="java.includes.dir.windows" value="/media/store/JOCLSetup/win32"/>
+ <property name="java.includes.dir.windows" value="/home/buildadmin/project/common/platform-libs/jre-include/win32"/>
+ <property name="opencl.platform.dir" value="/home/buildadmin/project/common/platform-libs/OpenCL"/>
<!-- crosscompiles to other platforms, requirement: linux64 host os -->
- <target name="jocl.cross-compile" depends="init, configure.crosscompiler">
+ <target name="jocl.cross-compile" depends="init">
<echo message=" - - - cross-compiling JOCL natives - - - "/>
<antcall target="jocl.c.compile" inheritall="false">
<param name="namespace" value="linux-amd64"/>
- <param name="crosscompile" value="true"/>
<param name="build.dir" value="${build.dir}"/>
<param name="isLinuxAMD64" value="true"/>
<param name="isLinux" value="true"/>
<param name="isUnix" value="true"/>
<param name="isX11" value="true"/>
+
+ <!-- overwrite -->
+ <param name="linker.cfg.id" value="linker.cfg.linux64.amd64.jocl"/>
</antcall>
<antcall target="jocl.c.compile" inheritall="false">
<param name="namespace" value="linux-x86"/>
- <param name="crosscompile" value="true"/>
<param name="build.dir" value="${build.dir}"/>
<param name="isLinuxX86" value="true"/>
<param name="isLinux" value="true"/>
<param name="isUnix" value="true"/>
<param name="isX11" value="true"/>
+
+ <!-- overwrite -->
+ <param name="linker.cfg.id" value="linker.cfg.linux64.x86.jocl"/>
</antcall>
- <!-- use mingw crosscompiler to compile for win32 and win64 (linux64 only) -->
+ <!-- use mingw crosscompiler to compile for win32 and win64 -->
<antcall target="jocl.c.compile" inheritall="false">
- <param name="namespace" value="linux-amd64"/>
- <param name="crosscompile" value="true"/>
+ <param name="namespace" value="win-x86"/>
<param name="build.dir" value="${build.dir}"/>
- <param name="isLinuxAMD64" value="true"/>
+ <param name="isLinuxX86" value="true"/>
<param name="isLinux" value="true"/>
<param name="isUnix" value="true"/>
<param name="isX11" value="true"/>
<!-- overwrite -->
<param name="java.includes.dir.platform" value="${java.includes.dir.windows}"/>
- <param name="compiler.cfg.id" value="compiler.cfg.linux64.mingw64"/>
- <param name="linker.cfg.id" value="linker.cfg.linux64.mingw64.jocl"/>
+ <param name="compiler.cfg.id" value="compiler.cfg.linux64.mingw32"/>
+ <param name="linker.cfg.id" value="linker.cfg.linux64.mingw32.jocl"/>
</antcall>
<antcall target="jocl.c.compile" inheritall="false">
- <param name="namespace" value="linux-x86"/>
- <param name="crosscompile" value="true"/>
+ <param name="namespace" value="win-amd64"/>
<param name="build.dir" value="${build.dir}"/>
- <param name="isLinuxX86" value="true"/>
+ <param name="isLinuxAMD64" value="true"/>
<param name="isLinux" value="true"/>
<param name="isUnix" value="true"/>
<param name="isX11" value="true"/>
<!-- overwrite -->
<param name="java.includes.dir.platform" value="${java.includes.dir.windows}"/>
- <param name="compiler.cfg.id" value="compiler.cfg.linux64.mingw32"/>
- <param name="linker.cfg.id" value="linker.cfg.linux64.mingw32.jocl"/>
+ <param name="compiler.cfg.id" value="compiler.cfg.linux64.mingw64"/>
+ <param name="linker.cfg.id" value="linker.cfg.linux64.mingw64.jocl"/>
</antcall>
<echo message=" - - - JOCL natives cross-compiled - - - "/>
@@ -75,14 +78,24 @@
</target>
- <target name="configure.crosscompiler">
- <linker id="linker.cfg.linux64.mingw64.jocl" extends="linker.cfg.linux64.mingw64">
- <syslibset dir="${basedir}/lib/OpenCL/linux/amd64" libs="OpenCL"/>
+ <target name="jocl.configure.linker">
+
+ <linker id="linker.cfg.linux64.x86.jocl" extends="linker.cfg.linux">
+ <syslibset dir="${opencl.platform.dir}/linux/x86" libs="OpenCL"/>
+ </linker>
+
+ <linker id="linker.cfg.linux64.amd64.jocl" extends="linker.cfg.linux.amd64" >
+ <syslibset dir="${opencl.platform.dir}/linux/amd64" libs="OpenCL"/>
</linker>
<linker id="linker.cfg.linux64.mingw32.jocl" extends="linker.cfg.linux64.mingw32">
- <syslibset dir="${basedir}/lib/OpenCL/linux/x86" libs="OpenCL"/>
+ <syslibset dir="${opencl.platform.dir}/win/win32" libs="OpenCL"/>
+ </linker>
+
+ <linker id="linker.cfg.linux64.mingw64.jocl" extends="linker.cfg.linux64.mingw64">
+ <syslibset dir="${opencl.platform.dir}/win/x64" libs="OpenCL"/>
</linker>
+
</target>
</project> \ No newline at end of file
diff --git a/resources/opencl.h b/resources/opencl.h
index d1b0c795..8e46611c 100644
--- a/resources/opencl.h
+++ b/resources/opencl.h
@@ -1,7 +1,7 @@
#include <CL/cl_platform.h>
#include <CL/cl.h>
-#include <CL/cl_ext.h>
+//#include <CL/cl_ext.h>
#ifdef _WIN32
#include <windows.h>
diff --git a/test/com/mbien/opencl/HighLevelBindingTest.java b/test/com/mbien/opencl/HighLevelBindingTest.java
index 2a8807ad..bd6d7179 100644
--- a/test/com/mbien/opencl/HighLevelBindingTest.java
+++ b/test/com/mbien/opencl/HighLevelBindingTest.java
@@ -24,7 +24,9 @@ public class HighLevelBindingTest {
@BeforeClass
public static void setUpClass() throws Exception {
out.println("OS: " + System.getProperty("os.name"));
+ out.println("ARCH: " + System.getProperty("os.arch"));
out.println("VM: " + System.getProperty("java.vm.name"));
+ out.println("lib path: " + System.getProperty("java.library.path"));
}
@Test