forked from boostorg/predef
correct Windows UWP platform detection (#57)
This commit is contained in:
committed by
Rene Rivera
parent
aa4604a3bd
commit
bca18299d2
@@ -12,10 +12,13 @@ http://www.boost.org/LICENSE_1_0.txt)
|
||||
#endif
|
||||
|
||||
#include <boost/predef/platform/mingw.h>
|
||||
#include <boost/predef/platform/windows_uwp.h>
|
||||
#include <boost/predef/platform/windows_desktop.h>
|
||||
#include <boost/predef/platform/windows_store.h>
|
||||
#include <boost/predef/platform/windows_phone.h>
|
||||
#include <boost/predef/platform/windows_runtime.h>
|
||||
#include <boost/predef/platform/windows_server.h>
|
||||
#include <boost/predef/platform/windows_store.h>
|
||||
#include <boost/predef/platform/windows_system.h>
|
||||
#include <boost/predef/platform/windows_runtime.h> // deprecated
|
||||
#include <boost/predef/platform/ios.h>
|
||||
/*#include <boost/predef/platform/.h>*/
|
||||
|
||||
|
||||
@@ -9,17 +9,21 @@ http://www.boost.org/LICENSE_1_0.txt)
|
||||
#ifndef BOOST_PREDEF_PLAT_WINDOWS_DESKTOP_H
|
||||
#define BOOST_PREDEF_PLAT_WINDOWS_DESKTOP_H
|
||||
|
||||
#include <boost/predef/version_number.h>
|
||||
#include <boost/predef/make.h>
|
||||
#include <boost/predef/os/windows.h>
|
||||
#include <boost/predef/platform/windows_uwp.h>
|
||||
#include <boost/predef/version_number.h>
|
||||
|
||||
/*`
|
||||
[heading `BOOST_PLAT_WINDOWS_DESKTOP`]
|
||||
|
||||
BOOST_PLAT_WINDOWS_DESKTOP is available if the Platform SDK supports UWP development
|
||||
with the DESKTOP family, and WINAPI_FAMILY is set to WINAPI_FAMILY_DESKTOP_APP.
|
||||
|
||||
[table
|
||||
[[__predef_symbol__] [__predef_version__]]
|
||||
|
||||
[[`!WINAPI_FAMILY`] [__predef_detection__]]
|
||||
[[`WINAPI_FAMILY_DESKTOP_APP`] [__predef_detection__]]
|
||||
[[`WINAPI_FAMILY == WINAPI_FAMILY_DESKTOP_APP`] [__predef_detection__]]
|
||||
]
|
||||
*/
|
||||
@@ -27,7 +31,7 @@ http://www.boost.org/LICENSE_1_0.txt)
|
||||
#define BOOST_PLAT_WINDOWS_DESKTOP BOOST_VERSION_NUMBER_NOT_AVAILABLE
|
||||
|
||||
#if BOOST_OS_WINDOWS && \
|
||||
( !defined(WINAPI_FAMILY) || (WINAPI_FAMILY == WINAPI_FAMILY_DESKTOP_APP) )
|
||||
defined(WINAPI_FAMILY_DESKTOP_APP) && WINAPI_FAMILY == WINAPI_FAMILY_DESKTOP_APP
|
||||
# undef BOOST_PLAT_WINDOWS_DESKTOP
|
||||
# define BOOST_PLAT_WINDOWS_DESKTOP BOOST_VERSION_NUMBER_AVAILABLE
|
||||
#endif
|
||||
|
||||
@@ -9,23 +9,29 @@ http://www.boost.org/LICENSE_1_0.txt)
|
||||
#ifndef BOOST_PREDEF_PLAT_WINDOWS_PHONE_H
|
||||
#define BOOST_PREDEF_PLAT_WINDOWS_PHONE_H
|
||||
|
||||
#include <boost/predef/version_number.h>
|
||||
#include <boost/predef/make.h>
|
||||
#include <boost/predef/os/windows.h>
|
||||
#include <boost/predef/platform/windows_uwp.h>
|
||||
#include <boost/predef/version_number.h>
|
||||
|
||||
/*`
|
||||
[heading `BOOST_PLAT_WINDOWS_PHONE`]
|
||||
|
||||
BOOST_PLAT_WINDOWS_PHONE is available if the Platform SDK supports UWP development
|
||||
with the PHONE family, and WINAPI_FAMILY is set to WINAPI_FAMILY_PHONE_APP.
|
||||
|
||||
[table
|
||||
[[__predef_symbol__] [__predef_version__]]
|
||||
|
||||
[[`WINAPI_FAMILY_PHONE_APP`] [__predef_detection__]]
|
||||
[[`WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP`] [__predef_detection__]]
|
||||
]
|
||||
*/
|
||||
|
||||
#define BOOST_PLAT_WINDOWS_PHONE BOOST_VERSION_NUMBER_NOT_AVAILABLE
|
||||
|
||||
#if BOOST_OS_WINDOWS && defined(WINAPI_FAMILY) && WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP
|
||||
#if BOOST_OS_WINDOWS && \
|
||||
defined(WINAPI_FAMILY_PHONE_APP) && WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP
|
||||
# undef BOOST_PLAT_WINDOWS_PHONE
|
||||
# define BOOST_PLAT_WINDOWS_PHONE BOOST_VERSION_NUMBER_AVAILABLE
|
||||
#endif
|
||||
|
||||
@@ -9,25 +9,33 @@ http://www.boost.org/LICENSE_1_0.txt)
|
||||
#ifndef BOOST_PREDEF_PLAT_WINDOWS_RUNTIME_H
|
||||
#define BOOST_PREDEF_PLAT_WINDOWS_RUNTIME_H
|
||||
|
||||
#include <boost/predef/version_number.h>
|
||||
#include <boost/predef/make.h>
|
||||
#include <boost/predef/os/windows.h>
|
||||
#include <boost/predef/platform/windows_phone.h>
|
||||
#include <boost/predef/platform/windows_store.h>
|
||||
#include <boost/predef/version_number.h>
|
||||
|
||||
/*`
|
||||
[heading `BOOST_PLAT_WINDOWS_RUNTIME`]
|
||||
|
||||
This is deprecated. Consumers should switch to use:
|
||||
|
||||
`BOOST_PLAT_WINDOWS_PHONE || BOOST_PLAT_WINDOWS_STORE`
|
||||
|
||||
to detect a non-desktop UWP target.
|
||||
|
||||
[table
|
||||
[[__predef_symbol__] [__predef_version__]]
|
||||
|
||||
[[`WINAPI_FAMILY == WINAPI_FAMILY_APP`] [__predef_detection__]]
|
||||
[[`WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP`] [__predef_detection__]]
|
||||
[[`BOOST_PLAT_WINDOWS_PHONE`] [__predef_detection__]]
|
||||
[[`BOOST_PLAT_WINDOWS_STORE`] [__predef_detection__]]
|
||||
]
|
||||
*/
|
||||
|
||||
#define BOOST_PLAT_WINDOWS_RUNTIME BOOST_VERSION_NUMBER_NOT_AVAILABLE
|
||||
|
||||
#if BOOST_OS_WINDOWS && defined(WINAPI_FAMILY) && \
|
||||
( WINAPI_FAMILY == WINAPI_FAMILY_APP || WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP )
|
||||
#if BOOST_OS_WINDOWS && \
|
||||
(BOOST_PLAT_WINDOWS_STORE || BOOST_PLAT_WINDOWS_PHONE)
|
||||
# undef BOOST_PLAT_WINDOWS_RUNTIME
|
||||
# define BOOST_PLAT_WINDOWS_RUNTIME BOOST_VERSION_NUMBER_AVAILABLE
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
Copyright James E. King III, 2017
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(See accompanying file LICENSE_1_0.txt or copy at
|
||||
http://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
|
||||
#ifndef BOOST_PREDEF_PLAT_WINDOWS_SERVER_H
|
||||
#define BOOST_PREDEF_PLAT_WINDOWS_SERVER_H
|
||||
|
||||
#include <boost/predef/make.h>
|
||||
#include <boost/predef/os/windows.h>
|
||||
#include <boost/predef/platform/windows_uwp.h>
|
||||
#include <boost/predef/version_number.h>
|
||||
|
||||
/*`
|
||||
[heading `BOOST_PLAT_WINDOWS_SERVER`]
|
||||
|
||||
BOOST_PLAT_WINDOWS_SERVER is available if the Platform SDK supports UWP development
|
||||
with the SERVER family, and WINAPI_FAMILY is set to WINAPI_FAMILY_SERVER_APP.
|
||||
|
||||
[table
|
||||
[[__predef_symbol__] [__predef_version__]]
|
||||
|
||||
[[`WINAPI_FAMILY_SERVER`] [__predef_detection__]]
|
||||
[[`WINAPI_FAMILY == WINAPI_FAMILY_SERVER`] [__predef_detection__]]
|
||||
]
|
||||
*/
|
||||
|
||||
#define BOOST_PLAT_WINDOWS_SERVER BOOST_VERSION_NUMBER_NOT_AVAILABLE
|
||||
|
||||
#if BOOST_OS_WINDOWS && \
|
||||
defined(WINAPI_FAMILY_SERVER) && WINAPI_FAMILY == WINAPI_FAMILY_SERVER
|
||||
# undef BOOST_PLAT_WINDOWS_SERVER
|
||||
# define BOOST_PLAT_WINDOWS_SERVER BOOST_VERSION_NUMBER_AVAILABLE
|
||||
#endif
|
||||
|
||||
#if BOOST_PLAT_WINDOWS_SERVER
|
||||
# define BOOST_PLAT_WINDOWS_SERVER_AVAILABLE
|
||||
# include <boost/predef/detail/platform_detected.h>
|
||||
#endif
|
||||
|
||||
#define BOOST_PLAT_WINDOWS_SERVER_NAME "Windows Server"
|
||||
|
||||
#endif
|
||||
|
||||
#include <boost/predef/detail/test.h>
|
||||
BOOST_PREDEF_DECLARE_TEST(BOOST_PLAT_WINDOWS_SERVER,BOOST_PLAT_WINDOWS_SERVER_NAME)
|
||||
@@ -9,9 +9,10 @@ http://www.boost.org/LICENSE_1_0.txt)
|
||||
#ifndef BOOST_PREDEF_PLAT_WINDOWS_STORE_H
|
||||
#define BOOST_PREDEF_PLAT_WINDOWS_STORE_H
|
||||
|
||||
#include <boost/predef/version_number.h>
|
||||
#include <boost/predef/make.h>
|
||||
#include <boost/predef/os/windows.h>
|
||||
#include <boost/predef/platform/windows_uwp.h>
|
||||
#include <boost/predef/version_number.h>
|
||||
|
||||
/*`
|
||||
[heading `BOOST_PLAT_WINDOWS_STORE`]
|
||||
@@ -19,13 +20,16 @@ http://www.boost.org/LICENSE_1_0.txt)
|
||||
[table
|
||||
[[__predef_symbol__] [__predef_version__]]
|
||||
|
||||
[[`WINAPI_FAMILY == WINAPI_FAMILY_APP`] [__predef_detection__]]
|
||||
]
|
||||
[[`WINAPI_FAMILY == WINAPI_FAMILY_PC_APP`] [__predef_detection__]]
|
||||
[[`WINAPI_FAMILY == WINAPI_FAMILY_APP` (deprecated)] [__predef_detection__]]
|
||||
]
|
||||
*/
|
||||
|
||||
#define BOOST_PLAT_WINDOWS_STORE BOOST_VERSION_NUMBER_NOT_AVAILABLE
|
||||
|
||||
#if BOOST_OS_WINDOWS && defined(WINAPI_FAMILY) && WINAPI_FAMILY == WINAPI_FAMILY_APP
|
||||
#if BOOST_OS_WINDOWS && \
|
||||
((defined(WINAPI_FAMILY_PC_APP) && WINAPI_FAMILY == WINAPI_FAMILY_PC_APP) || \
|
||||
(defined(WINAPI_FAMILY_APP) && WINAPI_FAMILY == WINAPI_FAMILY_APP))
|
||||
# undef BOOST_PLAT_WINDOWS_STORE
|
||||
# define BOOST_PLAT_WINDOWS_STORE BOOST_VERSION_NUMBER_AVAILABLE
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
Copyright James E. King III, 2017
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(See accompanying file LICENSE_1_0.txt or copy at
|
||||
http://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
|
||||
#ifndef BOOST_PREDEF_PLAT_WINDOWS_SYSTEM_H
|
||||
#define BOOST_PREDEF_PLAT_WINDOWS_SYSTEM_H
|
||||
|
||||
#include <boost/predef/make.h>
|
||||
#include <boost/predef/os/windows.h>
|
||||
#include <boost/predef/platform/windows_uwp.h>
|
||||
#include <boost/predef/version_number.h>
|
||||
|
||||
/*`
|
||||
[heading `BOOST_PLAT_WINDOWS_SYSTEM`]
|
||||
|
||||
BOOST_PLAT_WINDOWS_SYSTEM is available if the Platform SDK supports UWP development
|
||||
with the SYSTEM family, and WINAPI_FAMILY is set to WINAPI_FAMILY_SYSTEM_APP.
|
||||
|
||||
[table
|
||||
[[__predef_symbol__] [__predef_version__]]
|
||||
|
||||
[[`WINAPI_FAMILY_SYSTEM`] [__predef_detection__]]
|
||||
[[`WINAPI_FAMILY == WINAPI_FAMILY_SYSTEM`] [__predef_detection__]]
|
||||
]
|
||||
*/
|
||||
|
||||
#define BOOST_PLAT_WINDOWS_SYSTEM BOOST_VERSION_NUMBER_NOT_AVAILABLE
|
||||
|
||||
#if BOOST_OS_WINDOWS && \
|
||||
defined(WINAPI_FAMILY_SYSTEM) && WINAPI_FAMILY == WINAPI_FAMILY_SYSTEM
|
||||
# undef BOOST_PLAT_WINDOWS_SYSTEM
|
||||
# define BOOST_PLAT_WINDOWS_SYSTEM BOOST_VERSION_NUMBER_AVAILABLE
|
||||
#endif
|
||||
|
||||
#if BOOST_PLAT_WINDOWS_SYSTEM
|
||||
# define BOOST_PLAT_WINDOWS_SYSTEM_AVAILABLE
|
||||
# include <boost/predef/detail/platform_detected.h>
|
||||
#endif
|
||||
|
||||
#define BOOST_PLAT_WINDOWS_SYSTEM_NAME "Windows Drivers and Tools"
|
||||
|
||||
#endif
|
||||
|
||||
#include <boost/predef/detail/test.h>
|
||||
BOOST_PREDEF_DECLARE_TEST(BOOST_PLAT_WINDOWS_SYSTEM,BOOST_PLAT_WINDOWS_SYSTEM_NAME)
|
||||
@@ -0,0 +1,72 @@
|
||||
/*
|
||||
Copyright James E. King III, 2017
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(See accompanying file LICENSE_1_0.txt or copy at
|
||||
http://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
|
||||
#ifndef BOOST_PREDEF_PLAT_WINDOWS_UWP_H
|
||||
#define BOOST_PREDEF_PLAT_WINDOWS_UWP_H
|
||||
|
||||
#include <boost/predef/make.h>
|
||||
#include <boost/predef/os/windows.h>
|
||||
#include <boost/predef/version_number.h>
|
||||
|
||||
/*`
|
||||
[heading `BOOST_PLAT_WINDOWS_UWP`]
|
||||
|
||||
[@http://docs.microsoft.com/windows/uwp/ Universal Windows Platform].
|
||||
BOOST_PLAT_WINDOWS_UWP is available if the current development environment
|
||||
is capable of targeting Universal Windows Platform development. To target
|
||||
a specific family one would define WINAPI_FAMILY, and in a UWP-capable
|
||||
environment this may limit the Win32 APIs available to achieve portability.
|
||||
|
||||
To detect Windows API availability that is backwards compatible to pre-UWP SDKs, use:
|
||||
`#if !BOOST_PLAT_WINDOWS_UWP || BOOST_PLAT_WINDOWS_DESKTOP`
|
||||
|
||||
To detect Windows API availability in a specific UWP family, for example SYSTEM:
|
||||
`#if BOOST_PLAT_WINDOWS_SYSTEM`
|
||||
|
||||
UWP development is available on:
|
||||
- Microsoft Windows SDK 8.0 or later
|
||||
- MinGW-w64 version 3.0 or later
|
||||
|
||||
[table
|
||||
[[__predef_symbol__] [__predef_version__]]
|
||||
|
||||
[[`__MINGW64_VERSION_MAJOR` from `_mingw.h`] [`>= 3`]]
|
||||
[[`VER_PRODUCTBUILD` from `ntverp.h`] [`>= 9200`]]
|
||||
]
|
||||
*/
|
||||
|
||||
#define BOOST_PLAT_WINDOWS_UWP BOOST_VERSION_NUMBER_NOT_AVAILABLE
|
||||
#define BOOST_PLAT_WINDOWS_SDK_VERSION BOOST_VERSION_NUMBER_NOT_AVAILABLE
|
||||
|
||||
#if BOOST_OS_WINDOWS
|
||||
// MinGW (32-bit) has no ntverp.h header
|
||||
#if !defined(__MINGW32__)
|
||||
# include <ntverp.h>
|
||||
# undef BOOST_PLAT_WINDOWS_SDK_VERSION
|
||||
# define BOOST_PLAT_WINDOWS_SDK_VERSION BOOST_VERSION_NUMBER(0, 0, VER_PRODUCTBUILD)
|
||||
#endif
|
||||
|
||||
// 9200 is Windows SDK 8.0 from ntverp.h which introduced family support
|
||||
#if ((BOOST_PLAT_WINDOWS_SDK_VERSION >= BOOST_VERSION_NUMBER(0, 0, 9200)) || \
|
||||
(defined(__MINGW64__) && __MINGW64_VERSION_MAJOR >= 3))
|
||||
# undef BOOST_PLAT_WINDOWS_UWP
|
||||
# define BOOST_PLAT_WINDOWS_UWP BOOST_VERSION_NUMBER_AVAILABLE
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if BOOST_PLAT_WINDOWS_UWP
|
||||
# define BOOST_PLAT_WINDOWS_UWP_AVAILABLE
|
||||
# include <boost/predef/detail/platform_detected.h>
|
||||
# include <winapifamily.h> // Windows SDK
|
||||
#endif
|
||||
|
||||
#define BOOST_PLAT_WINDOWS_UWP_NAME "Universal Windows Platform"
|
||||
|
||||
#endif
|
||||
|
||||
#include <boost/predef/detail/test.h>
|
||||
BOOST_PREDEF_DECLARE_TEST(BOOST_PLAT_WINDOWS_UWP, BOOST_PLAT_WINDOWS_UWP_NAME)
|
||||
Reference in New Issue
Block a user