A few more tweaks to get correct WINDDK compilation.

This commit is contained in:
José Fonseca 2008-02-24 16:43:07 +09:00
parent 7aadb475e5
commit e70a431c3d
2 changed files with 64 additions and 12 deletions

View File

@ -39,13 +39,17 @@ if default_platform in ('linux', 'freebsd', 'darwin'):
default_statetrackers = 'mesa'
default_drivers = 'softpipe,failover,i915simple,i965simple'
default_winsys = 'xlib'
default_dri = 'yes'
elif default_platform in ('winddk',):
default_statetrackers = 'none'
default_drivers = 'softpipe,i915simple'
default_winsys = 'none'
default_dri = 'no'
else:
default_drivers = 'all'
default_winsys = 'all'
default_dri = 'no'
# TODO: auto-detect defaults
opts = Options('config.py')
@ -75,7 +79,7 @@ opts.Add(ListOption('winsys', 'winsys drivers to build', default_winsys,
],
))
opts.Add(BoolOption('llvm', 'use LLVM', 'no'))
opts.Add(BoolOption('dri', 'build DRI drivers', 'no'))
opts.Add(BoolOption('dri', 'build DRI drivers', default_dri))
env = Environment(
options = opts,
@ -125,17 +129,23 @@ if platform == 'winddk':
WINDDK = "C:\\WINDDK\\3790.1830"
# NOTE: We need this elaborate construct to get the absolute paths and
# forward slashes to msvc unharmed when cross compiling from posix platforms
env.Append(CPPFLAGS = [
escape('/I' + ntpath.join(WINDDK, 'inc\\ddk\\wxp')),
escape('/I' + ntpath.join(WINDDK, 'inc\\ddk\\wdm\\wxp')),
escape('/I' + ntpath.join(WINDDK, 'inc\\crt')),
])
env.Append(CPPDEFINES = [
('i386', '1'),
])
if debug:
env.Append(CPPDEFINES = ['DBG'])
#env.Append(CPPFLAGS = [
# escape('/I' + ntpath.join(WINDDK, 'inc\\wxp')),
# escape('/I' + ntpath.join(WINDDK, 'inc\\ddk\\wxp')),
# escape('/I' + ntpath.join(WINDDK, 'inc\\ddk\\wdm\\wxp')),
# escape('/I' + ntpath.join(WINDDK, 'inc\\crt')),
#])
env.Append(CFLAGS = '/W3')
if debug:
env.Append(CPPDEFINES = [
('DBG', '1'),
('DEBUG', '1'),
('_DEBUG', '1'),
])
env.Append(CFLAGS = '/Od /Zi')
env.Append(CXXFLAGS = '/Od /Zi')
# Optimization flags
if gcc:
@ -224,7 +234,7 @@ if llvm:
# libGL
if 1:
if platform not in ('winddk',):
env.Append(LIBS = [
'X11',
'Xext',

View File

@ -212,6 +212,48 @@ def generate(env):
SCons.Tool.mslink.generate(env)
# See also:
# - WINDDK's bin/makefile.new for more info.
# - http://alter.org.ua/docs/nt_kernel/vc8_proj/
env.Append(CPPDEFINES = [
'WIN32',
'_WINDOWS',
('i386', '1'),
('_X86_', '1'),
'STD_CALL',
('CONDITION_HANDLING', '1'),
('NT_INST', '0'),
('_NT1X_', '100'),
('WINNT', '1'),
('_WIN32_WINNT', '0x0500'), # minimum required OS version
('WIN32_LEAN_AND_MEAN', '1'),
('DEVL', '1'),
('FPO', '1'),
])
cflags = [
'/GF', # Enable String Pooling
#'/EHsc', # Enable C++ Exceptions
'/Zp8', # 8bytes struct member alignment
#'/GS-', # No Buffer Security Check
#'/GR-', # Disable Run-Time Type Info
'/Gz', # __stdcall Calling convention
]
env.Append(CFLAGS = cflags)
env.Append(CXXFLAGS = cflags)
env.Append(LINKFLAGS = [
'/DEBUG',
'/NODEFAULTLIB',
'/SUBSYSTEM:NATIVE',
'/INCREMENTAL:NO',
#'/DRIVER',
#'-subsystem:native,4.00',
'-base:0x10000',
'-entry:DrvEnableDriver',
])
if not env.has_key('ENV'):
env['ENV'] = {}
if not env['ENV'].has_key('SystemRoot'): # required for dlls in the winsxs folders