SConstruct (5398:9727ba4600de) | SConstruct (5522:e56c3d89be79) |
---|---|
1# -*- mode:python -*- 2 3# Copyright (c) 2004-2005 The Regents of The University of Michigan 4# All rights reserved. 5# 6# Redistribution and use in source and binary forms, with or without 7# modification, are permitted provided that the following conditions are 8# met: redistributions of source code must retain the above copyright --- 410 unchanged lines hidden (view full) --- 419# add the new swig scanner that we like better 420from SCons.Scanner import ClassicCPP as CPPScanner 421swig_inc_re = '^[ \t]*[%,#][ \t]*(?:include|import)[ \t]*(<|")([^>"]+)(>|")' 422scanners.append(CPPScanner("SwigScan", [ ".i" ], "CPPPATH", swig_inc_re)) 423 424# replace the scanners list that has what we want 425env['SCANNERS'] = scanners 426 | 1# -*- mode:python -*- 2 3# Copyright (c) 2004-2005 The Regents of The University of Michigan 4# All rights reserved. 5# 6# Redistribution and use in source and binary forms, with or without 7# modification, are permitted provided that the following conditions are 8# met: redistributions of source code must retain the above copyright --- 410 unchanged lines hidden (view full) --- 419# add the new swig scanner that we like better 420from SCons.Scanner import ClassicCPP as CPPScanner 421swig_inc_re = '^[ \t]*[%,#][ \t]*(?:include|import)[ \t]*(<|")([^>"]+)(>|")' 422scanners.append(CPPScanner("SwigScan", [ ".i" ], "CPPPATH", swig_inc_re)) 423 424# replace the scanners list that has what we want 425env['SCANNERS'] = scanners 426 |
427# Add a custom Check function to the Configure context so that we can 428# figure out if the compiler adds leading underscores to global 429# variables. This is needed for the autogenerated asm files that we 430# use for embedding the python code. 431def CheckLeading(context): 432 context.Message("Checking for leading underscore in global variables...") 433 # 1) Define a global variable called x from asm so the C compiler 434 # won't change the symbol at all. 435 # 2) Declare that variable. 436 # 3) Use the variable 437 # 438 # If the compiler prepends an underscore, this will successfully 439 # link because the external symbol 'x' will be called '_x' which 440 # was defined by the asm statement. If the compiler does not 441 # prepend an underscore, this will not successfully link because 442 # '_x' will have been defined by assembly, while the C portion of 443 # the code will be trying to use 'x' 444 ret = context.TryLink(''' 445 asm(".globl _x; _x: .byte 0"); 446 extern int x; 447 int main() { return x; } 448 ''', extension=".c") 449 context.env.Append(LEADING_UNDERSCORE=ret) 450 context.Result(ret) 451 return ret 452 |
|
427# Platform-specific configuration. Note again that we assume that all 428# builds under a given build root run on the same host platform. 429conf = Configure(env, 430 conf_dir = joinpath(build_root, '.scons_config'), | 453# Platform-specific configuration. Note again that we assume that all 454# builds under a given build root run on the same host platform. 455conf = Configure(env, 456 conf_dir = joinpath(build_root, '.scons_config'), |
431 log_file = joinpath(build_root, 'scons_config.log')) | 457 log_file = joinpath(build_root, 'scons_config.log'), 458 custom_tests = { 'CheckLeading' : CheckLeading }) |
432 | 459 |
460# Check for leading underscores. Don't really need to worry either 461# way so don't need to check the return code. 462conf.CheckLeading() 463 |
|
433# Check if we should compile a 64 bit binary on Mac OS X/Darwin 434try: 435 import platform 436 uname = platform.uname() 437 if uname[0] == 'Darwin' and compare_versions(uname[2], '9.0.0') >= 0: 438 if int(subprocess.Popen('sysctl -n hw.cpu64bit_capable', shell=True, 439 stdout=subprocess.PIPE, stderr=subprocess.STDOUT, 440 close_fds=True).communicate()[0][0]): --- 150 unchanged lines hidden (view full) --- 591 'Make floating-point results compatible with SimpleScalar', 592 False), 593 BoolOption('USE_SSE2', 594 'Compile for SSE2 (-msse2) to get IEEE FP on x86 hosts', 595 False), 596 BoolOption('USE_MYSQL', 'Use MySQL for stats output', have_mysql), 597 BoolOption('USE_FENV', 'Use <fenv.h> IEEE mode control', have_fenv), 598 BoolOption('USE_CHECKER', 'Use checker for detailed CPU models', False), | 464# Check if we should compile a 64 bit binary on Mac OS X/Darwin 465try: 466 import platform 467 uname = platform.uname() 468 if uname[0] == 'Darwin' and compare_versions(uname[2], '9.0.0') >= 0: 469 if int(subprocess.Popen('sysctl -n hw.cpu64bit_capable', shell=True, 470 stdout=subprocess.PIPE, stderr=subprocess.STDOUT, 471 close_fds=True).communicate()[0][0]): --- 150 unchanged lines hidden (view full) --- 622 'Make floating-point results compatible with SimpleScalar', 623 False), 624 BoolOption('USE_SSE2', 625 'Compile for SSE2 (-msse2) to get IEEE FP on x86 hosts', 626 False), 627 BoolOption('USE_MYSQL', 'Use MySQL for stats output', have_mysql), 628 BoolOption('USE_FENV', 'Use <fenv.h> IEEE mode control', have_fenv), 629 BoolOption('USE_CHECKER', 'Use checker for detailed CPU models', False), |
599 ('PYTHONHOME', 600 'Override the default PYTHONHOME for this system (use with caution)', 601 '%s:%s' % (sys.prefix, sys.exec_prefix)), | |
602 ) 603 604nonsticky_opts.AddOptions( 605 BoolOption('update_ref', 'Update test reference outputs', False) 606 ) 607 608# These options get exported to #defines in config/*.hh (see src/SConscript). 609env.ExportOptions = ['FULL_SYSTEM', 'ALPHA_TLASER', 'USE_FENV', \ 610 'USE_MYSQL', 'NO_FAST_ALLOC', 'FAST_ALLOC_DEBUG', \ 611 'FAST_ALLOC_STATS', 'SS_COMPATIBLE_FP', \ | 630 ) 631 632nonsticky_opts.AddOptions( 633 BoolOption('update_ref', 'Update test reference outputs', False) 634 ) 635 636# These options get exported to #defines in config/*.hh (see src/SConscript). 637env.ExportOptions = ['FULL_SYSTEM', 'ALPHA_TLASER', 'USE_FENV', \ 638 'USE_MYSQL', 'NO_FAST_ALLOC', 'FAST_ALLOC_DEBUG', \ 639 'FAST_ALLOC_STATS', 'SS_COMPATIBLE_FP', \ |
612 'USE_CHECKER', 'PYTHONHOME', 'TARGET_ISA'] | 640 'USE_CHECKER', 'TARGET_ISA'] |
613 614# Define a handy 'no-op' action 615def no_action(target, source, env): 616 return 0 617 618env.NoAction = Action(no_action, None) 619 620################################################### --- 228 unchanged lines hidden --- | 641 642# Define a handy 'no-op' action 643def no_action(target, source, env): 644 return 0 645 646env.NoAction = Action(no_action, None) 647 648################################################### --- 228 unchanged lines hidden --- |