• Home
  • Raw
  • Download

Lines Matching +full:- +full:- +full:env

3 Frontend-tool for Gallium3D architecture.
25 # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
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)
77 version = version[:-1]
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 = [
88 '-Werror=vla',
89 '-Werror=pointer-arith',
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)
120 return int(os.popen2("sysctl -n hw.ncpu")[1].read())
127 def check_cc(env, cc, expr, cpp_opt = '-E'): argument
128 # Invoke C-preprocessor to determine whether the specified expression is
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'])
207 # Detect gcc/clang not by executable name, but through pre-defined macros
209 # that overrice CC/CXX like scan-build.
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']:
292 build_subdir = 'embedded-' + build_subdir
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']):
370 # http://msdn.microsoft.com/en-us/library/aa383745.aspx
387 if env['build'] in ('debug', 'checked'):
391 if env['embedded']:
393 if env['texture_float']:
394 print('warning: Floating-point textures enabled.')
397 env.Append(CPPDEFINES = cppdefines)
404 if env['build'] == 'debug':
405 ccflags += ['-O0']
407 ccflags += ['-O3']
408 if env['gcc']:
411 ccflags += ['-fno-builtin-memcmp']
412 # Work around aliasing bugs - developers should comment this out
413 ccflags += ['-fno-strict-aliasing']
414 ccflags += ['-g']
415 if env['build'] in ('checked', 'profile') or env['asan']:
418 '-fno-omit-frame-pointer',
420 if env['gcc']:
421 ccflags += ['-fno-optimize-sibling-calls']
422 if env['machine'] == 'x86':
424 '-m32',
425 #'-march=pentium4',
431 # -mstackrealign ore -mincoming-stack-boundary=2.
433 # XXX: We could have SSE without -mstackrealign if we always used
437 '-mstackrealign', # ensure stack is aligned
438 '-msse', '-msse2', # enable SIMD intrinsics
439 '-mfpmath=sse', # generate SSE floating-point arithmetic
443 ccflags += ['-fno-common']
447 '-mstackrealign', # ensure stack is aligned
448 '-march=i586', # Haiku target is Pentium
449 '-mtune=i686' # use i686 where we can
451 if env['machine'] == 'x86_64':
452 ccflags += ['-m64']
454 ccflags += ['-fno-common']
455 if env['platform'] not in ('cygwin', 'haiku', 'windows'):
456 ccflags += ['-fvisibility=hidden']
458 # - http://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html
460 '-Wall',
461 '-Wno-long-long',
462 '-fmessage-length=0', # be nice to Eclipse
465 '-Wmissing-prototypes',
466 '-std=gnu99',
470 '-std=gnu99',
474 # - http://msdn.microsoft.com/en-us/library/19z1t1wy.aspx
475 # - cl /?
476 if env['build'] == 'debug':
485 if env['build'] in ('release', 'opt'):
486 if not env['clang']:
492 '/Oy-', # disable frame pointer omission
497 '/wd4056', # overflow in floating-point constant arithmetic
506 if env['clang']:
508 … '-Wno-microsoft-enum-value', # enumerator value is not representable in underlying type 'int'
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:
528 # http://msdn.microsoft.com/en-us/library/2kzt1wy3.aspx
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']:
539 # http://msdn.microsoft.com/en-us/library/ms173498.aspx
540 env.Append(CCFLAGS = [
545 if env['clang']:
546 # scan-build will produce more comprehensive output
547 env.Append(CCFLAGS = ['--analyze'])
550 if env['asan']:
552 env.Append(CCFLAGS = [
553 '-fsanitize=address',
555 env.Append(LINKFLAGS = [
556 '-fsanitize=address',
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':
571 linkflags += ['-m32']
572 if env['machine'] == 'x86_64':
573 linkflags += ['-m64']
574 if env['platform'] not in ('darwin'):
576 '-Wl,-Bsymbolic',
579 if env['platform'] in ('darwin'):
582 env['_LIBFLAGS'] = '-Wl,--start-group ' + env['_LIBFLAGS'] + ' -Wl,--end-group'
583 if env['platform'] == 'windows':
585 '-Wl,--nxcompat', # DEP
586 '-Wl,--dynamicbase', # ASLR
589 linkflags += ['-static-libgcc']
590 if 'w64' in env['CC'].split('-'):
591 linkflags += ['-static-libstdc++']
593 shlinkflags += ['-Wl,--enable-stdcall-fixup']
594 #shlinkflags += ['-Wl,--kill-at']
596 if env['build'] in ('release', 'opt') and not env['clang']:
597 # enable Link-time Code Generation
599 env.Append(ARFLAGS = ['/LTCG'])
602 # - http://msdn2.microsoft.com/en-us/library/y0zzbyt4.aspx
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 = [
646 '-DYY_USE_CONST=',
654 env.Append(CCFLAGS = ['-FIinttypes.h'])
658 if check_prog(env, 'win_flex'):
659 env["LEX"] = 'win_flex'
660 env.Append(LEXFLAGS = [
663 '--wincompat'
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