• Home
  • Raw
  • Download

Lines Matching full:env

47 def symlink(target, source, env):  argument
54 def install(env, source, subdir): argument
55 target_dir = os.path.join(env.Dir('#.').srcnode().abspath, env['build_dir'], subdir)
56 return env.Install(target_dir, source)
58 def install_program(env, source): argument
59 return install(env, source, 'bin')
61 def install_shared_library(env, sources, version = ()): argument
63 install_dir = os.path.join(env.Dir('#.').srcnode().abspath, env['build_dir'])
65 if env['SHLIBSUFFIX'] == '.dll':
66 dlls = env.FindIxes(sources, 'SHLIBPREFIX', 'SHLIBSUFFIX')
67 targets += install(env, dlls, 'bin')
68 libs = env.FindIxes(sources, 'LIBPREFIX', 'LIBSUFFIX')
69 targets += install(env, libs, 'lib')
74 last = env.InstallAs(os.path.join(target_dir, target_name), source)
80 last = env.Command(os.path.join(target_dir, target_name), last, action)
85 def msvc2013_compat(env): argument
86 if env['gcc']:
87 env.Append(CCFLAGS = [
93 def unit_test(env, test_name, program_target, args=None): argument
94 env.InstallProgram(program_target)
103 alias = env.Alias(test_name, program_target, action)
104 env.AlwaysBuild(alias)
105 env.Depends('check', alias)
127 def check_cc(env, cc, expr, cpp_opt = '-E'): argument
137 pipe = SCons.Action._subproc(env, [env['CC'], cpp_opt, source.name],
149 def check_prog(env, prog): argument
154 result = env.Detect(prog)
160 def generate(env): argument
164 env['TARGET_ARCH'] = env['machine']
165 env['MSVS_ARCH'] = env['machine']
168 platform = env['platform']
169 env.Tool(env['toolchain'])
173 env['CC'] = os.environ['CC']
175 env['CCFLAGS'] += SCons.Util.CLVar(os.environ['CFLAGS'])
177 env['CXX'] = os.environ['CXX']
179 env['CXXFLAGS'] += SCons.Util.CLVar(os.environ['CXXFLAGS'])
181 env['LINKFLAGS'] += SCons.Util.CLVar(os.environ['LDFLAGS'])
186 env['gcc_compat'] = 0
187 env['clang'] = 0
188 env['msvc'] = 0
190 env['msvc'] = check_cc(env, 'MSVC', 'defined(_MSC_VER)', '/E')
191 if not env['msvc']:
192 env['gcc_compat'] = check_cc(env, 'GCC', 'defined(__GNUC__)')
193 env['clang'] = check_cc(env, 'Clang', '__clang__')
194 env['gcc'] = env['gcc_compat'] and not env['clang']
195 env['suncc'] = env['platform'] == 'sunos' and os.path.basename(env['CC']) == 'cc'
196 env['icc'] = 'icc' == os.path.basename(env['CC'])
198 if env['msvc'] and env['toolchain'] == 'default' and env['machine'] == 'x86_64':
200 env.EnsurePythonVersion(2, 0)
203 machine = env['machine']
204 platform = env['platform']
205 x86 = env['machine'] == 'x86'
206 ppc = env['machine'] == 'ppc'
207 gcc_compat = env['gcc_compat']
208 msvc = env['msvc']
209 suncc = env['suncc']
210 icc = env['icc']
228 env['crosscompile'] = platform != hosthost_platform
230 env['crosscompile'] = True
231 env['hostonly'] = False
234 if env['build'] == 'debug':
235 if not env['debug']:
240 env['build'] = 'release'
241 if env['profile']:
246 env['build'] = 'profile'
249 env.popitem('debug')
250 env.popitem('profile')
253 if env['build'] in ('debug', 'checked'):
254 env['debug'] = True
255 env['profile'] = False
256 if env['build'] == 'profile':
257 env['debug'] = False
258 env['profile'] = True
259 if env['build'] in ('release', 'opt'):
260 env['debug'] = False
261 env['profile'] = False
266 build_subdir = env['platform']
267 if env['embedded']:
269 if env['machine'] != 'generic':
270 build_subdir += '-' + env['machine']
271 if env['build'] != 'release':
272 build_subdir += '-' + env['build']
276 env['build_dir'] = build_dir
277 env.SConsignFile(os.path.join(build_dir, '.sconsign'))
280 env.CacheDir(os.environ['SCONS_CACHE_DIR'])
281 env['CONFIGUREDIR'] = os.path.join(build_dir, 'conf')
282 env['CONFIGURELOG'] = os.path.join(os.path.abspath(build_dir), 'config.log')
285 if env.GetOption('num_jobs') <= 1:
286 env.SetOption('num_jobs', num_jobs())
288 env.Decider('MD5-timestamp')
289 env.SetOption('max_drift', 60)
298 if env['build'] in ('debug', 'checked'):
302 if env['build'] == 'profile':
304 if env['build'] in ('opt', 'profile'):
306 if env['platform'] in ('posix', 'linux', 'freebsd', 'darwin'):
315 if env['platform'] == 'darwin':
327 if env['platform'] in ('linux', 'darwin'):
353 if env['build'] in ('debug', 'checked'):
357 if env['embedded']:
359 if env['texture_float']:
363 env.Append(CPPDEFINES = cppdefines)
370 if env['build'] == 'debug':
374 if env['gcc']:
381 if env['build'] in ('checked', 'profile') or env['asan']:
386 if env['gcc']:
388 if env['machine'] == 'x86':
417 if env['machine'] == 'x86_64':
421 if env['platform'] not in ('cygwin', 'haiku', 'windows'):
442 if env['build'] == 'debug':
451 if env['build'] in ('release', 'opt'):
452 if not env['clang']:
472 if env['clang']:
476 if env['machine'] == 'x86':
486 env.EnsureSConsVersion(0, 98, 0)
487 env['PDB'] = '${TARGET.base}.pdb'
488 env.Append(CCFLAGS = ccflags)
489 env.Append(CFLAGS = cflags)
490 env.Append(CXXFLAGS = cxxflags)
492 if env['platform'] == 'windows' and msvc:
495 if env['build'] in ('debug', 'checked'):
496 env.Append(CCFLAGS = ['/MTd'])
497 env.Append(SHCCFLAGS = ['/LDd'])
499 env.Append(CCFLAGS = ['/MT'])
500 env.Append(SHCCFLAGS = ['/LD'])
503 if env['analyze']:
504 if env['msvc']:
506 env.Append(CCFLAGS = [
511 if env['clang']:
513 env.Append(CCFLAGS = ['--analyze'])
516 if env['asan']:
518 env.Append(CCFLAGS = [
521 env.Append(LINKFLAGS = [
527 if env['machine'] == 'x86':
528 env.Append(ASFLAGS = ['-m32'])
529 if env['machine'] == 'x86_64':
530 env.Append(ASFLAGS = ['-m64'])
536 if env['machine'] == 'x86':
538 if env['machine'] == 'x86_64':
540 if env['platform'] not in ('darwin'):
545 if env['platform'] in ('darwin'):
548 env['_LIBFLAGS'] = '-Wl,--start-group ' + env['_LIBFLAGS'] + ' -Wl,--end-group'
549 if env['platform'] == 'windows':
556 if 'w64' in env['CC'].split('-'):
562 if env['build'] in ('release', 'opt') and not env['clang']:
565 env.Append(ARFLAGS = ['/LTCG'])
575 env.Append(LINKFLAGS = linkflags)
576 env.Append(SHLINKFLAGS = shlinkflags)
580 env['LINK'] = env['CXX']
584 if env['platform'] in ('darwin', 'freebsd', 'linux', 'posix', 'sunos'):
586 if env['platform'] in ('linux',):
588 if env['platform'] in ('haiku'):
590 env.Append(LIBS = libs)
593 if env['openmp']:
594 if env['msvc']:
595 env.Append(CCFLAGS = ['/openmp'])
598 if env['build'] == 'release':
599 env['PDB'] = ''
600 if env['gcc']:
601 env.Append(CCFLAGS = ['-fopenmp'])
602 env.Append(LIBS = ['gomp'])
605 env.Tool('lex')
606 if env['msvc']:
607 env.Append(LEXFLAGS = [
620 env.Append(CCFLAGS = ['-FIinttypes.h'])
624 if check_prog(env, 'win_flex'):
625 env["LEX"] = 'win_flex'
626 env.Append(LEXFLAGS = [
632 env.Tool('yacc')
634 if check_prog(env, 'win_bison'):
635 env["YACC"] = 'win_bison'
637 if env['llvm']:
638 env.Tool('llvm')
641 env.Tool('custom')
642 env.AddMethod(install_program, 'InstallProgram')
643 env.AddMethod(install_shared_library, 'InstallSharedLibrary')
644 env.AddMethod(msvc2013_compat, 'MSVC2013Compat')
645 env.AddMethod(unit_test, 'UnitTest')
647 env.PkgCheckModules('X11', ['x11', 'xext', 'xdamage', 'xfixes', 'glproto >= 1.4.13'])
648 env.PkgCheckModules('XCB', ['x11-xcb', 'xcb-glx >= 1.8.1', 'xcb-dri2 >= 1.8'])
649 env.PkgCheckModules('XF86VIDMODE', ['xxf86vm'])
650 env.PkgCheckModules('DRM', ['libdrm >= 2.4.66'])
652 if env['x11']:
653 env.Append(CPPPATH = env['X11_CPPPATH'])
655 env['dri'] = env['x11'] and env['drm']
658 #print env.Dump()
661 def exists(env): argument