Platform_WIN32.h 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216
  1. //
  2. // Platform_WIN32.h
  3. //
  4. // Library: Foundation
  5. // Package: Core
  6. // Module: Platform
  7. //
  8. // Platform and architecture identification macros
  9. // and platform-specific definitions for Windows.
  10. //
  11. // Copyright (c) 2004-2007, Applied Informatics Software Engineering GmbH.
  12. // and Contributors.
  13. //
  14. // SPDX-License-Identifier: BSL-1.0
  15. //
  16. #ifndef Foundation_Platform_WIN32_INCLUDED
  17. #define Foundation_Platform_WIN32_INCLUDED
  18. #include "Poco/UnWindows.h"
  19. #ifndef POCO_FORCE_MIN_WINDOWS_OS_SUPPORT
  20. // Determine the real version.
  21. // This setting can be forced from UnWindows.h
  22. #if defined (_WIN32_WINNT_WINBLUE)
  23. //Windows 8.1 _WIN32_WINNT_WINBLUE (0x0602)
  24. #ifdef _WIN32_WINNT
  25. #undef _WIN32_WINNT
  26. #endif
  27. #define _WIN32_WINNT _WIN32_WINNT_WINBLUE
  28. #ifdef NTDDI_VERSION
  29. #undef NTDDI_VERSION
  30. #endif
  31. #define NTDDI_VERSION NTDDI_WINBLUE
  32. #elif defined (_WIN32_WINNT_WIN8)
  33. //Windows 8 _WIN32_WINNT_WIN8 (0x0602)
  34. #ifdef _WIN32_WINNT
  35. #undef _WIN32_WINNT
  36. #endif
  37. #define _WIN32_WINNT _WIN32_WINNT_WIN8
  38. #ifdef NTDDI_VERSION
  39. #undef NTDDI_VERSION
  40. #endif
  41. #define NTDDI_VERSION NTDDI_WIN8
  42. #elif defined (_WIN32_WINNT_WIN7)
  43. //Windows 7 _WIN32_WINNT_WIN7 (0x0601)
  44. #ifdef _WIN32_WINNT
  45. #undef _WIN32_WINNT
  46. #endif
  47. #define _WIN32_WINNT _WIN32_WINNT_WIN7
  48. #ifdef NTDDI_VERSION
  49. #undef NTDDI_VERSION
  50. #endif
  51. #define NTDDI_VERSION NTDDI_WIN7
  52. #elif defined (_WIN32_WINNT_WS08)
  53. //Windows Server 2008 _WIN32_WINNT_WS08 (0x0600)
  54. #ifdef _WIN32_WINNT
  55. #undef _WIN32_WINNT
  56. #endif
  57. #define _WIN32_WINNT _WIN32_WINNT_WS08
  58. #ifdef NTDDI_VERSION
  59. #undef NTDDI_VERSION
  60. #endif
  61. #define NTDDI_VERSION NTDDI_WS08
  62. #elif defined (_WIN32_WINNT_VISTA)
  63. //Windows Vista _WIN32_WINNT_VISTA (0x0600)
  64. #ifdef _WIN32_WINNT
  65. #undef _WIN32_WINNT
  66. #endif
  67. #define _WIN32_WINNT _WIN32_WINNT_VISTA
  68. #ifdef NTDDI_VERSION
  69. #undef NTDDI_VERSION
  70. #endif
  71. #define NTDDI_VERSION NTDDI_VISTA
  72. #elif defined (_WIN32_WINNT_LONGHORN)
  73. //Windows Vista and server 2008 Development _WIN32_WINNT_LONGHORN (0x0600)
  74. #ifdef _WIN32_WINNT
  75. #undef _WIN32_WINNT
  76. #endif
  77. #define _WIN32_WINNT _WIN32_WINNT_LONGHORN
  78. #ifdef NTDDI_VERSION
  79. #undef NTDDI_VERSION
  80. #endif
  81. #define NTDDI_VERSION 0x06000000 // hardcoded, VS90 can't find NTDDI_* macros
  82. #elif defined (_WIN32_WINNT_WS03)
  83. //Windows Server 2003 with SP1,
  84. //Windows XP with SP2 _WIN32_WINNT_WS03 (0x0502)
  85. #ifdef _WIN32_WINNT
  86. #undef _WIN32_WINNT
  87. #endif
  88. #define _WIN32_WINNT _WIN32_WINNT_WS03
  89. #ifdef NTDDI_VERSION
  90. #undef NTDDI_VERSION
  91. #endif
  92. #define NTDDI_VERSION NTDDI_WS03
  93. #elif defined (_WIN32_WINNT_WINXP)
  94. //Windows Server 2003, Windows XP _WIN32_WINNT_WINXP (0x0501)
  95. #ifdef _WIN32_WINNT
  96. #undef _WIN32_WINNT
  97. #endif
  98. #define _WIN32_WINNT _WIN32_WINNT_WINXP
  99. #ifdef NTDDI_VERSION
  100. #undef NTDDI_VERSION
  101. #endif
  102. #define NTDDI_VERSION NTDDI_WINXP
  103. #elif defined (_WIN32_WINNT_WIN2K)
  104. //Windows 2000 _WIN32_WINNT_WIN2K (0x0500)
  105. #ifdef _WIN32_WINNT
  106. #undef _WIN32_WINNT
  107. #endif
  108. #define _WIN32_WINNT _WIN32_WINNT_WIN2K
  109. #elif defined (WINVER)
  110. // fail back on WINVER
  111. #ifdef _WIN32_WINNT
  112. #undef _WIN32_WINNT
  113. #endif
  114. #define _WIN32_WINNT WINVER
  115. #elif !defined(_WIN32_WINNT)
  116. // last resort = Win XP, SP2 is minimum supported
  117. #define _WIN32_WINNT 0x0502
  118. #ifdef NTDDI_VERSION
  119. #undef NTDDI_VERSION
  120. #endif
  121. #define NTDDI_VERSION 0x05020000
  122. #endif
  123. #endif // POCO_FORCE_MIN_WINDOWS_OS_SUPPORT
  124. #if defined(_MSC_VER) && !defined(POCO_MSVC_SECURE_WARNINGS) && !defined(_CRT_SECURE_NO_DEPRECATE)
  125. #define _CRT_SECURE_NO_DEPRECATE
  126. #endif
  127. // Verify that we're built with the multithreaded
  128. // versions of the runtime libraries
  129. #if defined(_MSC_VER) && !defined(_MT)
  130. #error Must compile with /MD, /MDd, /MT or /MTd
  131. #endif
  132. // Check debug/release settings consistency
  133. #if defined(NDEBUG) && defined(_DEBUG)
  134. #error Inconsistent build settings (check for /MD[d])
  135. #endif
  136. #if (_MSC_VER >= 1300) && (_MSC_VER < 1400) // Visual Studio 2003, MSVC++ 7.1
  137. #define POCO_MSVS_VERSION 2003
  138. #define POCO_MSVC_VERSION 71
  139. #elif (_MSC_VER >= 1400) && (_MSC_VER < 1500) // Visual Studio 2005, MSVC++ 8.0
  140. #define POCO_MSVS_VERSION 2005
  141. #define POCO_MSVC_VERSION 80
  142. #elif (_MSC_VER >= 1500) && (_MSC_VER < 1600) // Visual Studio 2008, MSVC++ 9.0
  143. #define POCO_MSVS_VERSION 2008
  144. #define POCO_MSVC_VERSION 90
  145. #elif (_MSC_VER >= 1600) && (_MSC_VER < 1700) // Visual Studio 2010, MSVC++ 10.0
  146. #define POCO_MSVS_VERSION 2010
  147. #define POCO_MSVC_VERSION 100
  148. #elif (_MSC_VER >= 1700) && (_MSC_VER < 1800) // Visual Studio 2012, MSVC++ 11.0
  149. #define POCO_MSVS_VERSION 2012
  150. #define POCO_MSVC_VERSION 110
  151. #elif (_MSC_VER >= 1800) && (_MSC_VER < 1900) // Visual Studio 2013, MSVC++ 12.0
  152. #define POCO_MSVS_VERSION 2013
  153. #define POCO_MSVC_VERSION 120
  154. #elif (_MSC_VER >= 1900) && (_MSC_VER < 1910) // Visual Studio 2015, MSVC++ 14.0
  155. #define POCO_MSVS_VERSION 2015
  156. #define POCO_MSVC_VERSION 140
  157. #elif (_MSC_VER >= 1910) && (_MSC_VER < 2000) // Visual Studio 2017, MSVC++ 14.1
  158. #define POCO_MSVS_VERSION 2017
  159. #define POCO_MSVC_VERSION 141
  160. #endif
  161. // Unicode Support
  162. #if defined(UNICODE) && !defined(POCO_WIN32_UTF8)
  163. #define POCO_WIN32_UTF8
  164. #endif
  165. #if !defined(POCO_WIN32_UTF8)
  166. #pragma message("Compiling POCO on Windows without #define POCO_WIN32_UTF8 is deprecated.")
  167. #endif
  168. // Turn off some annoying warnings
  169. #if defined(_MSC_VER)
  170. #pragma warning(disable:4018) // signed/unsigned comparison
  171. #pragma warning(disable:4250) // VC++ 11.0: inheriting from std stream classes produces C4250 warning;
  172. // see <http://connect.microsoft.com/VisualStudio/feedback/details/733720/inheriting-from-std-fstream-produces-c4250-warning>
  173. #pragma warning(disable:4251) // ... needs to have dll-interface warning
  174. #pragma warning(disable:4275) // non dll-interface class 'std::exception' used as base for dll-interface class 'Poco::Exception'
  175. #pragma warning(disable:4344) // behavior change: use of explicit template arguments results in call to '...' but '...' is a better match
  176. #pragma warning(disable:4351) // new behavior: elements of array '...' will be default initialized
  177. #pragma warning(disable:4355) // 'this' : used in base member initializer list
  178. #pragma warning(disable:4675) // resolved overload was found by argument-dependent lookup
  179. #pragma warning(disable:4996) // VC++ 8.0 deprecation warnings
  180. #endif
  181. // Enable C++11 support for VS 2010 and newer
  182. #if defined(_MSC_VER) && (_MSC_VER >= 1700) && !defined(POCO_ENABLE_CPP11)
  183. #define POCO_ENABLE_CPP11
  184. #endif
  185. #if defined(__INTEL_COMPILER)
  186. #pragma warning(disable:1738) // base class dllexport/dllimport specification differs from that of the derived class
  187. #pragma warning(disable:1478) // function ... was declared "deprecated"
  188. #pragma warning(disable:1744) // field of class type without a DLL interface used in a class with a DLL interface
  189. #endif
  190. #endif // Foundation_Platform_WIN32_INCLUDED