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

Support native Apple ARM64 #461

Conversation

cedrik-fuoco-adsk
Copy link
Contributor

@cedrik-fuoco-adsk cedrik-fuoco-adsk commented May 7, 2024

Support native Apple ARM64

Linked issues

n/a

Summarize your change.

Supporting both x86_64 and arm64 native build. You can build x86_64 on MacOS if you run the build under a terminal launched with arch -x86_64 (using Rosetta).

I made changes to some dependencies under cmake/dependencies to standardized the configure, command and install command used in externalproject_add since some dependencies were using a mix of CMake and Make command.

Describe the reason for the change.

Support native build of Apple chipset.

Describe what you have tested and on which operating system.

  • MacOS
  • Windows (CI)
  • Rocky Linux 9 (CI)

Add a list of changes, and note any that might need special attention during the review.

If possible, provide screenshots.

@cedrik-fuoco-adsk cedrik-fuoco-adsk force-pushed the native-apple-arm64 branch 2 times, most recently from 226de1e to e9c7a24 Compare May 7, 2024 18:35
@geffrak
Copy link
Contributor

geffrak commented May 7, 2024

I'm not convinced that CMAKE_OSX_ARCHITECTURES is a good solution. Only some third-party dependencies support it (as you can see with Python and OpenSSL). Let's get rid of it and build everything natively. If someone wants to build x86_64 from an Apple Silicon host, that person starts his terminal with arch -x86_64 and builds.

Am I missing something?

Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com>
Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com>
@cedrik-fuoco-adsk
Copy link
Contributor Author

cedrik-fuoco-adsk commented May 10, 2024

In my mind, there is a difference between cross-compiling and Rosetta since Rosetta is more an emulator/translator than a cross-compiler. For example, when you are building for iOS, you are not using Rosetta, you are using a cross-compiler. So at first, I treated the ARM64 the same way.

So the question is whether we want to support cross-compilation or just native builds. If we want to support cross-compilation, CMAKE_OSX_ARCHITECTURES is the right choice, otherwise it is not needed.

After discussion with @bernie-laberge about your comment @geffrak, we don't really see a use-case to support cross-compilation. So I removed the changed I did about CMAKE_OSX_ARCHITECTURES and we will just support native build.

But like you said, you can still build for x86_64 from arm64 using a terminal launched with arch -x86_64 (using Rosetta).

@cedrik-fuoco-adsk cedrik-fuoco-adsk marked this pull request as ready for review May 10, 2024 14:50
Copy link
Contributor

@bernie-laberge bernie-laberge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow ! Beautiful and nice cleanup !
Thanks

@cedrik-fuoco-adsk cedrik-fuoco-adsk merged commit e78d986 into AcademySoftwareFoundation:main May 16, 2024
2 checks passed
cedrik-fuoco-adsk added a commit that referenced this pull request May 17, 2024
cedrik-fuoco-adsk added a commit that referenced this pull request May 17, 2024
This reverts commit e78d986.

Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants