diff --git a/src/kiwano/macros.h b/src/kiwano/macros.h index 23940124..79e97e45 100644 --- a/src/kiwano/macros.h +++ b/src/kiwano/macros.h @@ -24,51 +24,27 @@ # error Kiwano only supports C++ #endif -#ifndef _MSC_VER -# error Kiwano only supports MSVC compiler +#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 -#ifndef KGE_VS_VER -# define KGE_VS_VER _MSC_VER -# define KGE_VS_2013 1800 -# define KGE_VS_2015 1900 -# define KGE_VS_2017 1900 -# define KGE_VS_2019 1920 -#endif - -#if KGE_VS_VER < KGE_VS_2015 -# error Kiwano only supports Visual Studio 2015 and above -#endif - -#ifndef WINVER -# define WINVER 0x0700 // Allow use of features specific to Windows 7 or later -#endif - -#ifndef _WIN32_WINNT -# define _WIN32_WINNT 0x0700 // Allow use of features specific to Windows 7 or later -#endif - -#ifndef NTDDI_VERSION -# define NTDDI_VERSION NTDDI_WIN7 -#endif - -#ifndef UNICODE -# define UNICODE -#endif - -// Exclude rarely-used items from Windows headers -#ifndef WIN32_LEAN_AND_MEAN -# define WIN32_LEAN_AND_MEAN -#endif - -#ifndef NOMINMAX -# define NOMINMAX -#endif - - -// Windows Header Files -#include -#include // C++ RunTime Header Files #include @@ -77,41 +53,91 @@ #include -#if defined(DEBUG) || defined(_DEBUG) -# define KGE_DEBUG -#endif +// Windows platform + +#ifdef KGE_WIN32 + +# ifndef _MSC_VER +# error Kiwano only supports MSVC compiler +# endif + +# ifndef KGE_VS_VER +# define KGE_VS_VER _MSC_VER +# define KGE_VS_2013 1800 +# define KGE_VS_2015 1900 +# define KGE_VS_2017 1900 +# define KGE_VS_2019 1920 +# endif + +# if KGE_VS_VER < KGE_VS_2015 +# error Kiwano only supports Visual Studio 2015 and above +# endif + +# ifndef WINVER +# define WINVER 0x0700 // Allow use of features specific to Windows 7 or later +# endif + +# ifndef _WIN32_WINNT +# define _WIN32_WINNT 0x0700 // Allow use of features specific to Windows 7 or later +# endif + +# ifndef NTDDI_VERSION +# define NTDDI_VERSION NTDDI_WIN7 +# endif + +# ifndef UNICODE +# define UNICODE +# endif + + // Exclude rarely-used items from Windows headers +# ifndef WIN32_LEAN_AND_MEAN +# define WIN32_LEAN_AND_MEAN +# endif + +# ifndef NOMINMAX +# define NOMINMAX +# endif + +# if defined(DEBUG) || defined(_DEBUG) +# define KGE_DEBUG +# endif + +# ifndef KGE_ASSERT +# ifdef KGE_DEBUG +# define KGE_ASSERT(EXPR) do { (void)((!!(EXPR)) || (_wassert(_CRT_WIDE(#EXPR), _CRT_WIDE(__FUNCTION__), (unsigned)(__LINE__)), 0)); } while(0) +# else +# define KGE_ASSERT __noop +# endif +# endif -#ifndef KGE_ASSERT -# ifdef KGE_DEBUG -# define KGE_ASSERT(EXPR) do { (void)((!!(EXPR)) || (_wassert(_CRT_WIDE(#EXPR), _CRT_WIDE(__FUNCTION__), (unsigned)(__LINE__)), 0)); } while(0) +# ifndef KGE_API +# if defined(KGE_USE_DLL) +# define KGE_API __declspec( dllimport ) +# elif defined(KGE_EXPORT_DLL) +# define KGE_API __declspec( dllexport ) +# endif +# endif + + +# ifndef KGE_API + /* Building or calling Kiwano as a static library */ +# define KGE_API # else -# define KGE_ASSERT __noop + /* + * C4251 can be ignored if you are deriving from a type in the + * C++ Standard Library, compiling a debug release (/MTd) and + * where the compiler error message refers to _Container_base. + */ +# pragma warning (disable: 4251) # endif -#endif +# define KGE_NOT_USED(VAR) ((void)VAR) -#ifndef KGE_API -# if defined(KGE_USE_DLL) -# define KGE_API __declspec( dllimport ) -# elif defined(KGE_EXPORT_DLL) -# define KGE_API __declspec( dllexport ) -# endif -#endif +# define KGE_DEPRECATED(...) __declspec(deprecated(__VA_ARGS__)) + // Windows Header Files +# include +# include -#ifndef KGE_API -/* Building or calling Kiwano as a static library */ -# define KGE_API -#else -/* - * C4251 can be ignored if you are deriving from a type in the - * C++ Standard Library, compiling a debug release (/MTd) and - * where the compiler error message refers to _Container_base. - */ -# pragma warning (disable: 4251) -#endif - -#define KGE_NOT_USED(VAR) ((void)VAR) - -#define KGE_DEPRECATED(...) __declspec(deprecated(__VA_ARGS__)) +#endif // KGE_WIN32 diff --git a/src/kiwano/platform/Window.h b/src/kiwano/platform/Window.h index 148a1e82..75455bbe 100644 --- a/src/kiwano/platform/Window.h +++ b/src/kiwano/platform/Window.h @@ -77,7 +77,7 @@ namespace kiwano /** * \~chinese - * @brief 窗口实例,控制窗口标题、大小、图标等 + * @brief 窗口类,控制窗口标题、大小、图标等 */ class KGE_API Window : public Singleton @@ -151,6 +151,7 @@ namespace kiwano */ void SetCursor(CursorType cursor); +#ifdef KGE_WIN32 public: void Init(WindowConfig const& config, WNDPROC proc); @@ -169,6 +170,7 @@ namespace kiwano void SetActive(bool actived); void Destroy(); +#endif private: Window();