• 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],
148 def check_header(env, header): argument
151 conf = SCons.Script.Configure(env)
157 env = conf.Finish()
160 def check_functions(env, functions): argument
163 conf = SCons.Script.Configure(env)
170 env = conf.Finish()
173 def check_prog(env, prog): argument
178 result = env.Detect(prog)
184 def generate(env): argument
188 env['TARGET_ARCH'] = env['machine']
189 env['MSVS_ARCH'] = env['machine']
192 platform = env['platform']
193 env.Tool(env['toolchain'])
197 env['CC'] = os.environ['CC']
199 env['CCFLAGS'] += SCons.Util.CLVar(os.environ['CFLAGS'])
201 env['CXX'] = os.environ['CXX']
203 env['CXXFLAGS'] += SCons.Util.CLVar(os.environ['CXXFLAGS'])
205 env['LINKFLAGS'] += SCons.Util.CLVar(os.environ['LDFLAGS'])
210 env['gcc_compat'] = 0
211 env['clang'] = 0
212 env['msvc'] = 0
214 env['msvc'] = check_cc(env, 'MSVC', 'defined(_MSC_VER)', '/E')
215 if not env['msvc']:
216 env['gcc_compat'] = check_cc(env, 'GCC', 'defined(__GNUC__)')
217 env['clang'] = check_cc(env, 'Clang', '__clang__')
218 env['gcc'] = env['gcc_compat'] and not env['clang']
219 env['suncc'] = env['platform'] == 'sunos' and os.path.basename(env['CC']) == 'cc'
220 env['icc'] = 'icc' == os.path.basename(env['CC'])
222 if env['msvc'] and env['toolchain'] == 'default' and env['machine'] == 'x86_64':
224 env.EnsurePythonVersion(2, 0)
227 machine = env['machine']
228 platform = env['platform']
229 x86 = env['machine'] == 'x86'
230 ppc = env['machine'] == 'ppc'
231 gcc_compat = env['gcc_compat']
232 msvc = env['msvc']
233 suncc = env['suncc']
234 icc = env['icc']
252 env['crosscompile'] = platform != hosthost_platform
254 env['crosscompile'] = True
255 env['hostonly'] = False
258 if env['build'] == 'debug':
259 if not env['debug']:
264 env['build'] = 'release'
265 if env['profile']:
270 env['build'] = 'profile'
273 env.popitem('debug')
274 env.popitem('profile')
277 if env['build'] in ('debug', 'checked'):
278 env['debug'] = True
279 env['profile'] = False
280 if env['build'] == 'profile':
281 env['debug'] = False
282 env['profile'] = True
283 if env['build'] in ('release', 'opt'):
284 env['debug'] = False
285 env['profile'] = False
290 build_subdir = env['platform']
291 if env['embedded']:
293 if env['machine'] != 'generic':
294 build_subdir += '-' + env['machine']
295 if env['build'] != 'release':
296 build_subdir += '-' + env['build']
300 env['build_dir'] = build_dir
301 env.SConsignFile(os.path.join(build_dir, '.sconsign'))
304 env.CacheDir(os.environ['SCONS_CACHE_DIR'])
305 env['CONFIGUREDIR'] = os.path.join(build_dir, 'conf')
306 env['CONFIGURELOG'] = os.path.join(os.path.abspath(build_dir), 'config.log')
309 if env.GetOption('num_jobs') <= 1:
310 env.SetOption('num_jobs', num_jobs())
312 env.Decider('MD5-timestamp')
313 env.SetOption('max_drift', 60)
323 if env['build'] in ('debug', 'checked'):
327 if env['build'] == 'profile':
329 if env['build'] in ('opt', 'profile'):
331 if env['platform'] in ('posix', 'linux', 'freebsd', 'darwin'):
340 if env['platform'] == 'darwin':
352 if check_header(env, 'xlocale.h'):
355 if check_header(env, 'endian.h'):
358 if check_functions(env, ['strtod_l', 'strtof_l']):
361 if check_functions(env, ['timespec_get']):
387 if env['build'] in ('debug', 'checked'):
391 if env['embedded']:
393 if env['texture_float']:
397 env.Append(CPPDEFINES = cppdefines)
404 if env['build'] == 'debug':
408 if env['gcc']:
415 if env['build'] in ('checked', 'profile') or env['asan']:
420 if env['gcc']:
422 if env['machine'] == 'x86':
451 if env['machine'] == 'x86_64':
455 if env['platform'] not in ('cygwin', 'haiku', 'windows'):
476 if env['build'] == 'debug':
485 if env['build'] in ('release', 'opt'):
486 if not env['clang']:
506 if env['clang']:
510 if env['machine'] == 'x86':
520 env.EnsureSConsVersion(0, 98, 0)
521 env['PDB'] = '${TARGET.base}.pdb'
522 env.Append(CCFLAGS = ccflags)
523 env.Append(CFLAGS = cflags)
524 env.Append(CXXFLAGS = cxxflags)
526 if env['platform'] == 'windows' and msvc:
529 if env['build'] in ('debug', 'checked'):
530 env.Append(CCFLAGS = ['/MTd'])
531 env.Append(SHCCFLAGS = ['/LDd'])
533 env.Append(CCFLAGS = ['/MT'])
534 env.Append(SHCCFLAGS = ['/LD'])
537 if env['analyze']:
538 if env['msvc']:
540 env.Append(CCFLAGS = [
545 if env['clang']:
547 env.Append(CCFLAGS = ['--analyze'])
550 if env['asan']:
552 env.Append(CCFLAGS = [
555 env.Append(LINKFLAGS = [
561 if env['machine'] == 'x86':
562 env.Append(ASFLAGS = ['-m32'])
563 if env['machine'] == 'x86_64':
564 env.Append(ASFLAGS = ['-m64'])
570 if env['machine'] == 'x86':
572 if env['machine'] == 'x86_64':
574 if env['platform'] not in ('darwin'):
579 if env['platform'] in ('darwin'):
582 env['_LIBFLAGS'] = '-Wl,--start-group ' + env['_LIBFLAGS'] + ' -Wl,--end-group'
583 if env['platform'] == 'windows':
590 if 'w64' in env['CC'].split('-'):
596 if env['build'] in ('release', 'opt') and not env['clang']:
599 env.Append(ARFLAGS = ['/LTCG'])
609 env.Append(LINKFLAGS = linkflags)
610 env.Append(SHLINKFLAGS = shlinkflags)
614 env['LINK'] = env['CXX']
618 if env['platform'] in ('darwin', 'freebsd', 'linux', 'posix', 'sunos'):
620 if env['platform'] in ('linux',):
622 if env['platform'] in ('haiku'):
624 env.Append(LIBS = libs)
627 if env['openmp']:
628 if env['msvc']:
629 env.Append(CCFLAGS = ['/openmp'])
632 if env['build'] == 'release':
633 env['PDB'] = ''
634 if env['gcc']:
635 env.Append(CCFLAGS = ['-fopenmp'])
636 env.Append(LIBS = ['gomp'])
639 env.Tool('lex')
640 if env['msvc']:
641 env.Append(LEXFLAGS = [
654 env.Append(CCFLAGS = ['-FIinttypes.h'])
658 if check_prog(env, 'win_flex'):
659 env["LEX"] = 'win_flex'
660 env.Append(LEXFLAGS = [
666 env.Tool('yacc')
668 if check_prog(env, 'win_bison'):
669 env["YACC"] = 'win_bison'
671 if env['llvm']:
672 env.Tool('llvm')
675 env.Tool('custom')
676 env.AddMethod(install_program, 'InstallProgram')
677 env.AddMethod(install_shared_library, 'InstallSharedLibrary')
678 env.AddMethod(msvc2013_compat, 'MSVC2013Compat')
679 env.AddMethod(unit_test, 'UnitTest')
681env.PkgCheckModules('X11', ['x11', 'xext', 'xdamage >= 1.1', 'xfixes', 'glproto >= 1.4.13', 'dri2p…
682 env.PkgCheckModules('XCB', ['x11-xcb', 'xcb-glx >= 1.8.1', 'xcb-dri2 >= 1.8'])
683 env.PkgCheckModules('XF86VIDMODE', ['xxf86vm'])
684 env.PkgCheckModules('DRM', ['libdrm >= 2.4.75'])
686 if env['x11']:
687 env.Append(CPPPATH = env['X11_CPPPATH'])
689 env['dri'] = env['x11'] and env['drm']
692 #print env.Dump()
695 def exists(env): argument