Reputation: 1999
I want my project to compile to iOS and Android. What do I do with code that is meant for one platform and not the other? Is there some way to indicate to Delphi XE7 to ignore e.g. Android specific code (like invoking an intent) when compiling for iOS?
Upvotes: 5
Views: 7637
Reputation: 125669
There are predefined compiler directives for just this use:
{$IFDEF ANDROID}
// Android-specific code here
{$ENDIF}
{$IFDEF IOS}
// IOS specific code here
{$ENDIF}
{$IFDEF MACOS}
// OS X specific code here
{$ENDIF}
There is a list of all of the pre-defined compiler directives in the documentation.
Upvotes: 13