Fix make flows to pass PYTHON3 (like perl) (#5307) (#5308)

Fixes #5307
This commit is contained in:
Markus Krause 2024-07-26 15:35:37 +02:00 committed by GitHub
parent 2082f1aa9e
commit a01a21db86
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 18 additions and 3 deletions

View File

@ -45,6 +45,7 @@ Verilator 5.027 devel
* Fix elaborating foreach loops (#5285). [Arkadiusz Kozdra, Antmicro Ltd.]
* Fix initializing static array in dynamic arrays and queues (#5287). [Baruch Sterin]
* Fix randomizing current object with `rand` class instance member (#5292). [Krzysztof Bieganski, Antmicro Ltd.]
* Fix Python3 path discovery in make flows to avoid mixing system and user python interpreters (#5307) [Markus Krause]
Verilator 5.026 2024-06-15

View File

@ -81,7 +81,10 @@ class CMakeEmitter final {
*of << "\n### Constants...\n";
cmake_set(*of, "PERL", V3OutFormatter::quoteNameControls(V3Options::getenvPERL()),
"FILEPATH", "Perl executable (from $PERL)");
"FILEPATH", "Perl executable (from $PERL, defaults to 'perl' if not set)");
cmake_set(*of, "PYTHON3", V3OutFormatter::quoteNameControls(V3Options::getenvPYTHON3()),
"FILEPATH",
"Python3 executable (from $PYTHON3, defaults to 'python3' if not set)");
cmake_set(*of, "VERILATOR_ROOT",
V3OutFormatter::quoteNameControls(V3Options::getenvVERILATOR_ROOT()), "PATH",
"Path to Verilator kit (from $VERILATOR_ROOT)");

View File

@ -151,8 +151,11 @@ public:
of.puts("default: lib" + v3Global.opt.prefix() + "\n");
}
of.puts("\n### Constants...\n");
of.puts("# Perl executable (from $PERL)\n");
of.puts("# Perl executable (from $PERL, defaults to 'perl' if not set)\n");
of.puts("PERL = " + V3OutFormatter::quoteNameControls(V3Options::getenvPERL()) + "\n");
of.puts("# Python3 executable (from $PYTHON3, defaults to 'python3' if not set)\n");
of.puts("PYTHON3 = " + V3OutFormatter::quoteNameControls(V3Options::getenvPYTHON3())
+ "\n");
of.puts("# Path to Verilator kit (from $VERILATOR_ROOT)\n");
of.puts("VERILATOR_ROOT = "
+ V3OutFormatter::quoteNameControls(V3Options::getenvVERILATOR_ROOT()) + "\n");

View File

@ -637,6 +637,8 @@ string V3Options::getenvBuiltins(const string& var) {
return getenvMAKE();
} else if (var == "PERL") {
return getenvPERL();
} else if (var == "PYTHON3") {
return getenvPYTHON3();
} else if (var == "SYSTEMC") {
return getenvSYSTEMC();
} else if (var == "SYSTEMC_ARCH") {
@ -666,6 +668,10 @@ string V3Options::getenvPERL() { //
return V3Os::filenameCleanup(V3Os::getenvStr("PERL", "perl"));
}
string V3Options::getenvPYTHON3() { //
return V3Os::filenameCleanup(V3Os::getenvStr("PYTHON3", "python3"));
}
string V3Options::getenvSYSTEMC() {
string var = V3Os::getenvStr("SYSTEMC", "");
// Treat compiled-in DEFENV string literals as C-strings to enable
@ -1955,6 +1961,7 @@ void V3Options::showVersion(bool verbose) {
cout << "Environment:\n";
cout << " MAKE = " << V3Os::getenvStr("MAKE", "") << "\n";
cout << " PERL = " << V3Os::getenvStr("PERL", "") << "\n";
cout << " PYTHON3 = " << V3Os::getenvStr("PYTHON3", "") << "\n";
cout << " SYSTEMC = " << V3Os::getenvStr("SYSTEMC", "") << "\n";
cout << " SYSTEMC_ARCH = " << V3Os::getenvStr("SYSTEMC_ARCH", "") << "\n";
cout << " SYSTEMC_INCLUDE = " << V3Os::getenvStr("SYSTEMC_INCLUDE", "") << "\n";

View File

@ -720,6 +720,7 @@ public:
static string getenvMAKE();
static string getenvMAKEFLAGS();
static string getenvPERL();
static string getenvPYTHON3();
static string getenvSYSTEMC();
static string getenvSYSTEMC_ARCH();
static string getenvSYSTEMC_INCLUDE();

View File

@ -20,7 +20,7 @@ run(
verilator_run => 1,
);
foreach my $var (qw(MAKE PERL SYSTEMC SYSTEMC_ARCH SYSTEMC_LIBDIR VERILATOR_ROOT)) {
foreach my $var (qw(MAKE PERL PYTHON3 SYSTEMC SYSTEMC_ARCH SYSTEMC_LIBDIR VERILATOR_ROOT)) {
run(
cmd => ["$ENV{VERILATOR_ROOT}/bin/verilator --getenv ${var}"],
logfile => "$Self->{obj_dir}/simx.log",