0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-11-30 17:10:48 +01:00

SERVER-17866: Make minimum Windows build version Vista/2008

This commit is contained in:
Mark Benvenuto 2015-04-03 15:32:54 -04:00
parent dd6c44de50
commit 6b06d6057c
4 changed files with 46 additions and 55 deletions

View File

@ -319,12 +319,11 @@ add_option('variables-help',
add_option("osx-version-min", "minimum OS X version to support", 1, True)
win_version_min_choices = {
'xpsp3' : ('0501', '0300'),
'ws03sp2' : ('0502', '0200'),
'vista' : ('0600', '0000'),
'ws08r2' : ('0601', '0000'),
'win7' : ('0601', '0000'),
'ws08r2' : ('0601', '0000'),
'win8' : ('0602', '0000'),
'win81' : ('0603', '0000'),
}
add_option("win-version-min", "minimum Windows version to support", 1, True,
@ -960,6 +959,10 @@ elif env.TargetOSIs('windows'):
"/wd4290", "/wd4068", "/wd4351"] )
# some warnings we should treat as errors:
# c4013
# 'function' undefined; assuming extern returning int
# This warning occurs when files compiled for the C language use functions not defined
# in a header file.
# c4099
# identifier' : type name first seen using 'objecttype1' now seen using 'objecttype2'
# This warning occurs when classes and structs are declared with a mix of struct and class
@ -970,7 +973,7 @@ elif env.TargetOSIs('windows'):
# was probably intended as a variable definition. A common example is accidentally
# declaring a function called lock that takes a mutex when one meant to create a guard
# object called lock on the stack.
env.Append( CCFLAGS=["/we4099", "/we4930"] )
env.Append( CCFLAGS=["/we4013", "/we4099", "/we4930"] )
env.Append( CPPDEFINES=["_CONSOLE","_CRT_SECURE_NO_WARNINGS"] )
@ -1006,13 +1009,6 @@ elif env.TargetOSIs('windows'):
env.Append(CCFLAGS=[winRuntimeLibMap[(dynamicCRT, debugBuild)]])
# With VS 2012 and later we need to specify 5.01 as the target console
# so that our 32-bit builds run on Windows XP
# See https://software.intel.com/en-us/articles/linking-applications-using-visual-studio-2012-to-run-on-windows-xp
#
if env["TARGET_ARCH"] == "i386":
env.Append( LINKFLAGS=["/SUBSYSTEM:CONSOLE,5.01"])
if optBuild:
# /O2: optimize for speed (as opposed to size)
# /Oy-: disable frame pointer optimization (overrides /O2, only affects 32-bit)
@ -1273,19 +1269,13 @@ def doConfigure(myenv):
print("WARNING: The build may fail, binaries may crash, or may run but corrupt data...")
# Figure out what our minimum windows version is. If the user has specified, then use
# that. Otherwise, if they have explicitly selected between 32 bit or 64 bit, choose XP or
# Vista respectively. Finally, if they haven't done either of these, try invoking the
# compiler to figure out whether we are doing a 32 or 64 bit build and select as
# appropriate.
# that.
if env.TargetOSIs('windows'):
win_version_min = None
if has_option('win-version-min'):
win_version_min = get_option('win-version-min')
# If no minimum version has beeen specified, use our defaults for 32-bit/64-bit windows.
elif env['TARGET_ARCH'] == 'x86_64':
win_version_min = 'ws03sp2'
elif env['TARGET_ARCH'] == 'i386':
win_version_min = 'xpsp3'
else:
# If no minimum version has beeen specified, use our default
win_version_min = 'vista'
env['WIN_VERSION_MIN'] = win_version_min
win_version_min = win_version_min_choices[win_version_min]
@ -1540,6 +1530,33 @@ def doConfigure(myenv):
Exit(1)
myenv.Append(CPPDEFINES=["_GLIBCXX_DEBUG"]);
# Check if we have a modern Windows SDK
if env.TargetOSIs('windows'):
def CheckWindowsSDKVersion(context):
test_body = """
#include <windows.h>
#if !defined(NTDDI_WINBLUE)
#error Need Windows SDK Version 8.1 or higher
#endif
"""
context.Message('Checking Windows SDK is 8.1 or newer... ')
ret = context.TryCompile(textwrap.dedent(test_body), ".c")
context.Result(ret)
return ret
conf = Configure(myenv, help=False, custom_tests = {
'CheckWindowsSDKVersion' : CheckWindowsSDKVersion,
})
if not conf.CheckWindowsSDKVersion():
print( 'Windows SDK Version 8.1 or higher is required to build MongoDB' )
Exit(1)
conf.Finish()
# Check if we are on a POSIX system by testing if _POSIX_VERSION is defined.
def CheckPosixSystem(context):

View File

@ -97,12 +97,10 @@
#error "Expected WINVER to have been defined and to equal _WIN32_WINNT"
#endif
#if defined(_WIN64)
#if !defined(NTDDI_WS03SP2) || (NTDDI_VERSION < NTDDI_WS03SP2)
#error "64 bit mongo does not support Windows versions older than Windows Server 2003 SP 2"
#endif
#else
#if !defined(NTDDI_WINXPSP3) || (NTDDI_VERSION < NTDDI_WINXPSP3)
#error "32 bit mongo does not support Windows versions older than XP Service Pack 3"
#if !defined(NTDDI_WINBLUE)
#error "MongoDB requires Windows SDK 8.1 or higher to build"
#endif
#if !defined(NTDDI_VISTA) || NTDDI_VERSION < NTDDI_VISTA
#error "MongoDB does not support Windows versions older than Windows Vista"
#endif

View File

@ -30,28 +30,6 @@
#ifndef _WIN32
# include <sys/poll.h>
#else
# if defined(NTDDI_VERSION) && ( !defined(NTDDI_VISTA) || ( NTDDI_VERSION < NTDDI_VISTA ) )
// These are only defined in winsock2.h on newer windows but we need them everywhere.
# define POLLRDNORM 0x0100
# define POLLRDBAND 0x0200
# define POLLIN (POLLRDNORM | POLLRDBAND)
# define POLLPRI 0x0400
# define POLLWRNORM 0x0010
# define POLLOUT (POLLWRNORM)
# define POLLWRBAND 0x0020
# define POLLERR 0x0001
# define POLLHUP 0x0002
# define POLLNVAL 0x0004
struct pollfd {
SOCKET fd;
SHORT events;
SHORT revents;
};
# endif // old windows
#endif // ndef _WIN32
namespace mongo {

View File

@ -86,12 +86,10 @@ namespace mongo {
#if defined(_WIN32)
std::string targetMinOS() {
stringstream ss;
#if (NTDDI_VERSION >= 0x06010000)
#if (NTDDI_VERSION >= NTDDI_WIN7)
ss << "Windows 7/Windows Server 2008 R2";
#elif (NTDDI_VERSION >= 0x05020200)
ss << "Windows Server 2003 SP2";
#elif (NTDDI_VERSION >= 0x05010300)
ss << "Windows XP SP3";
#elif (NTDDI_VERSION >= NTDDI_VISTA)
ss << "Windows Vista/Windows Server 2008";
#else
#error This targetted Windows version is not supported
#endif // NTDDI_VERSION