SConstruct (11988:665cd5f8b52b) SConstruct (11989:dbb16376953c)
1# -*- mode:python -*-
2
3# Copyright (c) 2013, 2015, 2016 ARM Limited
4# All rights reserved.
5#
6# The license below extends only to copyright in the software and shall
7# not be construed as granting a license to any other intellectual
8# property including but not limited to intellectual property relating

--- 195 unchanged lines hidden (view full) ---

204#
205# Set up the main build environment.
206#
207########################################################################
208
209# export TERM so that clang reports errors in color
210use_vars = set([ 'AS', 'AR', 'CC', 'CXX', 'HOME', 'LD_LIBRARY_PATH',
211 'LIBRARY_PATH', 'PATH', 'PKG_CONFIG_PATH', 'PROTOC',
1# -*- mode:python -*-
2
3# Copyright (c) 2013, 2015, 2016 ARM Limited
4# All rights reserved.
5#
6# The license below extends only to copyright in the software and shall
7# not be construed as granting a license to any other intellectual
8# property including but not limited to intellectual property relating

--- 195 unchanged lines hidden (view full) ---

204#
205# Set up the main build environment.
206#
207########################################################################
208
209# export TERM so that clang reports errors in color
210use_vars = set([ 'AS', 'AR', 'CC', 'CXX', 'HOME', 'LD_LIBRARY_PATH',
211 'LIBRARY_PATH', 'PATH', 'PKG_CONFIG_PATH', 'PROTOC',
212 'PYTHONPATH', 'RANLIB', 'SWIG', 'TERM' ])
212 'PYTHONPATH', 'RANLIB', 'TERM' ])
213
214use_prefixes = [
215 "ASAN_", # address sanitizer symbolizer path and settings
216 "CCACHE_", # ccache (caching compiler wrapper) configuration
217 "CCC_", # clang static analyzer configuration
218 "DISTCC_", # distcc (distributed compiler wrapper) configuration
219 "INCLUDE_SERVER_", # distcc pump server settings
220 "M5", # M5 configuration (e.g., path to kernels)

--- 15 unchanged lines hidden (view full) ---

236
237main_dict_keys = main.Dictionary().keys()
238
239# Check that we have a C/C++ compiler
240if not ('CC' in main_dict_keys and 'CXX' in main_dict_keys):
241 print "No C++ compiler installed (package g++ on Ubuntu and RedHat)"
242 Exit(1)
243
213
214use_prefixes = [
215 "ASAN_", # address sanitizer symbolizer path and settings
216 "CCACHE_", # ccache (caching compiler wrapper) configuration
217 "CCC_", # clang static analyzer configuration
218 "DISTCC_", # distcc (distributed compiler wrapper) configuration
219 "INCLUDE_SERVER_", # distcc pump server settings
220 "M5", # M5 configuration (e.g., path to kernels)

--- 15 unchanged lines hidden (view full) ---

236
237main_dict_keys = main.Dictionary().keys()
238
239# Check that we have a C/C++ compiler
240if not ('CC' in main_dict_keys and 'CXX' in main_dict_keys):
241 print "No C++ compiler installed (package g++ on Ubuntu and RedHat)"
242 Exit(1)
243
244# Check that swig is present
245if not 'SWIG' in main_dict_keys:
246 print "swig is not installed (package swig on Ubuntu and RedHat)"
247 Exit(1)
248
249# add useful python code PYTHONPATH so it can be used by subprocesses
250# as well
251main.AppendENVPath('PYTHONPATH', extra_python_paths)
252
253########################################################################
254#
255# Mercurial Stuff.
256#

--- 262 unchanged lines hidden (view full) ---

519
520global_vars_file = joinpath(build_root, 'variables.global')
521
522global_vars = Variables(global_vars_file, args=ARGUMENTS)
523
524global_vars.AddVariables(
525 ('CC', 'C compiler', environ.get('CC', main['CC'])),
526 ('CXX', 'C++ compiler', environ.get('CXX', main['CXX'])),
244# add useful python code PYTHONPATH so it can be used by subprocesses
245# as well
246main.AppendENVPath('PYTHONPATH', extra_python_paths)
247
248########################################################################
249#
250# Mercurial Stuff.
251#

--- 262 unchanged lines hidden (view full) ---

514
515global_vars_file = joinpath(build_root, 'variables.global')
516
517global_vars = Variables(global_vars_file, args=ARGUMENTS)
518
519global_vars.AddVariables(
520 ('CC', 'C compiler', environ.get('CC', main['CC'])),
521 ('CXX', 'C++ compiler', environ.get('CXX', main['CXX'])),
527 ('SWIG', 'SWIG tool', environ.get('SWIG', main['SWIG'])),
528 ('PROTOC', 'protoc tool', environ.get('PROTOC', 'protoc')),
529 ('BATCH', 'Use batch pool for build and tests', False),
530 ('BATCH_CMD', 'Batch pool submission command name', 'qdo'),
531 ('M5_BUILD_CACHE', 'Cache built objects in this directory', False),
532 ('EXTRAS', 'Add extra directories to the compilation', '')
533 )
534
535# Update main environment with values from ARGUMENTS & global_vars_file

--- 104 unchanged lines hidden (view full) ---

640if GetOption('verbose'):
641 def MakeAction(action, string, *args, **kwargs):
642 return Action(action, *args, **kwargs)
643else:
644 MakeAction = Action
645 main['CCCOMSTR'] = Transform("CC")
646 main['CXXCOMSTR'] = Transform("CXX")
647 main['ASCOMSTR'] = Transform("AS")
522 ('PROTOC', 'protoc tool', environ.get('PROTOC', 'protoc')),
523 ('BATCH', 'Use batch pool for build and tests', False),
524 ('BATCH_CMD', 'Batch pool submission command name', 'qdo'),
525 ('M5_BUILD_CACHE', 'Cache built objects in this directory', False),
526 ('EXTRAS', 'Add extra directories to the compilation', '')
527 )
528
529# Update main environment with values from ARGUMENTS & global_vars_file

--- 104 unchanged lines hidden (view full) ---

634if GetOption('verbose'):
635 def MakeAction(action, string, *args, **kwargs):
636 return Action(action, *args, **kwargs)
637else:
638 MakeAction = Action
639 main['CCCOMSTR'] = Transform("CC")
640 main['CXXCOMSTR'] = Transform("CXX")
641 main['ASCOMSTR'] = Transform("AS")
648 main['SWIGCOMSTR'] = Transform("SWIG")
649 main['ARCOMSTR'] = Transform("AR", 0)
650 main['LINKCOMSTR'] = Transform("LINK", 0)
651 main['SHLINKCOMSTR'] = Transform("SHLINK", 0)
652 main['RANLIBCOMSTR'] = Transform("RANLIB", 0)
653 main['M4COMSTR'] = Transform("M4")
654 main['SHCCCOMSTR'] = Transform("SHCC")
655 main['SHCXXCOMSTR'] = Transform("SHCXX")
656Export('MakeAction')

--- 229 unchanged lines hidden (view full) ---

886 # Attempt to establish what linking flags to add for protobuf
887 # using pkg-config
888 main.ParseConfig('pkg-config --cflags --libs-only-L protobuf')
889 except:
890 print termcap.Yellow + termcap.Bold + \
891 'Warning: pkg-config could not get protobuf flags.' + \
892 termcap.Normal
893
642 main['ARCOMSTR'] = Transform("AR", 0)
643 main['LINKCOMSTR'] = Transform("LINK", 0)
644 main['SHLINKCOMSTR'] = Transform("SHLINK", 0)
645 main['RANLIBCOMSTR'] = Transform("RANLIB", 0)
646 main['M4COMSTR'] = Transform("M4")
647 main['SHCCCOMSTR'] = Transform("SHCC")
648 main['SHCXXCOMSTR'] = Transform("SHCXX")
649Export('MakeAction')

--- 229 unchanged lines hidden (view full) ---

879 # Attempt to establish what linking flags to add for protobuf
880 # using pkg-config
881 main.ParseConfig('pkg-config --cflags --libs-only-L protobuf')
882 except:
883 print termcap.Yellow + termcap.Bold + \
884 'Warning: pkg-config could not get protobuf flags.' + \
885 termcap.Normal
886
894# Check for SWIG
895if not main.has_key('SWIG'):
896 print 'Error: SWIG utility not found.'
897 print ' Please install (see http://www.swig.org) and retry.'
898 Exit(1)
899
887
900# Check for appropriate SWIG version
901swig_version = readCommand([main['SWIG'], '-version'], exception='').split()
902# First 3 words should be "SWIG Version x.y.z"
903if len(swig_version) < 3 or \
904 swig_version[0] != 'SWIG' or swig_version[1] != 'Version':
905 print 'Error determining SWIG version.'
906 Exit(1)
907
908min_swig_version = '2.0.4'
909if compareVersions(swig_version[2], min_swig_version) < 0:
910 print 'Error: SWIG version', min_swig_version, 'or newer required.'
911 print ' Installed version:', swig_version[2]
912 Exit(1)
913
914# Check for known incompatibilities. The standard library shipped with
915# gcc >= 4.9 does not play well with swig versions prior to 3.0
916if main['GCC'] and compareVersions(gcc_version, '4.9') >= 0 and \
917 compareVersions(swig_version[2], '3.0') < 0:
918 print termcap.Yellow + termcap.Bold + \
919 'Warning: This combination of gcc and swig have' + \
920 ' known incompatibilities.\n' + \
921 ' If you encounter build problems, please update ' + \
922 'swig to 3.0 or later.' + \
923 termcap.Normal
924
925# Set up SWIG flags & scanner
926swig_flags=Split('-c++ -python -modern -templatereduce $_CPPINCFLAGS')
927main.Append(SWIGFLAGS=swig_flags)
928
929# Check for 'timeout' from GNU coreutils. If present, regressions will
930# be run with a time limit. We require version 8.13 since we rely on
931# support for the '--foreground' option.
932if sys.platform.startswith('freebsd'):
933 timeout_lines = readCommand(['gtimeout', '--version'],
934 exception='').splitlines()
935else:
936 timeout_lines = readCommand(['timeout', '--version'],
937 exception='').splitlines()
938# Get the first line and tokenize it
939timeout_version = timeout_lines[0].split() if timeout_lines else []
940main['TIMEOUT'] = timeout_version and \
941 compareVersions(timeout_version[-1], '8.13') >= 0
942
888# Check for 'timeout' from GNU coreutils. If present, regressions will
889# be run with a time limit. We require version 8.13 since we rely on
890# support for the '--foreground' option.
891if sys.platform.startswith('freebsd'):
892 timeout_lines = readCommand(['gtimeout', '--version'],
893 exception='').splitlines()
894else:
895 timeout_lines = readCommand(['timeout', '--version'],
896 exception='').splitlines()
897# Get the first line and tokenize it
898timeout_version = timeout_lines[0].split() if timeout_lines else []
899main['TIMEOUT'] = timeout_version and \
900 compareVersions(timeout_version[-1], '8.13') >= 0
901
943# filter out all existing swig scanners, they mess up the dependency
944# stuff for some reason
945scanners = []
946for scanner in main['SCANNERS']:
947 skeys = scanner.skeys
948 if skeys == '.i':
949 continue
950
951 if isinstance(skeys, (list, tuple)) and '.i' in skeys:
952 continue
953
954 scanners.append(scanner)
955
956# add the new swig scanner that we like better
957from SCons.Scanner import ClassicCPP as CPPScanner
958swig_inc_re = '^[ \t]*[%,#][ \t]*(?:include|import)[ \t]*(<|")([^>"]+)(>|")'
959scanners.append(CPPScanner("SwigScan", [ ".i" ], "CPPPATH", swig_inc_re))
960
961# replace the scanners list that has what we want
962main['SCANNERS'] = scanners
963
964# Add a custom Check function to test for structure members.
965def CheckMember(context, include, decl, member, include_quotes="<>"):
966 context.Message("Checking for member %s in %s..." %
967 (member, decl))
968 text = """
969#include %(header)s
970int main(){
971 %(decl)s test;

--- 647 unchanged lines hidden ---
902# Add a custom Check function to test for structure members.
903def CheckMember(context, include, decl, member, include_quotes="<>"):
904 context.Message("Checking for member %s in %s..." %
905 (member, decl))
906 text = """
907#include %(header)s
908int main(){
909 %(decl)s test;

--- 647 unchanged lines hidden ---