• Home
  • Raw
  • Download

Lines Matching refs:env

48 def symlink(target, source, env):  argument
55 def install(env, source, subdir): argument
56 target_dir = os.path.join(env.Dir('#.').srcnode().abspath, env['build_dir'], subdir)
57 return env.Install(target_dir, source)
59 def install_program(env, source): argument
60 return install(env, source, 'bin')
62 def install_shared_library(env, sources, version = ()): argument
64 install_dir = os.path.join(env.Dir('#.').srcnode().abspath, env['build_dir'])
66 if env['SHLIBSUFFIX'] == '.dll':
67 dlls = env.FindIxes(sources, 'SHLIBPREFIX', 'SHLIBSUFFIX')
68 targets += install(env, dlls, 'bin')
69 libs = env.FindIxes(sources, 'LIBPREFIX', 'LIBSUFFIX')
70 targets += install(env, libs, 'lib')
75 last = env.InstallAs(os.path.join(target_dir, target_name), source)
81 last = env.Command(os.path.join(target_dir, target_name), last, action)
86 def msvc2013_compat(env): argument
87 if env['gcc']:
88 env.Append(CCFLAGS = [
94 def unit_test(env, test_name, program_target, args=None): argument
95 env.InstallProgram(program_target)
104 alias = env.Alias(test_name, program_target, action)
105 env.AlwaysBuild(alias)
106 env.Depends('check', alias)
128 def check_cc(env, cc, expr, cpp_opt = '-E'): argument
140 pipe = SCons.Action._subproc(env, env.Split(env['CC']) + [cpp_opt, source.name],
151 def check_header(env, header): argument
154 conf = SCons.Script.Configure(env)
160 env = conf.Finish()
163 def check_functions(env, functions): argument
166 conf = SCons.Script.Configure(env)
173 env = conf.Finish()
176 def check_prog(env, prog): argument
181 result = env.Detect(prog)
187 def generate(env): argument
191 env['TARGET_ARCH'] = env['machine']
192 env['MSVS_ARCH'] = env['machine']
195 platform = env['platform']
196 env.Tool(env['toolchain'])
200 env['CC'] = os.environ['CC']
202 env['CCFLAGS'] += SCons.Util.CLVar(os.environ['CFLAGS'])
204 env['CXX'] = os.environ['CXX']
206 env['CXXFLAGS'] += SCons.Util.CLVar(os.environ['CXXFLAGS'])
208 env['LINKFLAGS'] += SCons.Util.CLVar(os.environ['LDFLAGS'])
213 env['gcc_compat'] = 0
214 env['clang'] = 0
215 env['msvc'] = 0
217 env['msvc'] = check_cc(env, 'MSVC', 'defined(_MSC_VER)', '/E')
218 if not env['msvc']:
219 env['gcc_compat'] = check_cc(env, 'GCC', 'defined(__GNUC__)')
220 env['clang'] = check_cc(env, 'Clang', '__clang__')
221 env['gcc'] = env['gcc_compat'] and not env['clang']
222 env['suncc'] = env['platform'] == 'sunos' and os.path.basename(env['CC']) == 'cc'
223 env['icc'] = 'icc' == os.path.basename(env['CC'])
226 machine = env['machine']
227 platform = env['platform']
228 x86 = env['machine'] == 'x86'
229 ppc = env['machine'] == 'ppc'
230 gcc_compat = env['gcc_compat']
231 msvc = env['msvc']
232 suncc = env['suncc']
233 icc = env['icc']
254 env['crosscompile'] = platform != hosthost_platform
256 env['crosscompile'] = True
257 env['hostonly'] = False
260 if env['build'] == 'debug':
261 if not env['debug']:
266 env['build'] = 'release'
267 if env['profile']:
272 env['build'] = 'profile'
275 env.popitem('debug')
276 env.popitem('profile')
279 if env['build'] in ('debug', 'checked'):
280 env['debug'] = True
281 env['profile'] = False
282 if env['build'] == 'profile':
283 env['debug'] = False
284 env['profile'] = True
285 if env['build'] == 'release':
286 env['debug'] = False
287 env['profile'] = False
292 build_subdir = env['platform']
293 if env['embedded']:
295 if env['machine'] != 'generic':
296 build_subdir += '-' + env['machine']
297 if env['build'] != 'release':
298 build_subdir += '-' + env['build']
302 env['build_dir'] = build_dir
303 env.SConsignFile(os.path.join(build_dir, '.sconsign'))
306 env.CacheDir(os.environ['SCONS_CACHE_DIR'])
307 env['CONFIGUREDIR'] = os.path.join(build_dir, 'conf')
308 env['CONFIGURELOG'] = os.path.join(os.path.abspath(build_dir), 'config.log')
311 if env.GetOption('num_jobs') <= 1:
312 env.SetOption('num_jobs', num_jobs())
327 env.Decider('MD5-timestamp')
328 env.SetOption('max_drift', 60)
338 if env['build'] in ('debug', 'checked'):
342 if env['build'] == 'profile':
344 if env['platform'] in ('posix', 'linux', 'freebsd', 'darwin'):
353 if env['platform'] == 'darwin':
366 if check_header(env, 'xlocale.h'):
369 if check_header(env, 'endian.h'):
372 if check_functions(env, ['strtod_l', 'strtof_l']):
375 if check_functions(env, ['random_r']):
378 if check_functions(env, ['timespec_get']):
381 if check_header(env, 'sys/shm.h'):
384 if check_functions(env, ['strtok_r']):
390 if check_header(env, 'sys/mkdev.h'):
392 if check_header(env, 'sys/sysmacros.h'):
419 if env['build'] in ('debug', 'checked'):
421 if env['embedded']:
423 env.Append(CPPDEFINES = cppdefines)
430 if env['build'] == 'debug':
434 if env['gcc']:
441 if env['build'] in ('checked', 'profile') or env['asan']:
446 if env['gcc']:
448 if env['machine'] == 'x86':
477 if env['machine'] == 'x86_64':
481 if env['platform'] not in ('cygwin', 'haiku', 'windows'):
509 if env['build'] == 'debug':
518 if env['build'] == 'release':
519 if not env['clang']:
539 if env['clang']:
543 if env['machine'] == 'x86':
553 env.EnsureSConsVersion(0, 98, 0)
554 env['PDB'] = '${TARGET.base}.pdb'
555 env.Append(CCFLAGS = ccflags)
556 env.Append(CFLAGS = cflags)
557 env.Append(CXXFLAGS = cxxflags)
559 if env['platform'] == 'windows' and msvc:
562 if env['build'] in ('debug', 'checked'):
563 env.Append(CCFLAGS = ['/MTd'])
564 env.Append(SHCCFLAGS = ['/LDd'])
566 env.Append(CCFLAGS = ['/MT'])
567 env.Append(SHCCFLAGS = ['/LD'])
570 if env['analyze']:
571 if env['msvc']:
573 env.Append(CCFLAGS = [
578 if env['clang']:
580 env.Append(CCFLAGS = ['--analyze'])
583 if env['asan']:
585 env.Append(CCFLAGS = [
588 env.Append(LINKFLAGS = [
594 if env['machine'] == 'x86':
595 env.Append(ASFLAGS = ['-m32'])
596 if env['machine'] == 'x86_64':
597 env.Append(ASFLAGS = ['-m64'])
603 if env['machine'] == 'x86':
605 if env['machine'] == 'x86_64':
607 if env['platform'] not in ('darwin'):
612 if env['platform'] in ('darwin'):
615 env['_LIBFLAGS'] = '-Wl,--start-group ' + env['_LIBFLAGS'] + ' -Wl,--end-group'
616 if env['platform'] == 'windows':
623 if 'w64' in env['CC'].split('-'):
629 if env['build'] == 'release' and not env['clang']:
632 env.Append(ARFLAGS = ['/LTCG'])
642 env.Append(LINKFLAGS = linkflags)
643 env.Append(SHLINKFLAGS = shlinkflags)
647 env['LINK'] = env['CXX']
651 if env['platform'] in ('darwin', 'freebsd', 'linux', 'posix', 'sunos'):
653 if env['platform'] in ('linux',):
655 if env['platform'] in ('haiku'):
657 env.Append(LIBS = libs)
660 if env['openmp']:
661 if env['msvc']:
662 env.Append(CCFLAGS = ['/openmp'])
665 if env['build'] == 'release':
666 env['PDB'] = ''
667 if env['gcc']:
668 env.Append(CCFLAGS = ['-fopenmp'])
669 env.Append(LIBS = ['gomp'])
672 env.Tool('lex')
673 if env['msvc']:
674 env.Append(LEXFLAGS = [
687 env.Append(CCFLAGS = ['-FIinttypes.h'])
691 if check_prog(env, 'win_flex'):
692 env["LEX"] = 'win_flex'
693 env.Append(LEXFLAGS = [
699 env.Tool('yacc')
701 if check_prog(env, 'win_bison'):
702 env["YACC"] = 'win_bison'
704 if env['llvm']:
705 env.Tool('llvm')
708 env.Tool('custom')
709 env.AddMethod(install_program, 'InstallProgram')
710 env.AddMethod(install_shared_library, 'InstallSharedLibrary')
711 env.AddMethod(msvc2013_compat, 'MSVC2013Compat')
712 env.AddMethod(unit_test, 'UnitTest')
714env.PkgCheckModules('X11', ['x11', 'xext', 'xdamage >= 1.1', 'xfixes', 'glproto >= 1.4.13', 'dri2p…
715 env.PkgCheckModules('XCB', ['x11-xcb', 'xcb-glx >= 1.8.1', 'xcb-dri2 >= 1.8'])
716 env.PkgCheckModules('XF86VIDMODE', ['xxf86vm'])
717 env.PkgCheckModules('DRM', ['libdrm >= 2.4.75'])
731 if env['x11']:
732 env.Append(CPPPATH = env['X11_CPPPATH'])
734 env['dri'] = env['x11'] and env['drm']
740 def exists(env): argument