mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-28 03:50:13 +01:00
Windows (DDK) compilation support.
It also works when cross compiling with Wine.
This commit is contained in:
parent
b9da3791c9
commit
d710a7cfb2
1 changed files with 36 additions and 13 deletions
49
SConstruct
49
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:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue