-
-
Notifications
You must be signed in to change notification settings - Fork 376
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 HXCPP_ARM64 by default when building on Apple Silicon Mac #1752
Conversation
I'm not a fan of the preexisting Looking at the code, we see that only a 64-bit machine can compile the 64-bit ndll. Makes sense. if (!targetFlags.exists("32") && System.hostArchitecture == X64)
{
commands.push(["-Dmac", "-DHXCPP_CLANG", "-DHXCPP_M64"]);
} It doesn't require the "64" flag to be set, just the absence of the "32" flag. That way, the user can run the A bit further down, we see that both 32- and 64-bit machines can compile a 32-bit ndll, the former by default and the latter if the "32" flag is set.
In no case can you compile both types at once, so there isn't a clear reason for these to be separate The real problem here is that the M1 exists. What if There has to be a better way to organize all of this code. Maybe |
The old logic could produce inappropriate results, such as attempting to compile an x86 binary on ARM64, or compiling no binary when "64" is specified on a 32-bit machine. I'd argue that it makes sense to only check the flags when they're supported, and not to bother otherwise.
Thanks, the new version is fine with me. |
I was just trying to simplify the code a bit, but this is turning into a whole adventure. If I'd realized there would be this many issues, I'd have done it locally instead. |
Seems to be working now. But so much of this isn't relevant to this PR... Perhaps we should go back to 17ad057, and I'll make another PR for the enum changes. |
Yeah, I think that's for the best. (I would but I haven't figured out how to push to someone else's PR branch from the command line.) |
424ef3c
to
17ad057
Compare
Hmm, now we're back to choosing between three architectures, even though the Ok, new idea... |
I don't know if there are any ARMv6 or ARMv7 Macs, but they were in the old switch block, so maybe?
That ought to work the same without requiring all those changes to other files. Other than that, I'm a bit concerned about HashLink forcing x64. That's the closest equivalent to else if (project.targetFlags.exists("hl"))
{
targetType = "hl";
+ if (targetArchitecture != ARM64)
+ {
targetArchitecture = X64;
+ }
} Or perhaps And why does HL force an architecture in the first place? I can only assume there's some bug when you try to compile for 32 bits, but I don't know if making an x86 machine try to compile an x64 binary is better... |
Hashlink bytcode isn't supported on Apple Silicon right now anyway (and I don't think lime supports hlc compilation?), so it might be fine to leave it for now until Hashlink has proper arm64 support. I imagine compiling lime.hdll on arm64 will probably require a bit more work than this flag patch. This PR will sort out the flags for the cpp target at least.
From what I know, 32 bit mac systems are pretty hard to come by nowadays. |
I have HL/C compilation working for Lime/OpenFL in a branch. Will be merging into 8.2.0-Dev soon. |
Looks like |
Originally, we forced compilation on x86, presumably because at the time HashLink lacked good 64-bit support. When this support improved, the line was changed to force x64 compilation rather than being removed, which may have been a mistake. Now that there are even more valid architectures, it just doesn't make sense to force one.
Looks like Linux and Windows also have equivalent lines to the |
Thanks! |
Based on the title alone, this PR initially sounded to me like something that shouldn't go into a hypothetical Lime 8.1.2 bug fix release, and should wait for Lime 8.2.0, so I was concerned to see that this was merged into develop instead of 8.2.0-Dev. However, I just pulled from develop, rebuilt Lime tools, and I'm seeing that Could it be because my Haxe is compiled for x86_64, and is running in Rosetta, so Lime tools is being tricked into thinking that it is running on x86_64 instead of Apple Silicon? If that's the case, then I'm much less concerned about this going into develop. I just want to make sure that I understand what's going on. |
In a rosetta environment, hxp detects the host architecture to be x86_64: https://apple.stackexchange.com/questions/420452/running-uname-m-gives-x86-64-on-m1-mac-mini |
Perfect. Thanks! |
No description provided.