scons: Put all config variables in an env['CONF'] sub-dict.

This makes what are configuration and what are internal SCons variables
explicit and separate, and makes it unnecessary to call out what
variables to export to C++.

These variables will also be plumbed into and out of kconfiglib in later
changes.

Change-Id: Iaf5e098d7404af06285c421dbdf8ef4171b3f001
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/56892
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
Maintainer: Gabe Black <gabe.black@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
Gabe Black
2022-02-15 22:23:43 -08:00
parent caa5f12e21
commit e6c0ba97db
87 changed files with 211 additions and 233 deletions

View File

@@ -38,14 +38,8 @@
Import('*')
# Only build if we have protobuf support
if env['HAVE_PROTOBUF']:
ProtoBuf('inst_dep_record.proto')
ProtoBuf('packet.proto')
ProtoBuf('inst.proto')
Source('protobuf.cc')
Source('protoio.cc')
# protoc relies on the fact that undefined preprocessor symbols are
# explanded to 0 but since we use -Wundef they end up generating
# warnings.
env.Append(CCFLAGS='-DPROTOBUF_INLINE_NOT_IN_HEADERS=0')
ProtoBuf('inst_dep_record.proto', tags='protobuf')
ProtoBuf('packet.proto', tags='protobuf')
ProtoBuf('inst.proto', tags='protobuf')
Source('protobuf.cc', tags='protobuf')
Source('protoio.cc', tags='protobuf')

View File

@@ -65,13 +65,18 @@ with gem5_scons.Configure(main) as conf:
# automatically added to the LIBS environment variable. After
# this, we can use the HAVE_PROTOBUF flag to determine if we have
# got both protoc and libprotobuf available.
conf.env['HAVE_PROTOBUF'] = conf.env['HAVE_PROTOC'] and \
conf.env['CONF']['HAVE_PROTOBUF'] = conf.env['HAVE_PROTOC'] and \
conf.CheckLibWithHeader('protobuf', 'google/protobuf/message.h',
'C++', 'GOOGLE_PROTOBUF_VERIFY_VERSION;')
# If we have the compiler but not the library, print another warning.
if main['HAVE_PROTOC'] and not main['HAVE_PROTOBUF']:
if main['HAVE_PROTOC'] and not main['CONF']['HAVE_PROTOBUF']:
warning('Did not find protocol buffer library and/or headers.\n'
'Please install libprotobuf-dev for tracing support.')
export_vars.append('HAVE_PROTOBUF')
if main['CONF']['HAVE_PROTOBUF']:
main.TagImplies('protobuf', 'gem5 lib')
# protoc relies on the fact that undefined preprocessor symbols are
# explanded to 0 but since we use -Wundef they end up generating
# warnings.
main.Append(CCFLAGS='-DPROTOBUF_INLINE_NOT_IN_HEADERS=0')