SConstruct (13713:cd0c57cd48f7) SConstruct (13715:4ba223628b62)
1# -*- mode:python -*-
2
3# Copyright (c) 2013, 2015-2017 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

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

210
211# Take a list of paths (or SCons Nodes) and return a list with all
212# paths made absolute and ~-expanded. Paths will be interpreted
213# relative to the launch directory unless a different root is provided
214def makePathListAbsolute(path_list, root=GetLaunchDir()):
215 return [abspath(joinpath(root, expanduser(str(p))))
216 for p in path_list]
217
1# -*- mode:python -*-
2
3# Copyright (c) 2013, 2015-2017 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

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

210
211# Take a list of paths (or SCons Nodes) and return a list with all
212# paths made absolute and ~-expanded. Paths will be interpreted
213# relative to the launch directory unless a different root is provided
214def makePathListAbsolute(path_list, root=GetLaunchDir()):
215 return [abspath(joinpath(root, expanduser(str(p))))
216 for p in path_list]
217
218def find_first_prog(prog_names):
219 """Find the absolute path to the first existing binary in prog_names"""
220
221 if not isinstance(prog_names, (list, tuple)):
222 prog_names = [ prog_names ]
223
224 for p in prog_names:
225 p = main.WhereIs(p)
226 if p is not None:
227 return p
228
229 return None
230
218# Each target must have 'build' in the interior of the path; the
219# directory below this will determine the build parameters. For
220# example, for target 'foo/bar/build/ALPHA_SE/arch/alpha/blah.do' we
221# recognize that ALPHA_SE specifies the configuration because it
222# follow 'build' in the build path.
223
224# The funky assignment to "[:]" is needed to replace the list contents
225# in place rather than reassign the symbol to a new list, which

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

271
272global_vars_file = joinpath(build_root, 'variables.global')
273
274global_vars = Variables(global_vars_file, args=ARGUMENTS)
275
276global_vars.AddVariables(
277 ('CC', 'C compiler', environ.get('CC', main['CC'])),
278 ('CXX', 'C++ compiler', environ.get('CXX', main['CXX'])),
231# Each target must have 'build' in the interior of the path; the
232# directory below this will determine the build parameters. For
233# example, for target 'foo/bar/build/ALPHA_SE/arch/alpha/blah.do' we
234# recognize that ALPHA_SE specifies the configuration because it
235# follow 'build' in the build path.
236
237# The funky assignment to "[:]" is needed to replace the list contents
238# in place rather than reassign the symbol to a new list, which

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

284
285global_vars_file = joinpath(build_root, 'variables.global')
286
287global_vars = Variables(global_vars_file, args=ARGUMENTS)
288
289global_vars.AddVariables(
290 ('CC', 'C compiler', environ.get('CC', main['CC'])),
291 ('CXX', 'C++ compiler', environ.get('CXX', main['CXX'])),
292 ('PYTHON_CONFIG', 'Python config binary to use',
293 [ 'python2.7-config', 'python-config' ]),
279 ('PROTOC', 'protoc tool', environ.get('PROTOC', 'protoc')),
280 ('BATCH', 'Use batch pool for build and tests', False),
281 ('BATCH_CMD', 'Batch pool submission command name', 'qdo'),
282 ('M5_BUILD_CACHE', 'Cache built objects in this directory', False),
283 ('EXTRAS', 'Add extra directories to the compilation', '')
284 )
285
286# Update main environment with values from ARGUMENTS & global_vars_file

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

697if main['USE_PYTHON']:
698 # Find Python include and library directories for embedding the
699 # interpreter. We rely on python-config to resolve the appropriate
700 # includes and linker flags. ParseConfig does not seem to understand
701 # the more exotic linker flags such as -Xlinker and -export-dynamic so
702 # we add them explicitly below. If you want to link in an alternate
703 # version of python, see above for instructions on how to invoke
704 # scons with the appropriate PATH set.
294 ('PROTOC', 'protoc tool', environ.get('PROTOC', 'protoc')),
295 ('BATCH', 'Use batch pool for build and tests', False),
296 ('BATCH_CMD', 'Batch pool submission command name', 'qdo'),
297 ('M5_BUILD_CACHE', 'Cache built objects in this directory', False),
298 ('EXTRAS', 'Add extra directories to the compilation', '')
299 )
300
301# Update main environment with values from ARGUMENTS & global_vars_file

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

712if main['USE_PYTHON']:
713 # Find Python include and library directories for embedding the
714 # interpreter. We rely on python-config to resolve the appropriate
715 # includes and linker flags. ParseConfig does not seem to understand
716 # the more exotic linker flags such as -Xlinker and -export-dynamic so
717 # we add them explicitly below. If you want to link in an alternate
718 # version of python, see above for instructions on how to invoke
719 # scons with the appropriate PATH set.
705 #
706 # First we check if python2-config exists, else we use python-config
707 python_config = readCommand(['which', 'python2-config'],
708 exception='').strip()
709 if not os.path.exists(python_config):
710 python_config = readCommand(['which', 'python-config'],
711 exception='').strip()
720
721 python_config = find_first_prog(main['PYTHON_CONFIG'])
722 if python_config is None:
723 print("Error: can't find a suitable python-config, tried %s" % \
724 main['PYTHON_CONFIG'])
725 Exit(1)
726
727 print("Info: Using Python config: %s" % (python_config, ))
712 py_includes = readCommand([python_config, '--includes'],
713 exception='').split()
714 py_includes = filter(lambda s: match(r'.*\/include\/.*',s), py_includes)
715 # Strip the -I from the include folders before adding them to the
716 # CPPPATH
717 py_includes = map(lambda s: s[2:] if s.startswith('-I') else s, py_includes)
718 main.Append(CPPPATH=py_includes)
719

--- 565 unchanged lines hidden ---
728 py_includes = readCommand([python_config, '--includes'],
729 exception='').split()
730 py_includes = filter(lambda s: match(r'.*\/include\/.*',s), py_includes)
731 # Strip the -I from the include folders before adding them to the
732 # CPPPATH
733 py_includes = map(lambda s: s[2:] if s.startswith('-I') else s, py_includes)
734 main.Append(CPPPATH=py_includes)
735

--- 565 unchanged lines hidden ---