Recent

Author Topic: IFDEF for Android  (Read 4680 times)

IndianaJones

  • Hero Member
  • *****
  • Posts: 509
IFDEF for Android
« on: January 04, 2012, 06:05:33 pm »

Hi all,
Is there an special definition (IFDEF) for Android platform?
Thanks.

Andru

  • Full Member
  • ***
  • Posts: 112
    • Homepage
Re: IFDEF for Android
« Reply #1 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.

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3541
Re: IFDEF for Android
« Reply #2 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.

IndianaJones

  • Hero Member
  • *****
  • Posts: 509
Re: IFDEF for Android
« Reply #3 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.

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3541
Re: IFDEF for Android
« Reply #4 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.

IndianaJones

  • Hero Member
  • *****
  • Posts: 509
Re: IFDEF for Android
« Reply #5 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?