diff options
author | José Fonseca <jrfonseca@tungstengraphics.com> | 2008-02-19 18:53:16 +0900 |
---|---|---|
committer | José Fonseca <jrfonseca@tungstengraphics.com> | 2008-02-19 18:53:16 +0900 |
commit | d710a7cfb2c129fcb937e40fa9b367d662138bc5 (patch) | |
tree | 103429a41783d17db9d9e584f176683fe440b9ef | |
parent | b9da3791c934e05b82063a8c79c423a0a8e29a94 (diff) |
Windows (DDK) compilation support.
It also works when cross compiling with Wine.
-rw-r--r-- | SConstruct | 49 |
1 files changed, 36 insertions, 13 deletions
diff --git a/SConstruct b/SConstruct index 6cb07302e8..0420195395 100644 --- a/SConstruct +++ b/SConstruct @@ -28,6 +28,13 @@ import sys # to get the full list of options. See scons manpage for more info. # +platform_map = { + 'linux2': 'linux', + 'win32': 'winddk', +} + +platform = platform_map.get(sys.platform, sys.platform) + # TODO: auto-detect defaults opts = Options('config.py') opts.Add(BoolOption('debug', 'build debug version', False)) @@ -35,6 +42,8 @@ opts.Add(BoolOption('dri', 'build dri drivers', False)) opts.Add(BoolOption('llvm', 'use llvm', False)) opts.Add(EnumOption('machine', 'use machine-specific assembly code', 'x86', allowed_values=('generic', 'x86', 'x86-64'))) +opts.Add(EnumOption('platform', 'target platform', platform, + allowed_values=('linux', 'cell', 'winddk'))) env = Environment( options = opts, @@ -44,25 +53,17 @@ Help(opts.GenerateHelpText(env)) # for debugging #print env.Dump() -if 0: - # platform will be typically 'posix' or 'win32' - platform = env['PLATFORM'] -else: - # platform will be one of 'linux', 'freebsd', 'win32', 'darwin', etc. - platform = sys.platform - if platform == 'linux2': - platform = 'linux' - # replicate options values in local variables debug = env['debug'] dri = env['dri'] llvm = env['llvm'] machine = env['machine'] +platform = env['platform'] # derived options x86 = machine == 'x86' -gcc = platform in ('posix', 'linux', 'freebsd', 'darwin') -msvc = platform == 'win32' +gcc = platform in ('linux', 'freebsd', 'darwin') +msvc = platform in ('win32', 'winddk') Export([ 'debug', @@ -78,10 +79,32 @@ Export([ ####################################################################### # Environment setup # -# TODO: put the compiler specific settings in seperate files +# TODO: put the compiler specific settings in separate files # TODO: auto-detect as much as possible - + +if platform == 'winddk': + import ntpath + escape = env['ESCAPE'] + env.Tool('msvc') + if 'BASEDIR' in os.environ: + WINDDK = os.environ['BASEDIR'] + else: + 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']) + + # Optimization flags if gcc: if debug: |