We recently found in a discussion that godot-cpp arch build behavior does not match Godot upstream.
In particular, godot-cpp defaults to building universal binaries (which passes the appropriate flags to the compiler to build both). The gdextension usually loads the same binary for both arm64 and x86_64 (as per godot-cpp-template).
Godot, on the other hand, builds arm64 and x86_64 separately and joins them afterwards with lipo. It does not support a 'universal' arch target.
One problem with the universal approach used by godot-cpp is that for universal builds, no architecture-specific build flags can be passed to the compilers (such as -mavx), because then the other architecture won't build (e.g. -mavx is not arm64 compatible). Notably, godot-cpp already supports compiling for the arches separately.
Changing the default behavior would affect all current macOS compatible godot-cpp extensions, because they will (likely) build with the default universal target right now (as per godot-cpp-template). We will have to figure out whether a change to separate the binaries will affect exports, especially for universal macOS apps.
We discussed this briefly at the last GDExtension meeting, and would like to have input on this before proceeding (especially from @Faless).
We recently found in a discussion that godot-cpp arch build behavior does not match Godot upstream.
In particular, godot-cpp defaults to building universal binaries (which passes the appropriate flags to the compiler to build both). The gdextension usually loads the same binary for both
arm64andx86_64(as per godot-cpp-template).Godot, on the other hand, builds
arm64andx86_64separately and joins them afterwards withlipo. It does not support a 'universal' arch target.One problem with the
universalapproach used by godot-cpp is that for universal builds, no architecture-specific build flags can be passed to the compilers (such as-mavx), because then the other architecture won't build (e.g.-mavxis not arm64 compatible). Notably, godot-cpp already supports compiling for the arches separately.Changing the default behavior would affect all current macOS compatible godot-cpp extensions, because they will (likely) build with the default
universaltarget right now (as per godot-cpp-template). We will have to figure out whether a change to separate the binaries will affect exports, especially for universal macOS apps.We discussed this briefly at the last GDExtension meeting, and would like to have input on this before proceeding (especially from @Faless).