From bfb97739e2f167e63cc4e11bd89d652e295e0246 Mon Sep 17 00:00:00 2001 From: Xpol Wan Date: Wed, 16 Mar 2016 13:15:41 +0800 Subject: [PATCH] Detect Apple platforms correctly. --- cocos/platform/CCPlatformConfig.h | 32 +++++++++++++------------------ 1 file changed, 13 insertions(+), 19 deletions(-) diff --git a/cocos/platform/CCPlatformConfig.h b/cocos/platform/CCPlatformConfig.h index 71fcbc48c1..7452ebcfa1 100644 --- a/cocos/platform/CCPlatformConfig.h +++ b/cocos/platform/CCPlatformConfig.h @@ -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 + #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