(My apologies if this is a duplicate posting -- this is my second attempt)
I want to build a SampleApp project file in Codewarrior. I want it to build
against SDK3.5 and 3.1 without any user modification to anything, does
anyone have any cool tricks to do this?
Using the facts:
__MWERKS__ == 0x2410 for Codewarrior 7.0 install (version 2.4.1 build 0133)
__MWERKS__ == 0x2400 for Codewarrior 6.0 install (version 2.4 build 0131)
And the following implications:
I1: CW6 IDE implies PalmOS SDK v3.1
I2: CW7 implies PalmOS SDK v3.5,
I come up with the following logic:
// File: "MyPilot.h"
#ifdef __MWERKS__
// Begin Metrowerks-specific code
#if __MWERKS__ > 0x2400 // CW7 IDE; assume PalmOS 3.5SDK
#include <PalmOS.h>
#include <PalmCompatibility.h>
#else // <CW7 IDE; assume <PalmOS 3.5 SDK
#include <Pilot.h>
#endif
// End Metrowerks-specific code
#else // Non-MWerks; assume PalmOS 3.5 SDK
#include <PalmOS.h>
#incldue <PalmCompatibility.h>
#endif
With that said, everywhere I would normally put a #include <PalmOS.h> (or
Pilot.h), instead I put #include "MyPilot.h" and I let my logic switch
accordingly.
This works very nicely, actually. But there are some obvious scenarios in
which the logic fails:
1) If the user is running CW6 with the PalmOS 3.5 SDK update. In this
case, Implication #1 is rendered invalid.
2) If the user is using GNU (or any non-CW) tools, and linking against
PalmOS 3.1 SDK
Does anyone have a suggestion to better my algorithm? As I said, it works
pretty nicely and I think I've streamlined the logic to minimize the cases
in which it fails, but I welcome improvements. If only there were some kind
of ver.h file that were common to all the PalmOS SDKs which defined the
version of SDK -- maybe I just can't find it?
Thanks for the bandwidth,
-Jeff Ishaq
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/