Hi,
Is there any MoSync built in compiler directive that i can use to build my code differently for every platform.
Thanks in advance
Hi,
Is there any MoSync built in compiler directive that i can use to build my code differently for every platform.
Thanks in advance
Not sure it's exactly what you want, but if you #include , you'll get the profile information of the device you're building for.
To see the contents of maprofile.h, you can right-click any device in the MoSync IDE's device list and select "Show profile info".
If you want to access the files outside of the IDE, they are stored in /MoSync/profiles/vendor/.
Hi Fredrik,
I need compiler directive to compile my code differently for every platform, for example:
#if defined(__SERIES60__) #if defined(__SERIES60_2X__) // code for symbian s60 2nd ed #elif defined(__SERIES60_3X__) // code for symbian s60 3rd ed #endif #elif defined(__WINMO__) // code for winmo #endif
You need to look at the properties
#define MA_PROF_STRING_VENDOR
#define MA_PROF_STRING_DEVICE
#define MA_PROF_STRING_PLATFORM
in any maprofile.h - have a look at the one for the Nokia N95 for example. It contains
#define MA_PROF_STRING_VENDOR "Nokia"
#define MA_PROF_STRING_DEVICE "N75"
#define MA_PROF_STRING_PLATFORM "s60v3"
The Acer Liquid A1 has
#define MA_PROF_STRING_VENDOR "Acer"
#define MA_PROF_STRING_DEVICE "Liquid A1 S100"
#define MA_PROF_STRING_PLATFORM "android"
and the Gigabyte g-Smart has
#define MA_PROF_STRING_VENDOR "Gigabyte"
#define MA_PROF_STRING_DEVICE "g-Smart"
#define MA_PROF_STRING_PLATFORM "wm6pro"
so what you can do is test the values of this string.
Alternatively, using the directives you've shown, you can use these values
#define MA_PROF_SUPPORT_OS_SYMBIAN_OS_9_1
#define MA_PROF_SUPPORT_OS_WINDOWS_MOBILE_6
Although there doesn't appear to be a an equivilent for Android, which I think is something MoSync will need to add.
Cool! Thanks
In addition to MA_PROF_STRING_PLATFORM it would be nice with macro definitions that can be easier used in pre-processing directives.
For example, for HTC Bravo we currently have:
#define MA_PROF_STRING_PLATFORM "android"
It is hard to use this one with pre-processor directives like:
#if MA_PROF_STRING_PLATFORM = "android"
MAUI::Label* androidSpecificLabel;
#endif
gives me the following error from the gcc preprocessor: "token ""android"" is not valid in preprocessor expressions"
Therefore, it would be great if we instead had defines like: MA_PROF_PLATFORM_ANDROID, MA_PROF_PLATFORM_SYMBIAN_S60V3, ...
... or is there a simpler solution I haven't thought about for what I want to achieve here?
#define MA_PROF_STRING_PLATFORM_ANDROID
#ifndef _MSAB_PROF_H_
#define _MSAB_PROF_H_
#define MA_PROF_STRING_VENDOR "HTC"
#define MA_PROF_STRING_DEVICE "Droid Eris"
#define MA_PROF_STRING_PLATFORM "android"
#define MA_PROF_STRING_PLATFORM_ANDROID
#define MA_PROF_VENDOR_HTC
#define MA_PROF_DEVICE_DROID_ERIS
#define MA_PROF_CONST_SCREENSIZE_X 240
#define MA_PROF_CONST_SCREENSIZE_Y 320
#define MA_PROF_CONST_BITSPERPIXEL 8
#define MA_PROF_SUPPORT_CAMERA
#define MA_PROF_SUPPORT_STYLUS
#endif /* _MSAB_PROF_H_ */