First commit for windows

This commit is contained in:
Endolf 2018-05-09 18:55:55 +01:00
parent 4517180482
commit 289a6db298
3 changed files with 76 additions and 138 deletions

View file

@ -1,25 +1,12 @@
<?xml version="1.0"?>
<project name="Direct Input Plugin" basedir="." default="all">
<project name="Direct Input Plugin" basedir=".">
<target name="init">
<mkdir dir="classes"/>
<mkdir dir="bin"/>
<condition property="dx8" >
<os family="Windows" />
</condition>
<mkdir dir="target/natives"/>
<mkdir dir="target/generated-sources/natives"/>
</target>
<target name="compile" depends="init">
<javac srcdir="src/java" destdir="classes" debug="true" deprecation="true" source="1.4" target="1.4">
<!-- To add something to the classpath: -->
<classpath>
<pathelement location="../../coreAPI/bin/jinput-core.jar"/>
<pathelement location="../../lib/jutils.jar"/>
</classpath>
</javac>
</target>
<target depends="init,compile" name="create_jniheaders">
<javah destdir="src/native/dx8">
<target depends="init" name="create_jniheaders">
<javah destdir="target/generated-sources/natives">
<classpath>
<pathelement path="classes"/>
<pathelement location="../../coreAPI/classes"/>
@ -28,14 +15,14 @@
<class name="net.java.games.input.IDirectInputDevice"/>
<class name="net.java.games.input.IDirectInputEffect"/>
</javah>
<javah destdir="src/native">
<javah destdir="target/generated-sources/natives">
<classpath>
<pathelement path="classes"/>
<pathelement location="../../coreAPI/classes"/>
<pathelement path="target/classes"/>
<pathelement location="../../coreAPI/target/classes"/>
</classpath>
<class name="net.java.games.input.DummyWindow"/>
</javah>
<javah destdir="src/native/raw">
<javah destdir="target/generated-sources/natives">
<classpath>
<pathelement path="classes"/>
<pathelement location="../../coreAPI/bin/jinput-core.jar"/>
@ -46,41 +33,8 @@
</javah>
</target>
<target name="compile_native" depends="init,create_jniheaders" if="dx8">
<target name="compile_native" depends="init,create_jniheaders">
<ant dir="src/native" target="compile"/>
<copy todir="bin">
<fileset dir="src/native" includes="*.dll"/>
</copy>
</target>
<target name="jar" depends="init,compile">
<jar jarfile="bin/dxinput.jar" compress="true" basedir="classes">
<include name="**/*.class"/>
</jar>
</target>
<target name="all" depends="compile,compile_native,jar" description="Build everything.">
</target>
<target name="javadoc" depends="init" description="Javadoc for my API.">
<mkdir dir="apidocs"/>
<javadoc packagenames="net.*"
destdir="apidocs"
additionalparam="-source 1.4">
<sourcepath>
<pathelement location="src/java"/>
</sourcepath>
<classpath>
<pathelement location="../../bin/jinput-core.jar"/>
<pathelement location="../../lib/jutils.jar"/>
</classpath>
</javadoc>
</target>
<target name="clean" depends="init" description="Clean all build products.">
<delete dir="classes" failonerror="no"/>
<delete dir="bin" failonerror="no"/>
<delete dir="apidocs" failonerror="no"/>
<ant inheritAll="false" antfile="src/native/build.xml" target="clean"/>
</target>
</project>

66
plugins/windows/pom.xml Normal file
View file

@ -0,0 +1,66 @@
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<artifactId>windows-plugin</artifactId>
<packaging>jar</packaging>
<name>JInput - Windows Plugin</name>
<parent>
<groupId>net.java.jinput</groupId>
<artifactId>plugins</artifactId>
<version>2.0.8-SNAPSHOT</version>
<relativePath>../</relativePath>
</parent>
<dependencies>
<dependency>
<groupId>net.java.jinput</groupId>
<artifactId>coreapi</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-source-plugin</artifactId>
</plugin>
<plugin>
<artifactId>maven-javadoc-plugin</artifactId>
</plugin>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<phase>compile</phase>
<configuration>
<target>
<ant dir="." target="compile_native"/>
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>jar</goal>
</goals>
<configuration>
<classesDirectory>${project.build.directory}/natives</classesDirectory>
<classifier>natives-windows</classifier>
<includes>
<include>*.dll</include>
</includes>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View file

@ -1,82 +0,0 @@
<?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="plthome" location="${env.MSSdk}"/>
<property name="chome" location="c:/MinGW"/>
<property name="gcc" location="${chome}/bin/gcc"/>
<property name="strip" location="${chome}/bin/strip"/>
<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${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="${gcc}" 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 line="${libs}"/>
<fileset dir="${commonhome}/src/native" includes="*.o"/>
<fileset dir="." includes="*.o"/>
<fileset dir="${objdir}" includes="*.o"/>
</apply>
<apply dir="." executable="${strip}" failonerror="true">
<fileset dir="." includes="${dllname}"/>
</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="-lkernel32 -luser32 -lsetupapi -luuid"/>
<property name="dx8libs" value="-lkernel32 -ldinput8 -ldxguid -luser32"/>
<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>