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:
@@ -42,14 +42,10 @@ GTest('cprintf.test', 'cprintf.test.cc')
|
||||
Executable('cprintftime', 'cprintftime.cc', 'cprintf.cc')
|
||||
Source('debug.cc', add_tags=['gem5 trace', 'gem5 events'])
|
||||
GTest('debug.test', 'debug.test.cc', 'debug.cc')
|
||||
if env['HAVE_FENV']:
|
||||
Source('fenv.cc')
|
||||
else:
|
||||
warning("No IEEE FP rounding mode control.\n"
|
||||
"FP results may deviate slightly from other platforms.")
|
||||
if env['HAVE_PNG']:
|
||||
Source('fenv.cc', tags='fenv')
|
||||
if env['CONF']['HAVE_PNG']:
|
||||
SourceLib('png')
|
||||
Source('pngwriter.cc')
|
||||
Source('pngwriter.cc', tags='png')
|
||||
Source('fiber.cc')
|
||||
GTest('fiber.test', 'fiber.test.cc', 'fiber.cc')
|
||||
GTest('flags.test', 'flags.test.cc')
|
||||
@@ -70,7 +66,7 @@ Source('pixel.cc')
|
||||
GTest('pixel.test', 'pixel.test.cc', 'pixel.cc')
|
||||
Source('pollevent.cc')
|
||||
Source('random.cc')
|
||||
if env['TARGET_ISA'] != 'null':
|
||||
if env['CONF']['TARGET_ISA'] != 'null':
|
||||
Source('remote_gdb.cc')
|
||||
Source('socket.cc')
|
||||
GTest('socket.test', 'socket.test.cc', 'socket.cc')
|
||||
|
||||
@@ -31,30 +31,35 @@ import gem5_scons
|
||||
|
||||
with gem5_scons.Configure(main) as conf:
|
||||
# Check for <fenv.h> (C99 FP environment control)
|
||||
conf.env['HAVE_FENV'] = conf.CheckHeader('fenv.h', '<>')
|
||||
conf.env['CONF']['HAVE_FENV'] = conf.CheckHeader('fenv.h', '<>')
|
||||
|
||||
if not conf.env['HAVE_FENV']:
|
||||
if conf.env['CONF']['HAVE_FENV']:
|
||||
conf.env.TagImplies('fenv', 'gem5 lib')
|
||||
else:
|
||||
warning("Header file <fenv.h> not found.\n"
|
||||
"This host has no IEEE FP rounding mode control.")
|
||||
|
||||
# Check for <png.h> (libpng library needed if wanting to dump
|
||||
# frame buffer image in png format)
|
||||
conf.env['HAVE_PNG'] = conf.CheckHeader('png.h', '<>')
|
||||
conf.env['CONF']['HAVE_PNG'] = conf.CheckHeader('png.h', '<>')
|
||||
|
||||
if not conf.env['HAVE_PNG']:
|
||||
if conf.env['CONF']['HAVE_PNG']:
|
||||
conf.env.TagImplies('png', 'gem5 lib')
|
||||
else:
|
||||
warning("Header file <png.h> not found.\n"
|
||||
"This host has no libpng library.\n"
|
||||
"Disabling support for PNG framebuffers.")
|
||||
|
||||
have_posix_clock = \
|
||||
conf.env['CONF']['HAVE_POSIX_CLOCK'] = \
|
||||
conf.CheckLibWithHeader([None, 'rt'], 'time.h', 'C',
|
||||
'clock_nanosleep(0,0,NULL,NULL);')
|
||||
if not have_posix_clock:
|
||||
if not conf.env['CONF']['HAVE_POSIX_CLOCK']:
|
||||
warning("Can't find library for POSIX clocks.")
|
||||
|
||||
# Valgrind gets much less confused if you tell it when you're using
|
||||
# alternative stacks.
|
||||
conf.env['HAVE_VALGRIND'] = conf.CheckCHeader('valgrind/valgrind.h')
|
||||
conf.env['CONF']['HAVE_VALGRIND'] = \
|
||||
conf.CheckCHeader('valgrind/valgrind.h')
|
||||
|
||||
|
||||
# Check if the compiler supports the [[gnu::deprecated]] attribute
|
||||
@@ -64,20 +69,16 @@ werror_env.Append(CCFLAGS=['-Werror'])
|
||||
with gem5_scons.Configure(werror_env) as conf:
|
||||
|
||||
# Store result in the main environment
|
||||
main['HAVE_DEPRECATED_NAMESPACE'] = conf.TryCompile('''
|
||||
main['CONF']['HAVE_DEPRECATED_NAMESPACE'] = conf.TryCompile('''
|
||||
int main() {return 0;}
|
||||
namespace [[gnu::deprecated("Test namespace deprecation")]]
|
||||
test_deprecated_namespace {}
|
||||
''', '.cc')
|
||||
|
||||
if not main['HAVE_DEPRECATED_NAMESPACE']:
|
||||
if not main['CONF']['HAVE_DEPRECATED_NAMESPACE']:
|
||||
warning("Deprecated namespaces are not supported by this compiler.\n"
|
||||
"Please make sure to check the mailing list for deprecation "
|
||||
"announcements.")
|
||||
|
||||
sticky_vars.Add(BoolVariable('USE_POSIX_CLOCK', 'Use POSIX Clocks',
|
||||
have_posix_clock))
|
||||
|
||||
|
||||
export_vars.extend([
|
||||
'HAVE_FENV', 'HAVE_PNG', 'HAVE_VALGRIND', 'HAVE_DEPRECATED_NAMESPACE'])
|
||||
'${CONF["HAVE_POSIX_CLOCK"]}'))
|
||||
|
||||
@@ -34,11 +34,10 @@ Source('info.cc')
|
||||
Source('storage.cc')
|
||||
Source('text.cc')
|
||||
|
||||
if env['HAVE_HDF5']:
|
||||
if env['GCC']:
|
||||
Source('hdf5.cc', append={'CXXFLAGS': '-Wno-deprecated-copy'})
|
||||
else:
|
||||
Source('hdf5.cc')
|
||||
if env['GCC']:
|
||||
Source('hdf5.cc', append={'CXXFLAGS': '-Wno-deprecated-copy'}, tags='hdf5')
|
||||
else:
|
||||
Source('hdf5.cc', tags='hdf5')
|
||||
|
||||
GTest('group.test', 'group.test.cc', 'group.cc', 'info.cc',
|
||||
with_tag('gem5 trace'))
|
||||
|
||||
@@ -41,13 +41,13 @@ with gem5_scons.Configure(main) as conf:
|
||||
# include path and library path provided by pkg-config. We perform
|
||||
# this check even if there isn't a pkg-config configuration for hdf5
|
||||
# since some installations don't use pkg-config.
|
||||
conf.env['HAVE_HDF5'] = \
|
||||
conf.env['CONF']['HAVE_HDF5'] = \
|
||||
conf.CheckLibWithHeader('hdf5', 'hdf5.h', 'C',
|
||||
'H5Fcreate("", 0, 0, 0);') and \
|
||||
conf.CheckLibWithHeader('hdf5_cpp', 'H5Cpp.h', 'C++',
|
||||
'H5::H5File("", 0);')
|
||||
|
||||
if not conf.env['HAVE_HDF5']:
|
||||
if conf.env['CONF']['HAVE_HDF5']:
|
||||
conf.env.TagImplies('hdf5', 'gem5 lib')
|
||||
else:
|
||||
warning("Couldn't find HDF5 C++ libraries. Disabling HDF5 support.")
|
||||
|
||||
export_vars.append('HAVE_HDF5')
|
||||
|
||||
Reference in New Issue
Block a user