aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/linux/src/native/build.xml
blob: ea5e9abd986d61d1fcfdbb0fbadc731c7e411e93 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<?xml version="1.0"?>

<!-- Written to assume that classpath is rooted in the current directory. -->
<!-- So this should be OK if you make this script in the root of a filesystem. -->
<!-- If not, you may prefer to adjust the basedir, or move some directories around. -->
<!-- The idea is that both Ant and NetBeans have to know what the package root is -->
<!-- for the classes in your application. -->
<project name="JInput Linux port, Native code" basedir="." default="all">

    <!-- Don't worry if you don't know the Ant syntax completely or need help on some tasks! -->
    <!-- The standard Ant documentation is bundled. See Help | Help Sets | Ant 1.4.1 Manual. -->

    <target name="init">
        <!-- You can set up any variables you want used throughout the script here. -->
        <!-- property name="hello" value="world"/-->
        <!-- To use e.g. Jikes, uncomment this line. -->
        <!-- (Or make the same change in Tools | Options | Ant Settings | Properties.) -->
        <!-- <property name="build.compiler" value="jikes"/> -->
        <!-- You might like to set up some overridable paths, etc.: -->
        <!-- <property name="mylib" value="../lib/mylib.jar"/> -->
        <mkdir dir="build"/>
        <mkdir dir="apidoc"/>
    </target>
    
    <target name="createNativeDefinitions.java" depends="init">
        <exec dir="." executable="./getDefinitions" os="Linux" output="../java/net/java/games/input/NativeDefinitions.java">
            <arg line="/usr/include/linux/input.h"/>
        </exec>
    </target>

    <target name="createJNIHeaders" depends="init">
        <javah>
            <classpath>
                <pathelement path="."/>
                <pathelement location="jinput.jar"/>
            </classpath>
            <class name="net.java.games.input.LinuxDevice"/>
            <class name="net.java.games.input.LinuxEnvironmentPlugin"/>
            <class name="net.java.games.input.LinuxKeyboard"/>
        </javah>
    </target>

    <target name="compileNativeEventLib" depends="init">
        <exec dir="." executable="g++" os="Linux">
            <arg line="--shared -DLOGTRACE -o libeventInterface.so eventInterface.cpp EventDevice.cpp"/>
        </exec>
    </target>

    <target name="compileNativeJinputLib" depends="init">
        <exec dir="." executable="g++" os="Linux">
            <arg line="-I${java.home}/include -I${java.home}/include/linux -I${java.home}/../include -I${java.home}/../include/linux --shared -DLOGTRACE -o libjinput.so jinput.cpp eventInterface.cpp EventDevice.cpp joystickInterface.cpp JoystickDevice.cpp MixedDevice.cpp"/>
        </exec>
    </target>
</project>