Created
January 12, 2012 17:53
-
-
Save deltheil/1602054 to your computer and use it in GitHub Desktop.
Preprocessor: detect mobile platform (iOS vs Android)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* NOTES: | |
* - iOS: the useful macros are defined within TargetConditionals.h | |
* - Android: | |
* - with Android.mk file(s) and the 'ndk-build' script (aka vanilla way), | |
* ANDROID is predefined (see -DANDROID extra C flag), | |
* - with the Android Standalone Toolchain __ANDROID__ is predefined instead | |
*/ | |
#if defined(__APPLE__) | |
#include <TargetConditionals.h> | |
#if TARGET_OS_IPHONE | |
#define __SYSNAME_IOS__ | |
#define SYSNAME "ios" | |
#endif | |
#elif defined(ANDROID) || defined(__ANDROID__) | |
#define __SYS_ANDROID__ | |
#define SYSNAME "android" | |
#endif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment