Detect Apple platforms correctly.

This commit is contained in:
Xpol Wan 2016-03-16 13:15:41 +08:00
parent c9306a053f
commit bfb97739e2
1 changed files with 13 additions and 19 deletions

View File

@ -29,7 +29,7 @@ THE SOFTWARE.
/**
Config of cocos2d-x project, per target platform.
THIS FILE MUST NOT INCLUDE ANY OTHER FILE
*/
@ -57,21 +57,15 @@ THE SOFTWARE.
#define CC_TARGET_PLATFORM CC_PLATFORM_UNKNOWN
// mac
#if defined(CC_TARGET_OS_MAC) || defined(__APPLE__)
#undef CC_TARGET_PLATFORM
#define CC_TARGET_PLATFORM CC_PLATFORM_MAC
#endif
// ios
#if defined(CC_TARGET_OS_IPHONE)
#undef CC_TARGET_PLATFORM
#define CC_TARGET_PLATFORM CC_PLATFORM_IOS
#endif
// tvOS
#if defined(CC_TARGET_OS_TVOS)
#undef CC_TARGET_PLATFORM
#define CC_TARGET_PLATFORM CC_PLATFORM_IOS
#if defined(__APPLE__)
#include <TargetConditionals.h>
#if TARGET_OS_IPHONE // TARGET_OS_IPHONE inlcudes TARGET_OS_IOS TARGET_OS_TV and TARGET_OS_WATCH. see TargetConditionals.h
#undef CC_TARGET_PLATFORM
#define CC_TARGET_PLATFORM CC_PLATFORM_IOS
#elif TARGET_OS_MAC
#undef CC_TARGET_PLATFORM
#define CC_TARGET_PLATFORM CC_PLATFORM_MAC
#endif
#endif
// android
@ -147,12 +141,12 @@ THE SOFTWARE.
// check user set platform
#if ! CC_TARGET_PLATFORM
#error "Cannot recognize the target platform; are you targeting an unsupported platform?"
#endif
#endif
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32)
#ifndef __MINGW32__
#pragma warning (disable:4127)
#endif
#pragma warning (disable:4127)
#endif
#endif // CC_PLATFORM_WIN32
/// @endcond