windows: Move G_WINAPI_ONLY_APP to config.h

Also set the Windows version to be 10 or newer when targeting UWP, since
the Windows 8 SDK does not have many of the APIs we need, such as
_beginthreadex.
This commit is contained in:
Nirbheek Chauhan 2019-08-14 10:43:49 +05:30
parent fe01e81326
commit f84ef02914
2 changed files with 15 additions and 8 deletions

View File

@ -39,12 +39,6 @@
#include <sys/cygwin.h>
#endif
/* Default family is DESKTOP_APP which is DESKTOP | APP
* We want to know when we're only building for apps */
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) && !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
#define G_WINAPI_ONLY_APP
#endif
static void
set_error (const gchar *format,
...)

View File

@ -400,9 +400,22 @@ add_project_arguments(cc.get_supported_arguments(warning_c_args), language: 'c')
# improve this.
glib_link_flags = cc.get_supported_link_arguments(warning_c_link_args)
# Windows Support (7+)
# Windows SDK requirements and checks
if host_system == 'windows'
glib_conf.set('_WIN32_WINNT', '0x0601')
# Check whether we're building for UWP apps
code = '''
#include <windows.h>
#if !(WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) && !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP))
#error "Not building for UWP"
#endif'''
if cc.compiles(code, name : 'building for UWP')
glib_conf.set('G_WINAPI_ONLY_APP', true)
# We require Windows 10+ on WinRT
glib_conf.set('_WIN32_WINNT', '0x0A00')
else
# We require Windows 7+ on Win32
glib_conf.set('_WIN32_WINNT', '0x0601')
endif
endif
functions = [