Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

set correct paths for ndll for linxuarm and linuxarm64 (raspberrypi) #1834

Merged
merged 1 commit into from
Oct 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions project/Build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -235,9 +235,6 @@

<section if="rpi">

<compilerflag value="-I/opt/vc/include" />
<compilerflag value="-I/opt/vc/include/interface/vcos/pthreads" />
<compilerflag value="-I/opt/vc/include/interface/vmcs_host/linux" />
<compilerflag value="-I/usr/include/libdrm" />
<compilerflag value="-I/usr/include/dbus-1.0" />
<compilerflag value="-I/usr/lib/arm-linux-gnueabihf/dbus-1.0/include" unless="HXCPP_ARM64" />
Expand Down Expand Up @@ -510,9 +507,6 @@
<lib name="-lm" />
<lib name="-lEGL" />
<lib name="-lGLESv2" />
<!-- For legacy Pi driver support -->
<lib name="-lbcm_host" />
<lib name="-L/opt/vc/lib" />

</section>

Expand Down
8 changes: 8 additions & 0 deletions src/lime/tools/HTML5Helper.hx
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,14 @@ class HTML5Helper
{
suffix += "32";
}
else if( System.hostArchitecture == ARMV7)
{
suffix += "Arm";
}
else if( System.hostArchitecture == ARM64)
{
suffix += "Arm64";
}
else
{
suffix += "64";
Expand Down
10 changes: 4 additions & 6 deletions tools/CommandLineTools.hx
Original file line number Diff line number Diff line change
Expand Up @@ -496,16 +496,14 @@ class CommandLineTools

case LINUX:
var arguments = Sys.args();
var raspberryPi = false;

for (argument in arguments)
if (System.hostArchitecture == ARMV7 )
{
if (argument == "-rpi") raspberryPi = true;
untyped $loader.path = $array(path + "LinuxArm/", $loader.path);
}

if (raspberryPi || System.hostArchitecture == ARMV6 || System.hostArchitecture == ARMV7)
else if (System.hostArchitecture == ARM64)
{
untyped $loader.path = $array(path + "RPi/", $loader.path);
untyped $loader.path = $array(path + "LinuxArm64/", $loader.path);
}
else if (System.hostArchitecture == X64)
{
Expand Down
10 changes: 5 additions & 5 deletions tools/RunScript.hx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class RunScript

if (!rebuildBinaries) return;

var platforms = ["Windows", "Mac", "Mac64", "MacArm64", "Linux", "Linux64"];
var platforms = ["Windows", "Mac", "Mac64", "MacArm64", "Linux", "Linux64", "LinuxArm", "LinuxArm64"];

for (platform in platforms)
{
Expand Down Expand Up @@ -70,14 +70,14 @@ class RunScript
System.runCommand(limeDirectory, "neko", args.concat(["mac", toolsDirectory]));
}

case "Linux":
if (System.hostPlatform == LINUX && System.hostArchitecture != X64)
case "Linux", "LinuxArm":
if (System.hostPlatform == LINUX && System.hostArchitecture != X64 && System.hostArchitecture != ARM64)
{
System.runCommand(limeDirectory, "neko", args.concat(["linux", "-32", toolsDirectory]));
}

case "Linux64":
if (System.hostPlatform == LINUX && System.hostArchitecture == X64)
case "Linux64", "LinuxArm64":
if (System.hostPlatform == LINUX && (System.hostArchitecture == X64 || System.hostArchitecture == ARM64))
{
System.runCommand(limeDirectory, "neko", args.concat(["linux", "-64", toolsDirectory]));
}
Expand Down
10 changes: 4 additions & 6 deletions tools/SVGExport.hx
Original file line number Diff line number Diff line change
Expand Up @@ -78,16 +78,14 @@ class SVGExport

case LINUX:
var arguments = Sys.args();
var raspberryPi = false;

for (argument in arguments)
if ( System.hostArchitecture == ARMV7 )
{
if (argument == "-rpi") raspberryPi = true;
untyped $loader.path = $array(path + "LinuxArm/", $loader.path);
}

if (raspberryPi)
else if (System.hostArchitecture == ARM64)
{
untyped $loader.path = $array(path + "RPi/", $loader.path);
untyped $loader.path = $array(path + "LinuxArm64/", $loader.path);
}
else if (System.hostArchitecture == X64)
{
Expand Down
104 changes: 37 additions & 67 deletions tools/platforms/LinuxPlatform.hx
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ class LinuxPlatform extends PlatformTarget
defaults.architectures = [ARMV6];
case ARMV7:
defaults.architectures = [ARMV7];
case ARM64:
defaults.architectures = [ARM64];
case X86:
defaults.architectures = [X86];
case X64:
Expand All @@ -120,24 +122,16 @@ class LinuxPlatform extends PlatformTarget

for (architecture in project.architectures)
{
if (!targetFlags.exists("32") && !targetFlags.exists("x86_32") && architecture == Architecture.X64)
if (!targetFlags.exists("32") && !targetFlags.exists("x86_32") && (architecture == Architecture.X64 || architecture == Architecture.ARM64))
{
is64 = true;
}
else if (architecture == Architecture.ARMV7)
{
// TODO: can we assume this is actually a Pi? probably not. -JT
isRaspberryPi = true;
is64 = false;
}
}

if (project.targetFlags.exists("rpi"))
{
isRaspberryPi = true;
is64 = targetFlags.exists("64");
}

if (project.targetFlags.exists("neko"))
{
targetType = "neko";
Expand Down Expand Up @@ -183,16 +177,9 @@ class LinuxPlatform extends PlatformTarget
{
ProjectHelper.copyLibrary(project, ndll, "Linux" + (is64 ? "64" : ""), "", ".hdll", applicationDirectory, project.debug, targetSuffix);
}
else if (isRaspberryPi)
{
ProjectHelper.copyLibrary(project, ndll, "RPi" + (is64 ? "64" : ""), "",
(ndll.haxelib != null
&& (ndll.haxelib.name == "hxcpp" || ndll.haxelib.name == "hxlibc")) ? ".dso" : ".ndll", applicationDirectory,
project.debug, targetSuffix);
}
else
{
ProjectHelper.copyLibrary(project, ndll, "Linux" + (is64 ? "64" : ""), "",
ProjectHelper.copyLibrary(project, ndll, "Linux" + (( System.hostArchitecture == ARMV7 || System.hostArchitecture == ARM64)?"Arm":"") + (is64 ? "64" : ""), "",
(ndll.haxelib != null
&& (ndll.haxelib.name == "hxcpp" || ndll.haxelib.name == "hxlibc")) ? ".dll" : ".ndll", applicationDirectory,
project.debug, targetSuffix);
Expand All @@ -206,16 +193,9 @@ class LinuxPlatform extends PlatformTarget

if (noOutput) return;

if (isRaspberryPi)
{
NekoHelper.createExecutable(project.templatePaths, "rpi", targetDirectory + "/obj/ApplicationMain.n", executablePath);
NekoHelper.copyLibraries(project.templatePaths, "rpi", applicationDirectory);
}
else
{
NekoHelper.createExecutable(project.templatePaths, "linux" + (is64 ? "64" : ""), targetDirectory + "/obj/ApplicationMain.n", executablePath);
NekoHelper.copyLibraries(project.templatePaths, "linux" + (is64 ? "64" : ""), applicationDirectory);
}
NekoHelper.createExecutable(project.templatePaths, "linux" + (( System.hostArchitecture == ARMV7 || System.hostArchitecture == ARM64)?"Arm":"") + (is64 ? "64" : ""), targetDirectory + "/obj/ApplicationMain.n", executablePath);
NekoHelper.copyLibraries(project.templatePaths, "linux" + (is64 ? "64" : ""), applicationDirectory);

}
else if (targetType == "hl")
{
Expand Down Expand Up @@ -281,7 +261,7 @@ class LinuxPlatform extends PlatformTarget

if (is64)
{
if (isRaspberryPi)
if (System.hostArchitecture == ARM64)
{
haxeArgs.push("-D");
haxeArgs.push("HXCPP_ARM64");
Expand Down Expand Up @@ -412,7 +392,7 @@ class LinuxPlatform extends PlatformTarget
{
// var project = project.clone ();

if (isRaspberryPi)
if(targetFlags.exists('rpi'))
{
project.haxedefs.set("rpi", 1);
}
Expand Down Expand Up @@ -469,36 +449,33 @@ class LinuxPlatform extends PlatformTarget
{
var commands = [];

if (targetFlags.exists("rpi"))
{
if (is64)
{
commands.push([
"-Dlinux",
"-Drpi",
"-Dtoolchain=linux",
"-DBINDIR=RPi64",
"-DHXCPP_ARM64",
"-DCXX=aarch64-linux-gnu-g++",
"-DHXCPP_STRIP=aarch64-linux-gnu-strip",
"-DHXCPP_AR=aarch64-linux-gnu-ar",
"-DHXCPP_RANLIB=aarch64-linux-gnu-ranlib"
]);
}
else
{
commands.push([
"-Dlinux",
"-Drpi",
"-Dtoolchain=linux",
"-DBINDIR=RPi",
"-DHXCPP_M32",
"-DCXX=arm-linux-gnueabihf-g++",
"-DHXCPP_STRIP=arm-linux-gnueabihf-strip",
"-DHXCPP_AR=arm-linux-gnueabihf-ar",
"-DHXCPP_RANLIB=arm-linux-gnueabihf-ranlib"
]);
}
if (System.hostArchitecture == ARM64 )
{
commands.push([
"-Dlinux",
"-Drpi",
"-Dtoolchain=linux",
"-DBINDIR=LinuxArm64",
"-DHXCPP_ARM64",
"-DCXX=aarch64-linux-gnu-g++",
"-DHXCPP_STRIP=aarch64-linux-gnu-strip",
"-DHXCPP_AR=aarch64-linux-gnu-ar",
"-DHXCPP_RANLIB=aarch64-linux-gnu-ranlib"
]);
}
else if (System.hostArchitecture == ARMV7)
{
commands.push([
"-Dlinux",
"-Drpi",
"-Dtoolchain=linux",
"-DBINDIR=LinuxArm",
"-DHXCPP_M32",
"-DCXX=arm-linux-gnueabihf-g++",
"-DHXCPP_STRIP=arm-linux-gnueabihf-strip",
"-DHXCPP_AR=arm-linux-gnueabihf-ar",
"-DHXCPP_RANLIB=arm-linux-gnueabihf-ranlib"
]);
}
else if (targetFlags.exists("hl") && System.hostArchitecture == X64)
{
Expand Down Expand Up @@ -584,14 +561,7 @@ class LinuxPlatform extends PlatformTarget

if (ndll.path == null || ndll.path == "")
{
if (isRaspberryPi)
{
context.ndlls[i].path = NDLL.getLibraryPath(ndll, "RPi" + (is64 ? "64" : ""), "lib", ".a", project.debug);
}
else
{
context.ndlls[i].path = NDLL.getLibraryPath(ndll, "Linux" + (is64 ? "64" : ""), "lib", ".a", project.debug);
}
context.ndlls[i].path = NDLL.getLibraryPath(ndll, "Linux" + (( System.hostArchitecture == ARMV7 || System.hostArchitecture == ARM64) ? "Arm" : "") + (is64 ? "64" : ""), "lib", ".a", project.debug);
}
}
}
Expand Down
Loading