if default_platform in ('linux', 'freebsd', 'darwin'):
default_dri = 'yes'
-elif default_platform in ('winddk', 'windows'):
+elif default_platform in ('winddk', 'windows', 'wince'):
default_dri = 'no'
else:
default_dri = 'no'
from SCons.Options.EnumOption import EnumOption
except ImportError:
from SCons.Variables.EnumVariable import EnumVariable as EnumOption
- opts.Add(BoolOption('debug', 'build debug version', 'no'))
+ opts.Add(BoolOption('debug', 'debug build', 'no'))
+ opts.Add(BoolOption('profile', 'profile build', 'no'))
#opts.Add(BoolOption('quiet', 'quiet command lines', 'no'))
opts.Add(EnumOption('machine', 'use machine-specific assembly code', default_machine,
allowed_values=('generic', 'x86', 'x86_64')))
opts.Add(EnumOption('platform', 'target platform', default_platform,
- allowed_values=('linux', 'cell', 'windows', 'winddk')))
+ allowed_values=('linux', 'cell', 'windows', 'winddk', 'wince')))
opts.Add(BoolOption('llvm', 'use LLVM', 'no'))
opts.Add(BoolOption('dri', 'build DRI drivers', default_dri))
build_subdir += '-' + env['machine']
if env['debug']:
build_subdir += "-debug"
+ if env['profile']:
+ build_subdir += "-profile"
build_dir = os.path.join(build_topdir, build_subdir)
# Place the .sconsign file on the builddir too, to avoid issues with different scons
# versions building the same source file
platform = env['platform']
x86 = env['machine'] == 'x86'
gcc = env['platform'] in ('linux', 'freebsd', 'darwin')
- msvc = env['platform'] in ('windows', 'winddk')
+ msvc = env['platform'] in ('windows', 'winddk', 'wince')
# C preprocessor options
cppdefines = []
cppdefines += ['DEBUG']
else:
cppdefines += ['NDEBUG']
+ if env['profile']:
+ cppdefines += ['PROFILE']
if platform == 'windows':
cppdefines += [
'WIN32',
]
if debug:
cppdefines += [('DBG', 1)]
+ if platform == 'wince':
+ cppdefines += [
+ ('_WIN32_WCE', '500'),
+ 'WCE_PLATFORM_STANDARDSDK_500',
+ '_i386_',
+ ('UNDER_CE', '500'),
+ 'UNICODE',
+ '_UNICODE',
+ '_X86_',
+ 'x86',
+ '_USRDLL',
+ 'TEST_EXPORTS' ,
+ ]
if platform == 'windows':
- cppdefines += ['PIPE_SUBSYSTEM_USER']
+ cppdefines += ['PIPE_SUBSYSTEM_WINDOWS_USER']
if platform == 'winddk':
- cppdefines += ['PIPE_SUBSYSTEM_KERNEL']
+ cppdefines += ['PIPE_SUBSYSTEM_WINDOWS_DISPLAY']
+ if platform == 'wince':
+ cppdefines += ['PIPE_SUBSYSTEM_WINDOWS_CE']
env.Append(CPPDEFINES = cppdefines)
# C compiler options
cflags += ['-O0', '-g3']
else:
cflags += ['-O3', '-g3']
+ if env['profile']:
+ cflags += ['-pg']
+ if env['machine'] == 'x86' and default_machine == 'x86_64':
+ cflags += ['-m32']
+ if env['machine'] == 'x86_64' and default_machine == 'x86':
+ cflags += ['-m64']
cflags += [
'-Wall',
'-Wmissing-prototypes',
'/Oi', # enable intrinsic functions
'/Os', # favor code space
]
+ if env['profile']:
+ cflags += [
+ '/Gh', # enable _penter hook function
+ '/GH', # enable _pexit hook function
+ ]
+ cflags += [
+ '/W3', # warning level
+ #'/Wp64', # enable 64 bit porting warnings
+ ]
if platform == 'windows':
cflags += [
# TODO
- #'/Wp64', # enable 64 bit porting warnings
]
if platform == 'winddk':
cflags += [
'/Zp8', # 8bytes struct member alignment
'/Gy', # separate functions for linker
'/Gm-', # disable minimal rebuild
- '/W3', # warning level
'/WX', # treat warnings as errors
'/Gz', # __stdcall Calling convention
'/GX-', # disable C++ EH
'/hotpatch', # prepares an image for hotpatching.
#'/Z7', #enable old-style debug info
]
+ if platform == 'wince':
+ cflags += [
+ '/Gs8192',
+ '/GF', # enable read-only string pooling
+ ]
# Put debugging information in a separate .pdb file for each object file as
- # descrived in the scons manpage
+ # described in the scons manpage
env['CCPDBFLAGS'] = '/Zi /Fd${TARGET}.pdb'
env.Append(CFLAGS = cflags)
env.Append(CXXFLAGS = cflags)
# Linker options
+ linkflags = []
+ if gcc:
+ if env['machine'] == 'x86' and default_machine == 'x86_64':
+ linkflags += ['-m32']
+ if env['machine'] == 'x86_64' and default_machine == 'x86':
+ linkflags += ['-m64']
if platform == 'winddk':
# See also:
# - http://msdn2.microsoft.com/en-us/library/y0zzbyt4.aspx
- env.Append(LINKFLAGS = [
+ linkflags += [
'/merge:_PAGE=PAGE',
'/merge:_TEXT=.text',
'/section:INIT,d',
'/base:0x10000',
'/entry:DrvEnableDriver',
- ])
+ ]
+ env.Append(LINKFLAGS = linkflags)
createConvenienceLibBuilder(env)