I have an open-source project, available at https://github.com/MesserLab/SLiM, which uses Xcode (project file SLiM.xcodeproj). In Xcode 12.1 (12A7403), I would like to get a Universal build of the (four) build targets, but let's focus on the SLiM target, which is a command-line tool for macOS. I am on macOS 10.15.7, not macOS 11, but Apple's page (https://developer.apple.com/documentation/xcode/building_a_universal_macos_binary) says nothing about a required macOS version, so I'm under the impression that that is not a problem.
So. In Xcode, I select my SLiM scheme and select a Release build in Edit Scheme. In the project's settings, Architectures is "Standard architectures", base SDK is macOS 10.15, Build Active Architecture Only is "No" for a Release build, and Excluded Architectures is empty. The SLiM target does not override any of those settings, and the "Resolved" column for that target in the Build Settings pane, with the SLiM target selected, shows those values as expected. If I build, it builds without errors (and indeed, without warnings). If I examine the built executable with lipo -archs, however, it is x86_64 only. In the Report navigator, the build log says "Build target SLiM" and then "Project SLiM | Configuration Release | Destination My Mac | SDK macOS 10.15". All of the "Compile" lines say "(x86_64)"; there are no compiles for arm64.
I've never really understood what the "My Mac" thing is; thinking that that might be the problem, if I click that in my project window's title bar, the menu it shows has two choices: "My Mac" and "Any Mac (Intel)". There is no choice for "Universal" or some such. (But what is this setting anyway? Since my build settings say to build for "Standard architectures" and not "active architecture only", for a Release build, what does the "My Mac" setting govern?)
I'm left scratching my head. As far as I can tell, I'm doing everything Apple's page says to do, and yet I'm not getting an arm64 build – and that "Any Mac (Intel)" menu item suggests that my Xcode doesn't even know how to build for arm64, even though it is Xcode 12.1, which Apple says should know how to do it.
If I go to the Preferences and select Components, and click "Check and Install Now", things there seem to be up to date (but I think that's irrelevant anyway since my project is for macOS apps/tools, and does not involve any simulators). If I go to the Locations tab in prefs, it says "Command Line Tools: Xcode 12.1 (12A7403)".
What am I doing wrong??
So. In Xcode, I select my SLiM scheme and select a Release build in Edit Scheme. In the project's settings, Architectures is "Standard architectures", base SDK is macOS 10.15, Build Active Architecture Only is "No" for a Release build, and Excluded Architectures is empty. The SLiM target does not override any of those settings, and the "Resolved" column for that target in the Build Settings pane, with the SLiM target selected, shows those values as expected. If I build, it builds without errors (and indeed, without warnings). If I examine the built executable with lipo -archs, however, it is x86_64 only. In the Report navigator, the build log says "Build target SLiM" and then "Project SLiM | Configuration Release | Destination My Mac | SDK macOS 10.15". All of the "Compile" lines say "(x86_64)"; there are no compiles for arm64.
I've never really understood what the "My Mac" thing is; thinking that that might be the problem, if I click that in my project window's title bar, the menu it shows has two choices: "My Mac" and "Any Mac (Intel)". There is no choice for "Universal" or some such. (But what is this setting anyway? Since my build settings say to build for "Standard architectures" and not "active architecture only", for a Release build, what does the "My Mac" setting govern?)
I'm left scratching my head. As far as I can tell, I'm doing everything Apple's page says to do, and yet I'm not getting an arm64 build – and that "Any Mac (Intel)" menu item suggests that my Xcode doesn't even know how to build for arm64, even though it is Xcode 12.1, which Apple says should know how to do it.
If I go to the Preferences and select Components, and click "Check and Install Now", things there seem to be up to date (but I think that's irrelevant anyway since my project is for macOS apps/tools, and does not involve any simulators). If I go to the Locations tab in prefs, it says "Command Line Tools: Xcode 12.1 (12A7403)".
What am I doing wrong??