From Xojo Documentation
Before you build your app, you choose the platform or platforms on which it will run. You can build apps for Windows, Linux, and Mac as desktop, console, web. Additionally, you can build for iOS. While programming, you can selectively enable or disable sections of your code that are valid only for particular platforms by using compilation constants.
The compilation constants tell you information about the platform on which the app is running. When used with conditional compilation you can specify blocks of source code to include or exclude for specific platforms.
These are the some of the compilation constants:
- DebugBuild: True when the app is running in Debug mode
- TargetWindows: True when the app is running on Windows.
- TargetMacOS: True when running on macOS.
- TargetLinux: True when the app is running on Linux. This is True regardless of whether Linux itself is 32-bit or 64-bit.
- TargetARM: True when the app is running on ARM Linux, such as a Raspberry Pi.
- Target32Bit: True when running as a 32-bit app.
- Target64Bit: True when running as a 64-bit app.
- TargetDesktop: True for desktop apps.
- TargetWeb: True for web apps.
- TargetiOS: True for iOS apps.
- TargetConsole: True for console apps.
For the complete list, refer to Compiler Category.
These constants are automatically set to either True or False depending on the platform being compiled. You can use conditional compilation commands to use specific code like this:
#If TargetWin32 Then
// Use Registry
#ElseIf TargetMacOS Then
// Use plist
#ElseIf TargetLinux Then
// Use XML
#ElseIf TargetiOS Then
// Use JSON
You can also check the version of Xojo being used with the XojoVersion and XojoVersionString constants. These two constants can be used to block out code that is not compatible with older (or newer versions) of Xojo.