scons,misc: Remove the ability to disable some trivial features.
These are HDF5, PNG, FENV, and TUNTAP support, all of which add capabilities to gem5 which can be ignored if not wanted. It could be argued that FENV changes behavior because it makes setting the FP rounding mode work or not as used by SPARC, but since the difference is trivial and in a niche area, that (along with the other options) doesn't seem to justify having a top level control in the build system. Since these are no longer options which say whether to *use* a particular feature, and are instead flags which say whether we *have* a particular feature, change their names from USE_* to HAVE_*, to stay consistent with other variables. Most of the remaining USE_* flags, KVM, FASTMODEL, SYSTEMC, and (indirectly) USE_PYTHON, toggle on and off major systems which can have a significant effect on boot time, or, in the case of FASTMODEL, even consume external resources which may not be available and which may break the build. USE_POSIX_TIMER was also left alone since it selects between two implementations of some functions. By forcing it to be on or off depending on the host, we would be forcing some code to be excluded in either case. That would make that other code impossible to test without hacking up scons or modifying the host machine. Change-Id: I0b03f23e65478caefd50cd3516974386e3dbf0db Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/40964 Reviewed-by: Gabe Black <gabe.black@gmail.com> Maintainer: Gabe Black <gabe.black@gmail.com> Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
@@ -42,12 +42,12 @@ GTest('cprintf.test', 'cprintf.test.cc')
|
||||
Executable('cprintftime', 'cprintftime.cc', 'cprintf.cc')
|
||||
Source('debug.cc')
|
||||
GTest('debug.test', 'debug.test.cc', 'debug.cc')
|
||||
if env['USE_FENV']:
|
||||
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['USE_PNG']:
|
||||
if env['HAVE_PNG']:
|
||||
env.Append(LIBS=['png'])
|
||||
Source('pngwriter.cc')
|
||||
Source('fiber.cc')
|
||||
|
||||
@@ -30,13 +30,21 @@ from gem5_scons import warning
|
||||
import gem5_scons
|
||||
|
||||
with gem5_scons.Configure(main) as conf:
|
||||
|
||||
# Check for <fenv.h> (C99 FP environment control)
|
||||
have_fenv = conf.CheckHeader('fenv.h', '<>')
|
||||
conf.env['HAVE_FENV'] = conf.CheckHeader('fenv.h', '<>')
|
||||
|
||||
if not conf.env['HAVE_FENV']:
|
||||
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)
|
||||
have_png = conf.CheckHeader('png.h', '<>')
|
||||
conf.env['HAVE_PNG'] = conf.CheckHeader('png.h', '<>')
|
||||
|
||||
if not conf.env['HAVE_PNG']:
|
||||
warning("Header file <png.h> not found.\n"
|
||||
"This host has no libpng library.\n"
|
||||
"Disabling support for PNG framebuffers.")
|
||||
|
||||
have_posix_clock = \
|
||||
conf.CheckLibWithHeader([None, 'rt'], 'time.h', 'C',
|
||||
@@ -49,26 +57,9 @@ with gem5_scons.Configure(main) as conf:
|
||||
conf.env['HAVE_VALGRIND'] = conf.CheckCHeader('valgrind/valgrind.h')
|
||||
|
||||
|
||||
if have_fenv:
|
||||
sticky_vars.Add(BoolVariable('USE_FENV', 'Use <fenv.h> IEEE mode control',
|
||||
True))
|
||||
else:
|
||||
warning("Header file <fenv.h> not found.\n"
|
||||
"This host has no IEEE FP rounding mode control.")
|
||||
main['USE_FENV'] = False
|
||||
|
||||
|
||||
if have_png:
|
||||
sticky_vars.Add(BoolVariable('USE_PNG', 'Enable support for PNG images',
|
||||
True))
|
||||
else:
|
||||
warning("Header file <png.h> not found.\n"
|
||||
"This host has no libpng library.\n"
|
||||
"Disabling support for PNG framebuffers.")
|
||||
main['USE_PNG'] = False
|
||||
|
||||
sticky_vars.Add(BoolVariable('USE_POSIX_CLOCK', 'Use POSIX Clocks',
|
||||
have_posix_clock))
|
||||
|
||||
|
||||
export_vars.extend(['USE_FENV', 'USE_PNG', 'USE_POSIX_CLOCK', 'HAVE_VALGRIND'])
|
||||
export_vars.extend([
|
||||
'HAVE_FENV', 'HAVE_PNG', 'USE_POSIX_CLOCK', 'HAVE_VALGRIND'])
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
#ifndef __BASE_FENV_HH__
|
||||
#define __BASE_FENV_HH__
|
||||
|
||||
#include "config/use_fenv.hh"
|
||||
#include "config/have_fenv.hh"
|
||||
|
||||
namespace gem5
|
||||
{
|
||||
@@ -42,7 +42,7 @@ enum class RoundingMode
|
||||
Upward = 3
|
||||
};
|
||||
|
||||
#if USE_FENV
|
||||
#if HAVE_FENV
|
||||
|
||||
void setFpRound(RoundingMode rm);
|
||||
RoundingMode getFpRound();
|
||||
@@ -57,7 +57,7 @@ RoundingMode getFpRound()
|
||||
return RoundingMode::Downward;
|
||||
}
|
||||
|
||||
#endif // USE_FENV
|
||||
#endif // HAVE_FENV
|
||||
|
||||
} // namespace gem5
|
||||
|
||||
|
||||
@@ -39,9 +39,9 @@
|
||||
|
||||
#include "base/bmpwriter.hh"
|
||||
#include "base/logging.hh"
|
||||
#include "config/use_png.hh"
|
||||
#include "config/have_png.hh"
|
||||
|
||||
#if USE_PNG
|
||||
#if HAVE_PNG
|
||||
#include "base/pngwriter.hh"
|
||||
|
||||
#endif
|
||||
@@ -58,7 +58,7 @@ createImgWriter(Enums::ImageFormat type, const FrameBuffer *fb)
|
||||
// available.
|
||||
|
||||
M5_FALLTHROUGH;
|
||||
#if USE_PNG
|
||||
#if HAVE_PNG
|
||||
case Enums::Png:
|
||||
return std::unique_ptr<PngWriter>(new PngWriter(fb));
|
||||
#endif
|
||||
|
||||
@@ -34,7 +34,7 @@ Source('info.cc')
|
||||
Source('storage.cc')
|
||||
Source('text.cc')
|
||||
|
||||
if env['USE_HDF5']:
|
||||
if env['HAVE_HDF5']:
|
||||
if main['GCC']:
|
||||
Source('hdf5.cc', append={'CXXFLAGS': '-Wno-deprecated-copy'})
|
||||
else:
|
||||
|
||||
@@ -26,11 +26,9 @@
|
||||
Import('*')
|
||||
|
||||
from gem5_scons import warning
|
||||
|
||||
import gem5_scons
|
||||
|
||||
with gem5_scons.Configure(main) as conf:
|
||||
|
||||
# Check if there is a pkg-config configuration for hdf5. If we find
|
||||
# it, setup the environment to enable linking and header inclusion. We
|
||||
# don't actually try to include any headers or link with hdf5 at this
|
||||
@@ -43,16 +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.
|
||||
have_hdf5 = \
|
||||
conf.env['HAVE_HDF5'] = \
|
||||
conf.CheckLibWithHeader('hdf5', 'hdf5.h', 'C',
|
||||
'H5Fcreate("", 0, 0, 0);') and \
|
||||
conf.CheckLibWithHeader('hdf5_cpp', 'H5Cpp.h', 'C++',
|
||||
'H5::H5File("", 0);')
|
||||
|
||||
if have_hdf5:
|
||||
sticky_vars.Add(BoolVariable('USE_HDF5', 'Enable the HDF5 support', True))
|
||||
else:
|
||||
warning("Couldn't find any HDF5 C++ libraries. Disabling HDF5 support.")
|
||||
main['USE_HDF5'] = False
|
||||
if not conf.env['HAVE_HDF5']:
|
||||
warning("Couldn't find HDF5 C++ libraries. Disabling HDF5 support.")
|
||||
|
||||
export_vars.append('USE_HDF5')
|
||||
export_vars.append('HAVE_HDF5')
|
||||
|
||||
@@ -109,7 +109,7 @@ class EtherTapBase(SimObject):
|
||||
dump = Param.EtherDump(NULL, "dump object")
|
||||
tap = EtherInt("Ethernet interface to connect to gem5's network")
|
||||
|
||||
if buildEnv['USE_TUNTAP']:
|
||||
if buildEnv['HAVE_TUNTAP']:
|
||||
class EtherTap(EtherTapBase):
|
||||
type = 'EtherTap'
|
||||
cxx_header = "dev/net/ethertap.hh"
|
||||
|
||||
@@ -29,14 +29,9 @@ import gem5_scons
|
||||
|
||||
with gem5_scons.Configure(main) as conf:
|
||||
# Check if the TUN/TAP driver is available.
|
||||
have_tuntap = conf.CheckHeader('linux/if_tun.h', '<>')
|
||||
conf.env['HAVE_TUNTAP'] = conf.CheckHeader('linux/if_tun.h', '<>')
|
||||
|
||||
if have_tuntap:
|
||||
sticky_vars.Add(BoolVariable('USE_TUNTAP',
|
||||
'Enable using a tap device to bridge to the host network',
|
||||
True))
|
||||
else:
|
||||
if not main['HAVE_TUNTAP']:
|
||||
print("Info: Compatible header file <linux/if_tun.h> not found.")
|
||||
main['USE_TUNTAP'] = False
|
||||
|
||||
export_vars.append('USE_TUNTAP')
|
||||
export_vars.append('HAVE_TUNTAP')
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
|
||||
#endif
|
||||
|
||||
#if USE_TUNTAP && defined(__linux__)
|
||||
#if HAVE_TUNTAP && defined(__linux__)
|
||||
#if 1 // Hide from the style checker since these have to be out of order.
|
||||
#include <sys/socket.h> // Has to be included before if.h for some reason.
|
||||
|
||||
@@ -395,7 +395,7 @@ EtherTapStub::sendReal(const void *data, size_t len)
|
||||
}
|
||||
|
||||
|
||||
#if USE_TUNTAP
|
||||
#if HAVE_TUNTAP
|
||||
|
||||
EtherTap::EtherTap(const Params &p) : EtherTapBase(p)
|
||||
{
|
||||
|
||||
@@ -37,11 +37,11 @@
|
||||
#include <string>
|
||||
|
||||
#include "base/pollevent.hh"
|
||||
#include "config/use_tuntap.hh"
|
||||
#include "config/have_tuntap.hh"
|
||||
#include "dev/net/etherint.hh"
|
||||
#include "dev/net/etherpkt.hh"
|
||||
|
||||
#if USE_TUNTAP
|
||||
#if HAVE_TUNTAP
|
||||
#include "params/EtherTap.hh"
|
||||
|
||||
#endif
|
||||
@@ -155,7 +155,7 @@ class EtherTapStub : public EtherTapBase
|
||||
};
|
||||
|
||||
|
||||
#if USE_TUNTAP
|
||||
#if HAVE_TUNTAP
|
||||
class EtherTap : public EtherTapBase
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -38,20 +38,20 @@
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "config/use_hdf5.hh"
|
||||
|
||||
#include "pybind11/pybind11.h"
|
||||
#include "pybind11/stl.h"
|
||||
|
||||
#include "base/statistics.hh"
|
||||
#include "base/stats/text.hh"
|
||||
#if USE_HDF5
|
||||
#include "config/have_hdf5.hh"
|
||||
|
||||
#if HAVE_HDF5
|
||||
#include "base/stats/hdf5.hh"
|
||||
|
||||
#endif
|
||||
#include "sim/stat_control.hh"
|
||||
#include "sim/stat_register.hh"
|
||||
|
||||
|
||||
namespace py = pybind11;
|
||||
|
||||
static const py::object
|
||||
@@ -106,7 +106,7 @@ pybind_init_stats(py::module_ &m_native)
|
||||
m
|
||||
.def("initSimStats", &Stats::initSimStats)
|
||||
.def("initText", &Stats::initText, py::return_value_policy::reference)
|
||||
#if USE_HDF5
|
||||
#if HAVE_HDF5
|
||||
.def("initHDF5", &Stats::initHDF5)
|
||||
#endif
|
||||
.def("registerPythonStatsHandlers",
|
||||
|
||||
Reference in New Issue
Block a user