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

Let CMake autodetect Apple arch on M1 processor #1868

Merged
merged 1 commit into from Dec 6, 2021
Merged

Let CMake autodetect Apple arch on M1 processor #1868

merged 1 commit into from Dec 6, 2021

Conversation

pparuzel
Copy link
Contributor

@pparuzel pparuzel commented Dec 5, 2021

Description

With the introduction of Apple M1 processor the architecture for SFML build need not be imposed unless specified explicitly. It feels more intuitive to let CMake decide on what the default architecture should be for a specified Apple processor.

Tasks

Changes affect only Apple systems

  • Tested on macOS
  • Tested on iOS

How to test this PR?

Simply assert that this finishes successfully on Apple M1:

# On Apple M1 processor natively
cmake -B build-native
cmake --build build-native -j12

# On Apple M1 processor with arch x86_64
cmake -B build-x86 -DCMAKE_OSX_ARCHITECTURES=x86_64
cmake --build build-x86 -j12

echo "Test results:"
[[ ! -z $(otool -hv build-native/lib/libsfml-system.dylib | grep -io arm64) ]] && echo "SUCCESS ARM64" || echo "FAILED ARM64"
[[ ! -z $(otool -hv build-x86/lib/libsfml-system.dylib | grep -io x86_64) ]] && echo "SUCCESS x86_64" || echo "FAILED x86_64"

@eXpl0it3r eXpl0it3r added this to Discussion in SFML 2.6.0 via automation Dec 5, 2021
@eXpl0it3r eXpl0it3r added this to the 2.6 milestone Dec 5, 2021
@eXpl0it3r
Copy link
Member

Yeah, I've ran into this as well and it makes sense to not enforce it anymore.

Could you rebase this onto 2.6.x and change the target branch to 2.6.x?

@eXpl0it3r eXpl0it3r self-assigned this Dec 5, 2021
@pparuzel pparuzel changed the base branch from master to 2.6.x December 5, 2021 14:29
@pparuzel
Copy link
Contributor Author

pparuzel commented Dec 5, 2021

Rebased and had to force-push to drop commits from 3.0

SFML 2.6.0 automation moved this from Discussion to Ready Dec 5, 2021
@eXpl0it3r eXpl0it3r merged commit d0ebdc8 into SFML:2.6.x Dec 6, 2021
SFML 2.6.0 automation moved this from Ready to Done Dec 6, 2021
@eXpl0it3r
Copy link
Member

Thanks for this fix! 🙂
As we don't have (m)any macOS developers, feel free to open or PRs or start discussions on the forum, if you see something the could improve the macOS experience.

@pparuzel pparuzel deleted the enhancement/apple-autodetect-m1-arch branch December 6, 2021 15:57
@pparuzel
Copy link
Contributor Author

pparuzel commented Dec 6, 2021

Glad I could be of help!

I'm excited to see the library expand into the Modern C++ world and I independently came back here after a couple of years to realize the transition is just starting :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
SFML 2.6.0
  
Done
Development

Successfully merging this pull request may close these issues.

None yet

2 participants