scons: Support winddk 6001.18002.
This commit is contained in:
parent
5ccbccb3c1
commit
71793e0f79
|
@ -252,21 +252,24 @@ def generate(env):
|
||||||
# http://msdn2.microsoft.com/en-us/library/6dwk3a1z.aspx,
|
# http://msdn2.microsoft.com/en-us/library/6dwk3a1z.aspx,
|
||||||
'WIN32_LEAN_AND_MEAN',
|
'WIN32_LEAN_AND_MEAN',
|
||||||
]
|
]
|
||||||
if msvc:
|
if msvc and env['toolchain'] != 'winddk':
|
||||||
cppdefines += [
|
cppdefines += [
|
||||||
'VC_EXTRALEAN',
|
'VC_EXTRALEAN',
|
||||||
'_CRT_SECURE_NO_DEPRECATE',
|
'_CRT_SECURE_NO_DEPRECATE',
|
||||||
]
|
]
|
||||||
if debug:
|
if debug:
|
||||||
cppdefines += ['_DEBUG']
|
cppdefines += ['_DEBUG']
|
||||||
if platform == 'winddk':
|
if env['toolchain'] == 'winddk':
|
||||||
# Mimic WINDDK's builtin flags. See also:
|
# Mimic WINDDK's builtin flags. See also:
|
||||||
# - WINDDK's bin/makefile.new i386mk.inc for more info.
|
# - WINDDK's bin/makefile.new i386mk.inc for more info.
|
||||||
# - buildchk_wxp_x86.log files, generated by the WINDDK's build
|
# - buildchk_wxp_x86.log files, generated by the WINDDK's build
|
||||||
# - http://alter.org.ua/docs/nt_kernel/vc8_proj/
|
# - http://alter.org.ua/docs/nt_kernel/vc8_proj/
|
||||||
|
if machine == 'x86':
|
||||||
|
cppdefines += ['_X86_', 'i386']
|
||||||
|
if machine == 'x86_64':
|
||||||
|
cppdefines += ['_AMD64_', 'AMD64']
|
||||||
|
if platform == 'winddk':
|
||||||
cppdefines += [
|
cppdefines += [
|
||||||
('_X86_', '1'),
|
|
||||||
('i386', '1'),
|
|
||||||
'STD_CALL',
|
'STD_CALL',
|
||||||
('CONDITION_HANDLING', '1'),
|
('CONDITION_HANDLING', '1'),
|
||||||
('NT_INST', '0'),
|
('NT_INST', '0'),
|
||||||
|
@ -309,15 +312,6 @@ def generate(env):
|
||||||
cppdefines += ['PIPE_SUBSYSTEM_WINDOWS_CE_OGL']
|
cppdefines += ['PIPE_SUBSYSTEM_WINDOWS_CE_OGL']
|
||||||
env.Append(CPPDEFINES = cppdefines)
|
env.Append(CPPDEFINES = cppdefines)
|
||||||
|
|
||||||
# C preprocessor includes
|
|
||||||
if platform == 'winddk':
|
|
||||||
env.Append(CPPPATH = [
|
|
||||||
env['SDK_INC_PATH'],
|
|
||||||
env['DDK_INC_PATH'],
|
|
||||||
env['WDM_INC_PATH'],
|
|
||||||
env['CRT_INC_PATH'],
|
|
||||||
])
|
|
||||||
|
|
||||||
# C compiler options
|
# C compiler options
|
||||||
cflags = []
|
cflags = []
|
||||||
if gcc:
|
if gcc:
|
||||||
|
|
125
scons/winddk.py
125
scons/winddk.py
|
@ -44,87 +44,90 @@ import msvc_sa
|
||||||
import mslib_sa
|
import mslib_sa
|
||||||
import mslink_sa
|
import mslink_sa
|
||||||
|
|
||||||
def get_winddk_root(env):
|
versions = [
|
||||||
try:
|
'6001.18002',
|
||||||
return os.environ['BASEDIR']
|
'3790.1830',
|
||||||
except KeyError:
|
]
|
||||||
pass
|
|
||||||
|
|
||||||
version = "3790.1830"
|
def cpu_bin(target_cpu):
|
||||||
|
if target_cpu == 'i386':
|
||||||
if SCons.Util.can_read_reg:
|
return 'x86'
|
||||||
key = r'SOFTWARE\Microsoft\WINDDK\%s\LFNDirectory' % version
|
else:
|
||||||
try:
|
return target_cpu
|
||||||
path, t = SCons.Util.RegGetValue(SCons.Util.HKEY_LOCAL_MACHINE, key)
|
|
||||||
except SCons.Util.RegError:
|
|
||||||
pass
|
|
||||||
else:
|
|
||||||
return path
|
|
||||||
|
|
||||||
|
def get_winddk_root(env, version):
|
||||||
default_path = os.path.join(r'C:\WINDDK', version)
|
default_path = os.path.join(r'C:\WINDDK', version)
|
||||||
if os.path.exists(default_path):
|
if os.path.exists(default_path):
|
||||||
return default_path
|
return default_path
|
||||||
|
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def get_winddk_paths(env):
|
def get_winddk_paths(env, version, root):
|
||||||
"""Return a 3-tuple of (INCLUDE, LIB, PATH) as the values
|
version_major, version_minor = map(int, version.split('.'))
|
||||||
of those three environment variables that should be set
|
|
||||||
in order to execute the MSVC tools properly."""
|
|
||||||
|
|
||||||
WINDDKdir = None
|
if version_major >= 6000:
|
||||||
exe_paths = []
|
target_os = 'wlh'
|
||||||
lib_paths = []
|
else:
|
||||||
include_paths = []
|
target_os = 'wxp'
|
||||||
|
|
||||||
WINDDKdir = get_winddk_root(env)
|
if env['machine'] in ('generic', 'x86'):
|
||||||
if WINDDKdir is None:
|
target_cpu = 'i386'
|
||||||
raise SCons.Errors.InternalError, "WINDDK not found"
|
elif env['machine'] == 'x86_64':
|
||||||
|
target_cpu = 'amd64'
|
||||||
|
else:
|
||||||
|
raise SCons.Errors.InternalError, "Unsupported target machine"
|
||||||
|
|
||||||
exe_paths.append( os.path.join(WINDDKdir, 'bin') )
|
if version_major >= 6000:
|
||||||
exe_paths.append( os.path.join(WINDDKdir, 'bin', 'x86') )
|
# TODO: take in consideration the host cpu
|
||||||
include_paths.append( os.path.join(WINDDKdir, 'inc', 'wxp') )
|
bin_dir = os.path.join(root, 'bin', 'x86', cpu_bin(target_cpu))
|
||||||
lib_paths.append( os.path.join(WINDDKdir, 'lib') )
|
else:
|
||||||
|
if target_cpu == 'i386':
|
||||||
|
bin_dir = os.path.join(root, 'bin', 'x86')
|
||||||
|
else:
|
||||||
|
# TODO: take in consideration the host cpu
|
||||||
|
bin_dir = os.path.join(root, 'bin', 'win64', 'x86', cpu_bin(target_cpu))
|
||||||
|
|
||||||
target_os = 'wxp'
|
env.PrependENVPath('PATH', [bin_dir])
|
||||||
target_cpu = 'i386'
|
|
||||||
|
|
||||||
env['SDK_INC_PATH'] = os.path.join(WINDDKdir, 'inc', target_os)
|
crt_inc_dir = os.path.join(root, 'inc', 'crt')
|
||||||
env['CRT_INC_PATH'] = os.path.join(WINDDKdir, 'inc', 'crt')
|
if version_major >= 6000:
|
||||||
env['DDK_INC_PATH'] = os.path.join(WINDDKdir, 'inc', 'ddk', target_os)
|
sdk_inc_dir = os.path.join(root, 'inc', 'api')
|
||||||
env['WDM_INC_PATH'] = os.path.join(WINDDKdir, 'inc', 'ddk', 'wdm', target_os)
|
ddk_inc_dir = os.path.join(root, 'inc', 'ddk')
|
||||||
|
wdm_inc_dir = os.path.join(root, 'inc', 'ddk')
|
||||||
|
else:
|
||||||
|
ddk_inc_dir = os.path.join(root, 'inc', 'ddk', target_os)
|
||||||
|
sdk_inc_dir = os.path.join(root, 'inc', target_os)
|
||||||
|
wdm_inc_dir = os.path.join(root, 'inc', 'ddk', 'wdm', target_os)
|
||||||
|
|
||||||
env['SDK_LIB_PATH'] = os.path.join(WINDDKdir, 'lib', target_os, target_cpu)
|
env.PrependENVPath('INCLUDE', [
|
||||||
env['CRT_LIB_PATH'] = os.path.join(WINDDKdir, 'lib', 'crt', target_cpu)
|
wdm_inc_dir,
|
||||||
env['DDK_LIB_PATH'] = os.path.join(WINDDKdir, 'lib', target_os, target_cpu)
|
ddk_inc_dir,
|
||||||
env['WDM_LIB_PATH'] = os.path.join(WINDDKdir, 'lib', target_os, target_cpu)
|
crt_inc_dir,
|
||||||
|
sdk_inc_dir,
|
||||||
include_path = string.join( include_paths, os.pathsep )
|
])
|
||||||
lib_path = string.join(lib_paths, os.pathsep )
|
|
||||||
exe_path = string.join(exe_paths, os.pathsep )
|
env.PrependENVPath('LIB', [
|
||||||
return (include_path, lib_path, exe_path)
|
os.path.join(root, 'lib', 'crt', target_cpu),
|
||||||
|
os.path.join(root, 'lib', target_os, target_cpu),
|
||||||
|
])
|
||||||
|
|
||||||
def generate(env):
|
def generate(env):
|
||||||
|
if not env.has_key('ENV'):
|
||||||
|
env['ENV'] = {}
|
||||||
|
|
||||||
|
for version in versions:
|
||||||
|
root = get_winddk_root(env, version)
|
||||||
|
if root is not None:
|
||||||
|
get_winddk_paths(env, version, root)
|
||||||
|
break
|
||||||
|
|
||||||
msvc_sa.generate(env)
|
msvc_sa.generate(env)
|
||||||
mslib_sa.generate(env)
|
mslib_sa.generate(env)
|
||||||
mslink_sa.generate(env)
|
mslink_sa.generate(env)
|
||||||
|
|
||||||
if not env.has_key('ENV'):
|
|
||||||
env['ENV'] = {}
|
|
||||||
|
|
||||||
try:
|
|
||||||
include_path, lib_path, exe_path = get_winddk_paths(env)
|
|
||||||
|
|
||||||
# since other tools can set these, we just make sure that the
|
|
||||||
# relevant stuff from WINDDK is in there somewhere.
|
|
||||||
env.PrependENVPath('INCLUDE', include_path)
|
|
||||||
env.PrependENVPath('LIB', lib_path)
|
|
||||||
env.PrependENVPath('PATH', exe_path)
|
|
||||||
except (SCons.Util.RegError, SCons.Errors.InternalError):
|
|
||||||
pass
|
|
||||||
|
|
||||||
def exists(env):
|
def exists(env):
|
||||||
return get_winddk_root(env) is not None
|
for version in versions:
|
||||||
|
if get_winddk_root(env, version) is not None:
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
|
||||||
# vim:set ts=4 sw=4 et:
|
# vim:set ts=4 sw=4 et:
|
||||||
|
|
Loading…
Reference in New Issue