scons: Stop piggy-backing on the default tool for default settings.

Instead, create a new tool called EnvDefaults. This tool now needs
to be explicitly listed in the set of tools available through an
Environment, but that's easy to do in on place (all environments should
stem from main). Hijacking default like we were doing was (as far as I
can tell) not how that tool was intended to be used, and doing things
this way is a bit less hacky.

Also, we can split more Builders, etc, out of SConstruct, and these will
need to attach to main in the same way. We're going to need a list of
tools when main is constructed one way or the other, so we might as well
follow the rules.

Change-Id: I392e1639cb69d373c64970dccf45258000498cc3
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/40965
Reviewed-by: Gabe Black <gabe.black@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Maintainer: Bobby R. Bruce <bbruce@ucdavis.edu>
This commit is contained in:
Gabe Black
2021-02-08 01:52:54 -08:00
parent 14f14f9a62
commit 789b6eb615
3 changed files with 8 additions and 15 deletions

View File

@@ -121,7 +121,7 @@ AddOption('--with-systemc-tests', action='store_true',
help='Build systemc tests')
from gem5_scons import Transform, error, warning, summarize_warnings
from gem5_scons import TempFileSpawn, parse_build_path
from gem5_scons import TempFileSpawn, parse_build_path, EnvDefaults
import gem5_scons
########################################################################
@@ -130,7 +130,7 @@ import gem5_scons
#
########################################################################
main = Environment(tools=['default', 'git', TempFileSpawn])
main = Environment(tools=['default', 'git', TempFileSpawn, EnvDefaults])
main.Tool(SCons.Tool.FindTool(['gcc', 'clang'], main))
main.Tool(SCons.Tool.FindTool(['g++', 'clang++'], main))

View File

@@ -45,6 +45,7 @@ import textwrap
from gem5_scons.util import get_termcap
from gem5_scons.configure import Configure
from gem5_scons.defaults import EnvDefaults
import SCons.Script
termcap = get_termcap()
@@ -237,4 +238,7 @@ def parse_build_path(target):
return os.path.join('/', *path_dirs), variant_dir
__all__ = ['Configure', 'Transform', 'warning', 'error', 'parse_build_dir']
__all__ = [
'Configure', 'EnvDefaults', 'Transform', 'warning', 'error',
'parse_build_dir'
]

View File

@@ -39,14 +39,10 @@
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import os
import sys
import SCons.Tool
import SCons.Tool.default
from gem5_python_paths import extra_python_paths
def common_config(env):
def EnvDefaults(env):
# export TERM so that clang reports errors in color
use_vars = set([ 'AS', 'AR', 'CC', 'CXX', 'HOME', 'LD_LIBRARY_PATH',
'LIBRARY_PATH', 'PATH', 'PKG_CONFIG_PATH', 'PROTOC',
@@ -75,10 +71,3 @@ def common_config(env):
# add useful python code PYTHONPATH so it can be used by subprocesses
# as well
env.AppendENVPath('PYTHONPATH', extra_python_paths)
def generate(env):
common_config(env)
SCons.Tool.default.generate(env)
def exists(env):
return 1