FutureBasic Logo

<<    Index    >> FutureBasic

Appendix O - Build Settings   appendix

What are Build Settings?
When FB and clang compile source code into a built application they need additional information about the environment where the app will run. Sometimes coders ask which are the correct or best build settings. It's difficult to offer specific settings guidance without knowing and seeing the project's code. The coder knows where their app will run and what Apple services it uses, so they is better-placed to make optimal build setting choices.

The following descriptions focus on three(3) important settings( each a popup menu ) found in FB's Build Settings window. Understanding their use will help coders make their own best choices.

1. Architecture - on which CPU will the app run? The choices are:

Intel - Tells the compiler to build an Intel binary only. A binary built with this option will run natively only on an Intel CPU-based Mac. It will also run on an Apple Silicon Mac but will not run natively, but will run via Apple's Rosetta 2 translation emulation layer. Apple offers Rosetta 2 as a temporary solution until coders can update their code to run natively on Apple Silicon.

Apple Silicon - Tells the compiler to build an Apple Silicon binary only. A binary built with this option will run natively only on an Apple Silicon CPU-based Mac. It won't run on an Intel-based Mac.

Universal - Tells the compiler to build an app containing both Apple Silicon and Intel binaries. An app built with this option will run natively on BOTH Apple Silicon CPU-based Macs and Intel-based Macs. If you're distributing apps, this should be your choice because your customer will likely have both Intel and Apple Silicon macs.

2. Min Deployment - How old can the user's OS be and still run the app?

The coder must understand their app's usage to set this correctly.The options are macOS 10.9 and up ( note: the current clang/Xcode does not support a minimum deployment lower than 10.9 - if you want to support macOS for users with 10.8 or lower, you'll need an older FB and Xcode to do it ).

Think of this setting as the lowest OS version where your app will still run. This all depends on your app's usage of Apple services. For example, if your app regularly uses a function/method which was introduced by Apple in macOS 10.13, then this setting must be 10.13. Otherwise, users with 10.12 and lower would experience a crash because the function/method would not be found.

macOS and the mac App Store(MAS) utilize the Min Deployment setting to protect the user by not allowing an app to run ( or install in the case of MAS ) if the user's macOS version does not meet the minimum level to run it. So if the coder sets Min Deployment to macOS 10.9 and a user tries to run the app in macOS 10.8, they will receive a warning/error dialog upon trying to launch the app.

For example: The FB app uses a setting of 10.13 because it uses calls/functions/methods which didn't exist in macOS prior to 10.13.

This setting is completely independent of and does not influence #1, Architecture.

3. Base SDK - unlike Min Deployment ( #2 ) which focuses on the user's OS need, this focuses on the app's needs

Virtually all the CF strings, controls ( buttons, menus, tableviews, etc. ) are defined in Apple's Software Development Kit ( aka: SDK ). Over time Apple adds new controls and widgets which a programmer may want to use.

Typically, the coder wants to use the highest ( i.e. the latest or most recent ) SDK which supports all the latest widgets the app uses. For example, if your app uses a widget that was born in macOS 12, you would want to specify macOS 12.x or higher.

Note: FB limits the contents of this popup to only the currently Xcode-installed SDKs. Many times you will have only one choice and that's normal.

Example Settings For Typical Scenarios - some usage ideas

You develop on an Intel Mac, you're not planning to distribute your apps to others, and you're running macOS 12 ( Monterey ).
Set Architecture to Intel, Min Deployment to 10.12 and Base SDK to 12.x.

You develop on an Apple Silicon Mac, you're not planning to distribute your apps to others, and you're running macOS 12 ( Monterey ).
Same as above but Set Architecture to Apple Silicon.

You develop on an Apple Silicon Mac, you're planning to distribute your apps to others but only within your company and they have all Apple Silicon Macs too. You're running macOS 12 ( Monterey ) but others employees might have macOS 11.0
Set Architecture to Apple Silicon, Min Deployment to 11.0 and Base SDK to 12.x.

You develop on an Intel Mac, you're planning to distribute your apps to others, you don't control what Macs your users operate/purchase, and you don't know what macOS version users have installed.
Set Architecture to Universal so it will run on both Intel and Apple Silicon.
Set Min Deployment to the lowest macOS version where your app runs. Set Base SDK to the highest SDK available on your development Mac.

This last example highlights the thought required before employing some Apple widgets. If, for example, you know the user base has older Macs that all run macOS 10.14 ( Mojave ), you really can't write code requiring macOS 10.15( Catalina ). It's not just a matter of setting Min Deployment correctly, the planning needs to start earlier when coding.

See also
Appendix K - Build System