[chore] Update cross-platform configurations

This commit is contained in:
Nomango 2020-01-13 09:32:41 +08:00
parent 8660ee0b59
commit 3ce09fb1b1
2 changed files with 102 additions and 74 deletions

View File

@ -24,6 +24,39 @@
# error Kiwano only supports C++ # error Kiwano only supports C++
#endif #endif
#ifdef _WIN32
# define KGE_WIN32
# ifdef _WIN64
# define KGE_WIN64
# endif
#elif __ANDROID__
# define KGE_ANDROID
#elif __linux__
# define KGE_LINUX
#elif __APPLE__
# if TARGET_OS_IPHONE
# define KGE_IPHONE
# elif TARGET_OS_MAC
# define KGE_MACOS
# else
# error "Unsupported Apple platform"
# endif
#else
# error "Unsupported compiler"
#endif
// C++ RunTime Header Files
#include <cassert>
// Compile-time Config Header File
#include <kiwano/config.h>
// Windows platform
#ifdef KGE_WIN32
# ifndef _MSC_VER # ifndef _MSC_VER
# error Kiwano only supports MSVC compiler # error Kiwano only supports MSVC compiler
# endif # endif
@ -65,23 +98,10 @@
# define NOMINMAX # define NOMINMAX
# endif # endif
// Windows Header Files
#include <windows.h>
#include <wincodec.h>
// C++ RunTime Header Files
#include <cassert>
// Compile-time Config Header File
#include <kiwano/config.h>
# if defined(DEBUG) || defined(_DEBUG) # if defined(DEBUG) || defined(_DEBUG)
# define KGE_DEBUG # define KGE_DEBUG
# endif # endif
# ifndef KGE_ASSERT # ifndef KGE_ASSERT
# ifdef KGE_DEBUG # ifdef KGE_DEBUG
# define KGE_ASSERT(EXPR) do { (void)((!!(EXPR)) || (_wassert(_CRT_WIDE(#EXPR), _CRT_WIDE(__FUNCTION__), (unsigned)(__LINE__)), 0)); } while(0) # define KGE_ASSERT(EXPR) do { (void)((!!(EXPR)) || (_wassert(_CRT_WIDE(#EXPR), _CRT_WIDE(__FUNCTION__), (unsigned)(__LINE__)), 0)); } while(0)
@ -115,3 +135,9 @@
# define KGE_NOT_USED(VAR) ((void)VAR) # define KGE_NOT_USED(VAR) ((void)VAR)
# define KGE_DEPRECATED(...) __declspec(deprecated(__VA_ARGS__)) # define KGE_DEPRECATED(...) __declspec(deprecated(__VA_ARGS__))
// Windows Header Files
# include <windows.h>
# include <wincodec.h>
#endif // KGE_WIN32

View File

@ -77,7 +77,7 @@ namespace kiwano
/** /**
* \~chinese * \~chinese
* @brief * @brief
*/ */
class KGE_API Window class KGE_API Window
: public Singleton<Window> : public Singleton<Window>
@ -151,6 +151,7 @@ namespace kiwano
*/ */
void SetCursor(CursorType cursor); void SetCursor(CursorType cursor);
#ifdef KGE_WIN32
public: public:
void Init(WindowConfig const& config, WNDPROC proc); void Init(WindowConfig const& config, WNDPROC proc);
@ -169,6 +170,7 @@ namespace kiwano
void SetActive(bool actived); void SetActive(bool actived);
void Destroy(); void Destroy();
#endif
private: private:
Window(); Window();