2013-10-12 15:25:45 +08:00
|
|
|
/****************************************************************************
|
2014-01-07 11:47:11 +08:00
|
|
|
Copyright (c) 2010-2012 cocos2d-x.org
|
2017-02-14 14:36:57 +08:00
|
|
|
Copyright (c) 2013-2017 Chukong Technologies
|
2018-01-29 16:25:32 +08:00
|
|
|
Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
|
2021-11-16 16:28:31 +08:00
|
|
|
Copyright (c) 2021 Bytedance Inc.
|
2013-10-12 15:25:45 +08:00
|
|
|
|
2022-10-01 16:24:52 +08:00
|
|
|
https://axmolengine.github.io/
|
2013-10-12 15:25:45 +08:00
|
|
|
|
|
|
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
|
|
of this software and associated documentation files (the "Software"), to deal
|
|
|
|
in the Software without restriction, including without limitation the rights
|
|
|
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
|
|
copies of the Software, and to permit persons to whom the Software is
|
|
|
|
furnished to do so, subject to the following conditions:
|
|
|
|
|
|
|
|
The above copyright notice and this permission notice shall be included in
|
|
|
|
all copies or substantial portions of the Software.
|
|
|
|
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
|
|
THE SOFTWARE.
|
|
|
|
****************************************************************************/
|
|
|
|
|
2022-07-15 19:17:01 +08:00
|
|
|
#ifndef __BASE_AX_PLATFORM_CONFIG_H__
|
|
|
|
#define __BASE_AX_PLATFORM_CONFIG_H__
|
2015-03-24 20:23:51 +08:00
|
|
|
/// @cond DO_NOT_SHOW
|
2013-10-12 15:25:45 +08:00
|
|
|
|
|
|
|
/**
|
2014-09-10 07:50:02 +08:00
|
|
|
Config of cocos2d-x project, per target platform.
|
2016-03-16 13:15:41 +08:00
|
|
|
|
2014-09-10 07:50:02 +08:00
|
|
|
THIS FILE MUST NOT INCLUDE ANY OTHER FILE
|
2013-10-12 15:25:45 +08:00
|
|
|
*/
|
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
// pre configure
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
// define supported target platform macro which CC uses.
|
2022-07-15 19:17:01 +08:00
|
|
|
#define AX_PLATFORM_UNKNOWN 0
|
|
|
|
#define AX_PLATFORM_IOS 1
|
|
|
|
#define AX_PLATFORM_ANDROID 2
|
|
|
|
#define AX_PLATFORM_WIN32 3
|
|
|
|
#define AX_PLATFORM_LINUX 5
|
|
|
|
#define AX_PLATFORM_MAC 8
|
2023-03-11 22:10:18 +08:00
|
|
|
#define AX_PLATFORM_WINRT 13
|
2013-10-12 15:25:45 +08:00
|
|
|
|
|
|
|
// Determine target platform by compile environment macro.
|
2022-07-15 19:17:01 +08:00
|
|
|
#define AX_TARGET_PLATFORM AX_PLATFORM_UNKNOWN
|
2013-10-12 15:25:45 +08:00
|
|
|
|
2016-03-16 13:30:11 +08:00
|
|
|
// Apple: Mac and iOS
|
2021-12-25 10:04:45 +08:00
|
|
|
#if defined(__APPLE__) && !defined(__ANDROID__) // exclude android for binding generator.
|
|
|
|
# include <TargetConditionals.h>
|
|
|
|
# if TARGET_OS_IPHONE // TARGET_OS_IPHONE includes TARGET_OS_IOS TARGET_OS_TV and TARGET_OS_WATCH. see
|
|
|
|
// TargetConditionals.h
|
2022-07-15 19:17:01 +08:00
|
|
|
# undef AX_TARGET_PLATFORM
|
|
|
|
# define AX_TARGET_PLATFORM AX_PLATFORM_IOS
|
2021-12-25 10:04:45 +08:00
|
|
|
# elif TARGET_OS_MAC
|
2022-07-15 19:17:01 +08:00
|
|
|
# undef AX_TARGET_PLATFORM
|
|
|
|
# define AX_TARGET_PLATFORM AX_PLATFORM_MAC
|
2021-12-25 10:04:45 +08:00
|
|
|
# endif
|
2015-12-29 07:59:36 +08:00
|
|
|
#endif
|
|
|
|
|
2013-10-12 15:25:45 +08:00
|
|
|
// win32
|
2014-08-17 05:58:16 +08:00
|
|
|
#if defined(_WIN32) && defined(_WINDOWS)
|
2022-07-15 19:17:01 +08:00
|
|
|
# undef AX_TARGET_PLATFORM
|
|
|
|
# define AX_TARGET_PLATFORM AX_PLATFORM_WIN32
|
2013-10-12 15:25:45 +08:00
|
|
|
#endif
|
|
|
|
|
2023-03-11 22:10:18 +08:00
|
|
|
// WinRT (Windows 10.0 UWP App)
|
|
|
|
#if defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_APP)
|
|
|
|
// Windows Store or Universal Windows Platform
|
|
|
|
# undef AX_TARGET_PLATFORM
|
|
|
|
# define AX_TARGET_PLATFORM AX_PLATFORM_WINRT
|
|
|
|
#endif
|
|
|
|
|
2013-10-12 15:25:45 +08:00
|
|
|
// linux
|
2022-11-01 18:31:31 +08:00
|
|
|
#if defined(__linux__)
|
2022-07-15 19:17:01 +08:00
|
|
|
# undef AX_TARGET_PLATFORM
|
|
|
|
# define AX_TARGET_PLATFORM AX_PLATFORM_LINUX
|
2013-10-12 15:25:45 +08:00
|
|
|
#endif
|
|
|
|
|
2022-11-01 18:31:31 +08:00
|
|
|
// android, override linux
|
2022-11-01 19:00:48 +08:00
|
|
|
#if defined(__ANDROID__) || defined(ANDROID)
|
2022-11-01 18:31:31 +08:00
|
|
|
# undef AX_TARGET_PLATFORM
|
|
|
|
# define AX_TARGET_PLATFORM AX_PLATFORM_ANDROID
|
|
|
|
#endif
|
|
|
|
|
2013-10-12 15:25:45 +08:00
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
// post configure
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
// check user set platform
|
2022-07-15 19:17:01 +08:00
|
|
|
#if !AX_TARGET_PLATFORM
|
2021-12-25 10:04:45 +08:00
|
|
|
# error "Cannot recognize the target platform; are you targeting an unsupported platform?"
|
2016-03-16 13:15:41 +08:00
|
|
|
#endif
|
2013-10-12 15:25:45 +08:00
|
|
|
|
2022-07-15 19:17:01 +08:00
|
|
|
#if (AX_TARGET_PLATFORM == AX_PLATFORM_WIN32)
|
2021-12-25 10:04:45 +08:00
|
|
|
# ifndef __MINGW32__
|
|
|
|
# pragma warning(disable : 4127)
|
|
|
|
# endif
|
2022-07-15 19:17:01 +08:00
|
|
|
#endif // AX_PLATFORM_WIN32
|
2013-10-12 15:25:45 +08:00
|
|
|
|
2021-12-25 10:04:45 +08:00
|
|
|
/*
|
|
|
|
windows: https://github.com/google/angle
|
2020-12-02 19:03:05 +08:00
|
|
|
mac: GL
|
|
|
|
iOS: GLES
|
2020-12-02 19:33:53 +08:00
|
|
|
other: GL
|
2020-08-28 12:57:00 +08:00
|
|
|
*/
|
2022-02-17 17:11:17 +08:00
|
|
|
#ifndef AX_USE_COMPAT_GL
|
|
|
|
# define AX_USE_COMPAT_GL 0
|
2020-08-28 12:57:00 +08:00
|
|
|
#endif
|
|
|
|
|
2022-07-15 19:17:01 +08:00
|
|
|
#if ((AX_TARGET_PLATFORM == AX_PLATFORM_ANDROID) || (AX_TARGET_PLATFORM == AX_PLATFORM_IOS))
|
|
|
|
# define AX_PLATFORM_MOBILE
|
2016-11-25 09:33:20 +08:00
|
|
|
#else
|
2022-07-15 19:17:01 +08:00
|
|
|
# define AX_PLATFORM_PC
|
2016-11-25 09:33:20 +08:00
|
|
|
#endif
|
|
|
|
|
2022-07-15 19:17:01 +08:00
|
|
|
#if (AX_TARGET_PLATFORM == AX_PLATFORM_MAC)
|
2022-02-17 17:11:17 +08:00
|
|
|
# if !AX_USE_COMPAT_GL
|
2022-07-15 19:17:01 +08:00
|
|
|
# define AX_USE_METAL
|
2021-12-25 10:04:45 +08:00
|
|
|
# else
|
2022-07-15 19:17:01 +08:00
|
|
|
# define AX_USE_GL
|
2021-12-25 10:04:45 +08:00
|
|
|
# endif
|
2022-07-15 19:17:01 +08:00
|
|
|
#elif (AX_TARGET_PLATFORM == AX_PLATFORM_IOS)
|
2022-02-17 17:11:17 +08:00
|
|
|
# if !AX_USE_COMPAT_GL
|
2022-07-15 19:17:01 +08:00
|
|
|
# define AX_USE_METAL
|
2021-12-25 10:04:45 +08:00
|
|
|
# else
|
2022-11-10 21:22:55 +08:00
|
|
|
# define AX_USE_GL
|
2022-07-15 19:17:01 +08:00
|
|
|
# define AX_USE_GLES
|
2021-12-25 10:04:45 +08:00
|
|
|
# endif
|
2022-07-15 19:17:01 +08:00
|
|
|
#elif (AX_TARGET_PLATFORM == AX_PLATFORM_ANDROID)
|
2022-11-10 21:22:55 +08:00
|
|
|
# define AX_USE_GL
|
2022-07-15 19:17:01 +08:00
|
|
|
# define AX_USE_GLES
|
|
|
|
#elif (AX_TARGET_PLATFORM == AX_PLATFORM_WIN32)
|
2022-11-10 21:22:55 +08:00
|
|
|
# define AX_USE_GL
|
|
|
|
# if AX_USE_COMPAT_GL
|
2022-07-15 19:17:01 +08:00
|
|
|
# define AX_USE_GLES
|
2021-12-25 10:04:45 +08:00
|
|
|
# endif
|
2023-03-11 22:10:18 +08:00
|
|
|
#elif (AX_TARGET_PLATFORM == AX_PLATFORM_WINRT)
|
|
|
|
# define AX_USE_GL
|
|
|
|
# if !defined(AX_USE_COMPAT_GL)
|
|
|
|
# define AX_USE_COMPAT_GL 1
|
|
|
|
# endif
|
|
|
|
# define AX_USE_GLES
|
2020-12-02 19:03:05 +08:00
|
|
|
#else
|
2022-07-15 19:17:01 +08:00
|
|
|
# define AX_USE_GL
|
2020-07-31 00:06:59 +08:00
|
|
|
#endif
|
|
|
|
|
2022-11-10 21:22:55 +08:00
|
|
|
#if defined(AX_USE_GL)
|
|
|
|
# if !defined(__ANDROID__)
|
|
|
|
# undef AX_USE_GLAD
|
|
|
|
# define AX_USE_GLAD 1
|
|
|
|
# else
|
|
|
|
# if !defined(AX_USE_GLAD)
|
|
|
|
# define AX_USE_GLAD 0
|
|
|
|
# endif
|
|
|
|
# endif
|
|
|
|
#endif
|
|
|
|
|
2015-03-24 20:23:51 +08:00
|
|
|
/// @endcond
|
2022-07-15 19:17:01 +08:00
|
|
|
#endif // __BASE_AX_PLATFORM_CONFIG_H__
|