Lazarus

Programming => Operating Systems => Android => Topic started by: IndianaJones on January 04, 2012, 06:05:33 pm

Title: IFDEF for Android
Post by: IndianaJones on January 04, 2012, 06:05:33 pm

Hi all,
Is there an special definition (IFDEF) for Android platform?
Thanks.
Title: Re: IFDEF for Android
Post by: Andru on January 04, 2012, 07:12:58 pm
Nope, because FreePascal doesn't support Android officially... So the only one solution is something like this(but this is a bad idea):
Code: Pascal  [Select][+][-]
  1. {$IF DEFINED(LINUX) and DEFINED(CPUARM)}
  2.   {$DEFINE ANDROID}
  3. {$IFEND}
  4.  

or just using define ANDROID manually when you compile your project.
Title: Re: IFDEF for Android
Post by: felipemdc on January 04, 2012, 08:29:25 pm
Since the LPI needs to be different anyway for Android, just add -dANDROID in the Android LPI. The example project does that.
Title: Re: IFDEF for Android
Post by: IndianaJones on January 04, 2012, 09:54:20 pm

@Andru: I dont think it is a bad idea, if the source needs to be compiled under Windows,Linux,Mac,Android ...etc. I just read the screen metrics of the Android device, so that doesnt necessary for the other platforms.

@Felipe: But that information only supports if the application runs only on Android platform.
Title: Re: IFDEF for Android
Post by: felipemdc on January 04, 2012, 11:42:05 pm
@Felipe: But that information only supports if the application runs only on Android platform.

Why? The example project runs in any operating system.
Title: Re: IFDEF for Android
Post by: IndianaJones on January 05, 2012, 12:36:00 am

So you mean, -dAndroid option doesnt inhibit the compilation for the other platforms as a result What does 'Defines the symbol' mean?
TinyPortal © 2005-2018