Skip to content

Instantly share code, notes, and snippets.

@defp
Forked from jiejiecat/CCPlatformConfig.h
Last active August 29, 2015 14:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save defp/e6dd2868e0cd71b6a8d8 to your computer and use it in GitHub Desktop.
Save defp/e6dd2868e0cd71b6a8d8 to your computer and use it in GitHub Desktop.
// define supported target platform macro which CC uses.
#define CC_PLATFORM_UNKNOWN 0
#define CC_PLATFORM_IOS 1
#define CC_PLATFORM_ANDROID 2
#define CC_PLATFORM_WIN32 3
#define CC_PLATFORM_MARMALADE 4
#define CC_PLATFORM_LINUX 5
#define CC_PLATFORM_BADA 6
#define CC_PLATFORM_QNX 7
// Determine tartet platform by compile environment macro.
#define CC_TARGET_PLATFORM CC_PLATFORM_UNKNOWN
// iphone
#if ! CC_TARGET_PLATFORM && (defined(TARGET_OS_IPHONE) || defined(TARGET_IPHONE_SIMULATOR))
#undef CC_TARGET_PLATFORM
#define CC_TARGET_PLATFORM CC_PLATFORM_IOS
#define CC_SUPPORT_PVRTC
#endif
// android
#if ! CC_TARGET_PLATFORM && defined(ANDROID)
#undef CC_TARGET_PLATFORM
#define CC_TARGET_PLATFORM CC_PLATFORM_ANDROID
#endif
// win32
#if ! CC_TARGET_PLATFORM && (defined(WIN32) && defined(_WINDOWS))
#undef CC_TARGET_PLATFORM
#define CC_TARGET_PLATFORM CC_PLATFORM_WIN32
#endif
// linux
#if ! CC_TARGET_PLATFORM && defined(LINUX)
#undef CC_TARGET_PLATFORM
#define CC_TARGET_PLATFORM CC_PLATFORM_LINUX
#endif
// marmalade
#if ! CC_TARGET_PLATFORM && defined(MARMALADE)
#undef CC_TARGET_PLATFORM
#define CC_TARGET_PLATFORM CC_PLATFORM_MARMALADE
#endif
// bada
#if ! CC_TARGET_PLATFORM && defined(SHP)
#undef CC_TARGET_PLATFORM
#define CC_TARGET_PLATFORM CC_PLATFORM_BADA
#endif
// qnx
#if ! CC_TARGET_PLATFORM && defined(__QNX__)
#undef CC_TARGET_PLATFORM
#define CC_TARGET_PLATFORM CC_PLATFORM_QNX
#endif
//////////////////////////////////////////////////////////////////////////
// post configure
//////////////////////////////////////////////////////////////////////////
// check user set platform
#if ! CC_TARGET_PLATFORM
#error "Can not recognize the target platform, compling under a unsupported platform?"
#endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment