env.AddMethod(install_shared_library, 'InstallSharedLibrary')
+def num_jobs():
+ try:
+ return int(os.environ['NUMBER_OF_PROCESSORS'])
+ except (ValueError, KeyError):
+ pass
+
+ try:
+ return os.sysconf('SC_NPROCESSORS_ONLN')
+ except (ValueError, OSError, AttributeError):
+ pass
+
+ try:
+ return int(os.popen2("sysctl -n hw.ncpu")[1].read())
+ except ValueError:
+ pass
+
+ return 1
+
+
def generate(env):
"""Common environment generation code"""
# configuration. See also http://www.scons.org/wiki/AdvancedBuildExample
build_topdir = 'build'
build_subdir = env['platform']
- if env['dri']:
- build_subdir += "-dri"
if env['llvm']:
build_subdir += "-llvm"
if env['machine'] != 'generic':
# different scons versions building the same source file
env['build'] = build_dir
env.SConsignFile(os.path.join(build_dir, '.sconsign'))
+ env.CacheDir('build/cache')
+
+ # Parallel build
+ if env.GetOption('num_jobs') <= 1:
+ env.SetOption('num_jobs', num_jobs())
# C preprocessor options
cppdefines = []
cppdefines += [
'WIN32',
'_WINDOWS',
- '_UNICODE',
- 'UNICODE',
+ #'_UNICODE',
+ #'UNICODE',
('_WIN32_WINNT', '0x0501'), # minimum required OS version
('WINVER', '0x0501'),
# http://msdn2.microsoft.com/en-us/library/6dwk3a1z.aspx,
'-Wmissing-prototypes',
'-Wno-long-long',
'-ffast-math',
- '-std=c99',
- '-pedantic',
+ '-std=gnu99',
'-fmessage-length=0', # be nice to Eclipse
]
if msvc: