<?xml version="1.0" encoding="UTF-8"?>
<!--
    Document   : build-crosscompile.xml
    Created on : November 18, 2009, 3:38 PM
    Author     : Michael Bien
    Description:
        crosscompiler configuration and ant task for crosscompiling for
        linux32/64 and win32/64 on linux64 as host system.
-->
<project name="gluegen-crosscompiler" basedir="." default="gluegen.cross-compile">

    <import file="build.xml"/>

    <!-- TODO remove hardcoded path -->
    <property name="java.includes.dir.windows" value="/media/store/gluegenSetup/win32"/>

    <!-- crosscompiles to other platforms, requirement: linux64 host os -->
    <target name="gluegen.cross-compile">

        <echo message=" - - - cross-compiling gluegen natives - - - "/>

        <antcall target="build.nativelibrary" 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"/>
        </antcall>

        <antcall target="build.nativelibrary" 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"/>
        </antcall>

        <!-- use mingw crosscompiler to compile for win32 and win64 (linux64 only) -->
        <antcall target="build.nativelibrary" 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="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.gluegen"/>
        </antcall>

        <antcall target="build.nativelibrary" 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="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.gluegen"/>
        </antcall>

        <echo message=" - - - gluegen natives cross-compiled - - - "/>

    </target>


    <target name="configure.crosscompiler">
        <linker id="linker.cfg.linux64.mingw64.gluegen" extends="linker.cfg.linux64.mingw64">
        </linker>

        <linker id="linker.cfg.linux64.mingw32.gluegen" extends="linker.cfg.linux64.mingw32">
        </linker>
    </target>

</project>