aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorelias <[email protected]>2006-07-15 22:39:32 +0000
committerelias <[email protected]>2006-07-15 22:39:32 +0000
commitd8032e326132bf926afdc9544b405d08943b2fa2 (patch)
tree64d1644797f6f7f9e52751919b1ed70bef03a692
parent231c94ae0be37b163c04b3b76f59ad11e09e61d8 (diff)
Windows: Added build.xml.mingw for building with mingw compiler. Doesn't work yet since the RawInput API is not supported through mingw yet.
git-svn-id: file:///home/sven/projects/JOGL/git-svn/svn-server-sync/jinput/trunk@154 e343933a-64c8-49c5-92b1-88f2ce3e89e8
-rw-r--r--plugins/common/src/native/util.c2
-rw-r--r--plugins/common/src/native/util.h5
-rw-r--r--plugins/windows/src/native/build.xml.mingw80
-rw-r--r--plugins/windows/src/native/net_java_games_input_DummyWindow.c2
4 files changed, 87 insertions, 2 deletions
diff --git a/plugins/common/src/native/util.c b/plugins/common/src/native/util.c
index 745a265..089ba17 100644
--- a/plugins/common/src/native/util.c
+++ b/plugins/common/src/native/util.c
@@ -46,7 +46,7 @@ static jstring sprintfJavaString(JNIEnv *env, const char *format, va_list ap) {
#define BUFFER_SIZE 4000
char buffer[BUFFER_SIZE];
jstring str;
-#ifdef _WIN32
+#ifdef _MSC_VER
vsnprintf_s(buffer, BUFFER_SIZE, _TRUNCATE, format, ap);
#else
vsnprintf(buffer, BUFFER_SIZE, format, ap);
diff --git a/plugins/common/src/native/util.h b/plugins/common/src/native/util.h
index 58a62f4..657a93d 100644
--- a/plugins/common/src/native/util.h
+++ b/plugins/common/src/native/util.h
@@ -40,6 +40,11 @@
#include <stdio.h>
#include <stdlib.h>
#include <jni.h>
+#ifdef _MSC_VER
+#include <Basetsd.h>
+#else
+#include <inttypes.h>
+#endif
extern void printfJava(JNIEnv *env, const char *format, ...);
extern void throwRuntimeException(JNIEnv * env, const char *format, ...);
diff --git a/plugins/windows/src/native/build.xml.mingw b/plugins/windows/src/native/build.xml.mingw
new file mode 100644
index 0000000..af034be
--- /dev/null
+++ b/plugins/windows/src/native/build.xml.mingw
@@ -0,0 +1,80 @@
+<?xml version="1.0"?>
+
+<project name="JInput dx8 port, Native code" basedir="." default="compile">
+ <property environment="env"/>
+ <property name="dxhome" location="${env.DXSDK_DIR}"/>
+ <property name="sdkhome" location="${env.MSSDk}"/>
+ <property name="chome" location="c:/MinGW"/>
+ <property name="gcc" location="${chome}/bin/gcc"/>
+
+ <target name="compile_dir">
+ <echo message="${compiledir}"/>
+ <apply dir="${compiledir}" failonerror="true" executable="${gcc}" dest="${compiledir}" skipemptyfilesets="true">
+ <arg line="-c -Wall -O2 -std=gnu99"/>
+ <arg value="-I${sdkhome}\include"/>
+ <arg value="-I${dxhome}\include"/>
+ <arg value="-I${java.home}\..\include"/>
+ <arg value="-I${java.home}\..\include\win32"/>
+ <arg value="-I${commonhome}/src/native"/>
+ <arg value="-I.."/>
+ <srcfile/>
+ <fileset dir="${compiledir}" includes="*.c"/>
+ <mapper type="glob" from="*.c" to="*.o"/>
+ </apply>
+ </target>
+
+ <target name="link">
+ <apply dir="." parallel="true" executable="cl" failonerror="true">
+ <arg value="-Wl,--kill-at"/>
+ <arg line="-shared -o ${dllname}"/>
+ <srcfile/>
+ <arg value="-L${java.home}/lib"/>
+ <arg value="-L${dxhome}/lib/x86"/>
+ <arg value="-L${sdkhome}/lib"/>
+ <arg line="${libs}"/>
+ <fileset dir="${commonhome}/src/native" includes="*.o"/>
+ <fileset dir="." includes="*.o"/>
+ <fileset dir="${objdir}" includes="*.o"/>
+ </apply>
+ </target>
+
+ <target name="clean">
+ <delete>
+ <fileset dir="." includes="*.o"/>
+ <fileset dir="raw" includes="*.o"/>
+ <fileset dir="dx8" includes="*.o"/>
+ <fileset dir="." includes="*.dll"/>
+ </delete>
+ </target>
+
+ <target name="compile">
+ <property name="rawlibs" value="Kernel32 User32 Setupapi"/>
+ <property name="dx8libs" value="Kernel32 dinput8 dxguid User32"/>
+ <property name="commonhome" location="../../../common"/>
+ <property name="dx8dllname" value="jinput-dx8.dll"/>
+ <property name="rawdllname" value="jinput-raw.dll"/>
+ <antcall target="compile_dir">
+ <param name="compiledir" location="${commonhome}/src/native"/>
+ </antcall>
+ <antcall target="compile_dir">
+ <param name="compiledir" location="."/>
+ </antcall>
+ <antcall target="compile_dir">
+ <param name="compiledir" location="raw"/>
+ </antcall>
+ <antcall target="compile_dir">
+ <param name="compiledir" location="dx8"/>
+ </antcall>
+ <antcall target="link">
+ <param name="dllname" value="${dx8dllname}"/>
+ <param name="libs" value="${dx8libs}"/>
+ <param name="objdir" location="dx8"/>
+ </antcall>
+ <antcall target="link">
+ <param name="dllname" value="${rawdllname}"/>
+ <param name="libs" value="${rawlibs}"/>
+ <param name="objdir" location="raw"/>
+ </antcall>
+ </target>
+</project>
+
diff --git a/plugins/windows/src/native/net_java_games_input_DummyWindow.c b/plugins/windows/src/native/net_java_games_input_DummyWindow.c
index 539e45c..1aa1832 100644
--- a/plugins/windows/src/native/net_java_games_input_DummyWindow.c
+++ b/plugins/windows/src/native/net_java_games_input_DummyWindow.c
@@ -59,7 +59,7 @@ JNIEXPORT jlong JNICALL Java_net_java_games_input_DummyWindow_createWindow(JNIEn
throwIOException(env, "Failed to create window (%d)\n", GetLastError());
return 0;
}
- return (jlong)hwndDummy;
+ return (jlong)(intptr_t)hwndDummy;
}
JNIEXPORT void JNICALL Java_net_java_games_input_DummyWindow_nDestroy(JNIEnv *env, jclass unused, jlong hwnd_address) {