Windows: Added build.xml.mingw for building with mingw compiler. Doesn't work yet since the RawInput API is not supported through mingw yet.

This commit is contained in:
elias 2006-07-15 22:39:32 +00:00
parent f0737680fa
commit e5b009c563
4 changed files with 87 additions and 2 deletions

View file

@ -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);

View file

@ -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, ...);

View file

@ -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>

View file

@ -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) {