Re: Determining deployment target at build time
Re: Determining deployment target at build time
- Subject: Re: Determining deployment target at build time
- From: Chris Espinosa <email@hidden>
- Date: Tue, 19 May 2009 12:33:32 -0700
On May 19, 2009, at 11:01 AM, Jean-Daniel Dupas wrote: Le 19 mai 09 à 19:05, Wade Williams a écrit : I need to determine the deployment target at build time.
In short, a 10.4 header needs casts when its functions are called, while the same header under 10.5 does not. (OSAtomic.h)
To allow our code to build on either system, we like to do something like
#if MACOS_X_DEPLOYMENT_TARGET == "10.4" //use casted version #else //use non-casted version #endif
but obviously you can't do that with the C preprocessor.
Is there another variable which is numeric we can use? I've looked at Availability.h, but unless I'm misunderstanding, I don't think it helps us determine which SDK is being used to build.
I'm not sure it's possible to find a single header in the System's frameworks that does not use this kind of macros.
#if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_5
See /usr/include/AvailabilityMacros.h for details.
The SDK being used and the OS being targeted can be two separate things.
The MAC_OS_X_VERSION_MIN_REQUIRED value is set by your Deployment Target and determines the earliest OS the app can launch on. You set this as low as you want to in order to address the largest audience for your software—but setting it too low may make you do extra work to (or make it impossible to) adopt features of later OS versions.
The MAC_OS_X_VERSION_MAX_ALLOWED is set by your Base SDK and determines the latest set of APIs your source code can be compiled against. You set this as high as you want to take advantage of new APIs—but setting it too high may require you to make source code changes to run correctly.
The format for both is always a four digit number of the form XXYZ, where XX is usually 10, Y is the major version number, and Z is the update number: Mac OS X 10.5.7 is 1057. It's wise to use comparisons like the above, where the version numbers are also provided in predefined macros.
Chris |
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden