Add WindowsMinVer config for minimum target Windows version switch
This commit is contained in:
@@ -9,20 +9,13 @@
|
||||
#define WINVER 0x0601
|
||||
#endif
|
||||
#ifndef _WIN32_WINNT
|
||||
#define _WIN32_WINNT 0x0601
|
||||
#define _WIN32_WINNT WINVER
|
||||
#endif
|
||||
#ifndef _WIN32_WINDOWS
|
||||
#define _WIN32_WINDOWS 0x0601
|
||||
#define _WIN32_WINDOWS WINVER
|
||||
#endif
|
||||
|
||||
// Override Win API for UWP
|
||||
#if PLATFORM_UWP
|
||||
#define WINVER 0x0A00
|
||||
#define _WIN32_WINNT 0x0A00
|
||||
#define _WIN32_WINDOWS 0x0A00
|
||||
#endif
|
||||
|
||||
// Override for Xbox Scarlett
|
||||
// Override for Xbox
|
||||
#if PLATFORM_XBOX_SCARLETT || PLATFORM_XBOX_ONE
|
||||
#define NOBITMAP
|
||||
#define NOMCX
|
||||
|
||||
@@ -11,6 +11,15 @@
|
||||
#if USE_EDITOR
|
||||
#include "Editor/Editor.h"
|
||||
#endif
|
||||
#include <sdkddkver.h>
|
||||
#if WINVER >= _WIN32_WINNT_WINBLUE && WINVER < _WIN32_WINNT_WIN10
|
||||
// Fix compilation for Windows 8.1 on the latest Windows SDK
|
||||
typedef enum _MFVideoSphericalFormat { } MFVideoSphericalFormat;
|
||||
#endif
|
||||
#ifndef MF_SOURCE_READER_CURRENT_TYPE_INDEX
|
||||
// Fix compilation for Windows 7 on the latest Windows SDK
|
||||
#define MF_SOURCE_READER_CURRENT_TYPE_INDEX 0xFFFFFFFF
|
||||
#endif
|
||||
#include <mfapi.h>
|
||||
#include <mfidl.h>
|
||||
#include <mfreadwrite.h>
|
||||
|
||||
@@ -77,6 +77,7 @@ namespace Flax.Build.Platforms
|
||||
options.CompileEnv.PreprocessorDefinitions.Add("_WINRT_DLL");
|
||||
options.CompileEnv.PreprocessorDefinitions.Add("_WINDLL");
|
||||
options.CompileEnv.PreprocessorDefinitions.Add("__WRL_NO_DEFAULT_LIB__");
|
||||
options.CompileEnv.PreprocessorDefinitions.Add("WINVER=0x0A00");
|
||||
|
||||
options.LinkEnv.InputLibraries.Add("WindowsApp.lib");
|
||||
}
|
||||
|
||||
@@ -1,10 +1,23 @@
|
||||
// Copyright (c) 2012-2024 Wojciech Figat. All rights reserved.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using Flax.Build.Graph;
|
||||
using Flax.Build.NativeCpp;
|
||||
|
||||
namespace Flax.Build
|
||||
{
|
||||
partial class Configuration
|
||||
{
|
||||
/// <summary>
|
||||
/// Specifies the minimum Windows version to use (eg. 10).
|
||||
/// </summary>
|
||||
[CommandLine("winMinVer", "<version>", "Specifies the minimum Windows version to use (eg. 10).")]
|
||||
public static string WindowsMinVer = "7";
|
||||
}
|
||||
}
|
||||
|
||||
namespace Flax.Build.Platforms
|
||||
{
|
||||
/// <summary>
|
||||
@@ -31,6 +44,25 @@ namespace Flax.Build.Platforms
|
||||
|
||||
options.CompileEnv.PreprocessorDefinitions.Add("PLATFORM_WINDOWS");
|
||||
|
||||
// Select minimum Windows version
|
||||
if (!Version.TryParse(Configuration.WindowsMinVer, out var winMinVer))
|
||||
{
|
||||
if (int.TryParse(Configuration.WindowsMinVer, out var winMinVerMajor))
|
||||
winMinVer = new Version(winMinVerMajor, 0);
|
||||
else
|
||||
winMinVer = new Version(7, 0);
|
||||
}
|
||||
int winVer;
|
||||
if (winMinVer.Major >= 10)
|
||||
winVer = 0x0A00; // Windows 10
|
||||
else if (winMinVer.Major == 8 && winMinVer.Minor >= 1)
|
||||
winVer = 0x0603; // Windows 8.1
|
||||
else if (winMinVer.Major == 8)
|
||||
winVer = 0x0602; // Windows 8
|
||||
else
|
||||
winVer = 0x0601; // Windows 7
|
||||
options.CompileEnv.PreprocessorDefinitions.Add($"WINVER=0x{winVer:X4}");
|
||||
|
||||
options.LinkEnv.InputLibraries.Add("dwmapi.lib");
|
||||
options.LinkEnv.InputLibraries.Add("kernel32.lib");
|
||||
options.LinkEnv.InputLibraries.Add("user32.lib");
|
||||
|
||||
Reference in New Issue
Block a user