Lines Matching refs:env

45 def symlink(target, source, env):
52 def install(env, source, subdir):
53 target_dir = os.path.join(env.Dir('#.').srcnode().abspath, env['build_dir'], subdir)
54 return env.Install(target_dir, source)
56 def install_program(env, source):
57 return install(env, source, 'bin')
59 def install_shared_library(env, sources, version = ()):
61 install_dir = os.path.join(env.Dir('#.').srcnode().abspath, env['build_dir'])
63 if env['SHLIBSUFFIX'] == '.dll':
64 dlls = env.FindIxes(sources, 'SHLIBPREFIX', 'SHLIBSUFFIX')
65 targets += install(env, dlls, 'bin')
66 libs = env.FindIxes(sources, 'LIBPREFIX', 'LIBSUFFIX')
67 targets += install(env, libs, 'lib')
72 last = env.InstallAs(os.path.join(target_dir, target_name), source)
78 last = env.Command(os.path.join(target_dir, target_name), last, action)
83 def createInstallMethods(env):
84 env.AddMethod(install_program, 'InstallProgram')
85 env.AddMethod(install_shared_library, 'InstallSharedLibrary')
107 def generate(env):
111 env['TARGET_ARCH'] = env['machine']
112 env['MSVS_ARCH'] = env['machine']
115 platform = env['platform']
116 env.Tool(env['toolchain'])
120 env['CC'] = os.environ['CC']
122 pipe = SCons.Action._subproc(env, [env['CC'], '--version'],
130 env['CCVERSION'] = match.group(0)
132 env['CCFLAGS'] += SCons.Util.CLVar(os.environ['CFLAGS'])
134 env['CXX'] = os.environ['CXX']
136 env['CXXFLAGS'] += SCons.Util.CLVar(os.environ['CXXFLAGS'])
138 env['LINKFLAGS'] += SCons.Util.CLVar(os.environ['LDFLAGS'])
140 env['gcc'] = 'gcc' in os.path.basename(env['CC']).split('-')
141 env['msvc'] = env['CC'] == 'cl'
142 env['suncc'] = env['platform'] == 'sunos' and os.path.basename(env['CC']) == 'cc'
143 env['clang'] = env['CC'] == 'clang'
144 env['icc'] = 'icc' == os.path.basename(env['CC'])
146 if env['msvc'] and env['toolchain'] == 'default' and env['machine'] == 'x86_64':
148 env.EnsurePythonVersion(2, 0)
151 machine = env['machine']
152 platform = env['platform']
153 x86 = env['machine'] == 'x86'
154 ppc = env['machine'] == 'ppc'
155 gcc = env['gcc']
156 msvc = env['msvc']
157 suncc = env['suncc']
158 icc = env['icc']
176 env['crosscompile'] = platform != host_platform
178 env['crosscompile'] = True
179 env['hostonly'] = False
182 if env['build'] == 'debug':
183 if not env['debug']:
188 env['build'] = 'release'
189 if env['profile']:
194 env['build'] = 'profile'
197 env.popitem('debug')
198 env.popitem('profile')
201 if env['build'] in ('debug', 'checked'):
202 env['debug'] = True
203 env['profile'] = False
204 if env['build'] == 'profile':
205 env['debug'] = False
206 env['profile'] = True
207 if env['build'] == 'release':
208 env['debug'] = False
209 env['profile'] = False
214 build_subdir = env['platform']
215 if env['embedded']:
217 if env['machine'] != 'generic':
218 build_subdir += '-' + env['machine']
219 if env['build'] != 'release':
220 build_subdir += '-' + env['build']
224 env['build_dir'] = build_dir
225 env.SConsignFile(os.path.join(build_dir, '.sconsign'))
228 env.CacheDir(os.environ['SCONS_CACHE_DIR'])
229 env['CONFIGUREDIR'] = os.path.join(build_dir, 'conf')
230 env['CONFIGURELOG'] = os.path.join(os.path.abspath(build_dir), 'config.log')
233 if env.GetOption('num_jobs') <= 1:
234 env.SetOption('num_jobs', num_jobs())
236 env.Decider('MD5-timestamp')
237 env.SetOption('max_drift', 60)
241 if env['build'] in ('debug', 'checked'):
245 if env['build'] == 'profile':
247 if env['platform'] in ('posix', 'linux', 'freebsd', 'darwin'):
257 if env['platform'] == 'darwin':
268 if env['platform'] in ('linux', 'freebsd'):
293 if env['build'] in ('debug', 'checked'):
299 if env['embedded']:
301 if env['texture_float']:
305 env.Append(CPPDEFINES = cppdefines)
312 ccversion = env['CCVERSION']
313 if env['build'] == 'debug':
327 if env['build'] in ('checked', 'profile'):
333 if env['machine'] == 'x86':
339 and (platform != 'windows' or env['build'] == 'debug' or True) \
367 if env['machine'] == 'x86_64':
371 if env['platform'] not in ('windows', 'haiku'):
399 if env['build'] == 'debug':
409 if env['build'] == 'release':
422 if env['machine'] == 'x86':
432 env.EnsureSConsVersion(0, 98, 0)
433 env['PDB'] = '${TARGET.base}.pdb'
434 env.Append(CCFLAGS = ccflags)
435 env.Append(CFLAGS = cflags)
436 env.Append(CXXFLAGS = cxxflags)
438 if env['platform'] == 'windows' and msvc:
441 if env['build'] in ('debug', 'checked'):
442 env.Append(CCFLAGS = ['/MTd'])
443 env.Append(SHCCFLAGS = ['/LDd'])
445 env.Append(CCFLAGS = ['/MT'])
446 env.Append(SHCCFLAGS = ['/LD'])
450 if env['machine'] == 'x86':
451 env.Append(ASFLAGS = ['-m32'])
452 if env['machine'] == 'x86_64':
453 env.Append(ASFLAGS = ['-m64'])
459 if env['machine'] == 'x86':
461 if env['machine'] == 'x86_64':
463 if env['platform'] not in ('darwin'):
468 if env['platform'] in ('darwin'):
471 env['_LIBFLAGS'] = '-Wl,--start-group ' + env['_LIBFLAGS'] + ' -Wl,--end-group'
472 if env['platform'] == 'windows':
475 if 'w64' in env['CC'].split('-'):
481 if env['build'] == 'release':
484 env.Append(ARFLAGS = ['/LTCG'])
492 env.Append(LINKFLAGS = linkflags)
493 env.Append(SHLINKFLAGS = shlinkflags)
496 if env['gcc'] or env['clang']:
497 env['LINK'] = env['CXX']
501 if env['platform'] in ('darwin', 'freebsd', 'linux', 'posix', 'sunos'):
503 env.Append(LIBS = libs)
506 if env['openmp']:
507 if env['msvc']:
508 env.Append(CCFLAGS = ['/openmp'])
511 if env['build'] == 'release':
512 env['PDB'] = ''
513 if env['gcc']:
514 env.Append(CCFLAGS = ['-fopenmp'])
515 env.Append(LIBS = ['gomp'])
518 env.Tool('lex')
519 env.Tool('yacc')
520 if env['llvm']:
521 env.Tool('llvm')
524 env.Tool('custom')
525 createInstallMethods(env)
527 env.PkgCheckModules('X11', ['x11', 'xext', 'xdamage', 'xfixes'])
528 env.PkgCheckModules('XCB', ['x11-xcb', 'xcb-glx >= 1.8.1'])
529 env.PkgCheckModules('XF86VIDMODE', ['xxf86vm'])
530 env.PkgCheckModules('DRM', ['libdrm >= 2.4.24'])
531 env.PkgCheckModules('DRM_INTEL', ['libdrm_intel >= 2.4.30'])
532 env.PkgCheckModules('DRM_RADEON', ['libdrm_radeon >= 2.4.31'])
533 env.PkgCheckModules('XORG', ['xorg-server >= 1.6.0'])
534 env.PkgCheckModules('KMS', ['libkms >= 2.4.24'])
535 env.PkgCheckModules('UDEV', ['libudev > 150'])
537 env['dri'] = env['x11'] and env['drm']
540 #print env.Dump()
543 def exists(env):