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