Allow cross-compiling to Linux cpp from other operating systems
Similar to #1661, except targeting Linux instead of Windows On macOS, need to install https://github.com/messense/homebrew-macos-cross-toolchains On Windows, I think it may be possible to get Linux compilers with Cygwin, but I haven't tried
This commit is contained in:
@@ -750,7 +750,12 @@ class HXProject extends Script
|
|||||||
{
|
{
|
||||||
defines.set("native", "1");
|
defines.set("native", "1");
|
||||||
|
|
||||||
if (target == Platform.WINDOWS && targetFlags.exists("mingw"))
|
if (target == Platform.LINUX && targetFlags.exists("cpp"))
|
||||||
|
{
|
||||||
|
defines.set("targetType", "cpp");
|
||||||
|
defines.set("cpp", "1");
|
||||||
|
}
|
||||||
|
else if (target == Platform.WINDOWS && targetFlags.exists("mingw"))
|
||||||
{
|
{
|
||||||
defines.set("targetType", "cpp");
|
defines.set("targetType", "cpp");
|
||||||
defines.set("cpp", "1");
|
defines.set("cpp", "1");
|
||||||
|
|||||||
@@ -138,7 +138,7 @@ class LinuxPlatform extends PlatformTarget
|
|||||||
is64 = targetFlags.exists("64");
|
is64 = targetFlags.exists("64");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (project.targetFlags.exists("neko") || project.target != System.hostPlatform)
|
if (project.targetFlags.exists("neko"))
|
||||||
{
|
{
|
||||||
targetType = "neko";
|
targetType = "neko";
|
||||||
}
|
}
|
||||||
@@ -301,6 +301,59 @@ class LinuxPlatform extends PlatformTarget
|
|||||||
flags.push("-DHXCPP_M32");
|
flags.push("-DHXCPP_M32");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (project.target != System.hostPlatform)
|
||||||
|
{
|
||||||
|
var hxcpp_xlinux64_cxx = project.defines.get("HXCPP_XLINUX64_CXX");
|
||||||
|
if (hxcpp_xlinux64_cxx == null)
|
||||||
|
{
|
||||||
|
hxcpp_xlinux64_cxx = "x86_64-unknown-linux-gnu-g++";
|
||||||
|
}
|
||||||
|
var hxcpp_xlinux64_strip = project.defines.get("HXCPP_XLINUX64_STRIP");
|
||||||
|
if (hxcpp_xlinux64_strip == null)
|
||||||
|
{
|
||||||
|
hxcpp_xlinux64_strip = "x86_64-unknown-linux-gnu-strip";
|
||||||
|
}
|
||||||
|
var hxcpp_xlinux64_ranlib = project.defines.get("HXCPP_XLINUX64_RANLIB");
|
||||||
|
if (hxcpp_xlinux64_ranlib == null)
|
||||||
|
{
|
||||||
|
hxcpp_xlinux64_ranlib = "x86_64-unknown-linux-gnu-ranlib";
|
||||||
|
}
|
||||||
|
var hxcpp_xlinux64_ar = project.defines.get("HXCPP_XLINUX64_AR");
|
||||||
|
if (hxcpp_xlinux64_ar == null)
|
||||||
|
{
|
||||||
|
hxcpp_xlinux64_ar = "x86_64-unknown-linux-gnu-ar";
|
||||||
|
}
|
||||||
|
flags.push('-DHXCPP_XLINUX64_CXX=$hxcpp_xlinux64_cxx');
|
||||||
|
flags.push('-DHXCPP_XLINUX64_STRIP=$hxcpp_xlinux64_strip');
|
||||||
|
flags.push('-DHXCPP_XLINUX64_RANLIB=$hxcpp_xlinux64_ranlib');
|
||||||
|
flags.push('-DHXCPP_XLINUX64_AR=$hxcpp_xlinux64_ar');
|
||||||
|
|
||||||
|
var hxcpp_xlinux32_cxx = project.defines.get("HXCPP_XLINUX32_CXX");
|
||||||
|
if (hxcpp_xlinux32_cxx == null)
|
||||||
|
{
|
||||||
|
hxcpp_xlinux32_cxx = "i686-unknown-linux-gnu-g++";
|
||||||
|
}
|
||||||
|
var hxcpp_xlinux32_strip = project.defines.get("HXCPP_XLINUX32_STRIP");
|
||||||
|
if (hxcpp_xlinux32_strip == null)
|
||||||
|
{
|
||||||
|
hxcpp_xlinux32_strip = "i686-unknown-linux-gnu-strip";
|
||||||
|
}
|
||||||
|
var hxcpp_xlinux32_ranlib = project.defines.get("HXCPP_XLINUX32_RANLIB");
|
||||||
|
if (hxcpp_xlinux32_ranlib == null)
|
||||||
|
{
|
||||||
|
hxcpp_xlinux32_ranlib = "i686-unknown-linux-gnu-ranlib";
|
||||||
|
}
|
||||||
|
var hxcpp_xlinux32_ar = project.defines.get("HXCPP_XLINUX32AR");
|
||||||
|
if (hxcpp_xlinux32_ar == null)
|
||||||
|
{
|
||||||
|
hxcpp_xlinux32_ar = "i686-unknown-linux-gnu-ar";
|
||||||
|
}
|
||||||
|
flags.push('-DHXCPP_XLINUX32_CXX=$hxcpp_xlinux32_cxx');
|
||||||
|
flags.push('-DHXCPP_XLINUX32_STRIP=$hxcpp_xlinux32_strip');
|
||||||
|
flags.push('-DHXCPP_XLINUX32_RANLIB=$hxcpp_xlinux32_ranlib');
|
||||||
|
flags.push('-DHXCPP_XLINUX32_AR=$hxcpp_xlinux32_ar');
|
||||||
|
}
|
||||||
|
|
||||||
if (!project.targetFlags.exists("static"))
|
if (!project.targetFlags.exists("static"))
|
||||||
{
|
{
|
||||||
System.runCommand("", "haxe", haxeArgs);
|
System.runCommand("", "haxe", haxeArgs);
|
||||||
|
|||||||
Reference in New Issue
Block a user