Deprecate '--make cmake' option (#6540)

This commit is contained in:
Geza Lore 2025-10-08 15:40:17 +02:00 committed by GitHub
parent 222a3655ba
commit 49c51af841
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
16 changed files with 55 additions and 45 deletions

View File

@ -20,3 +20,9 @@ C++14 compiler support
XML output XML output
Verilator currently supports XML parser output (enabled with `--xml-only`). Verilator currently supports XML parser output (enabled with `--xml-only`).
Support for `--xml-*` options will be deprecated no sooner than January 2026. Support for `--xml-*` options will be deprecated no sooner than January 2026.
--make cmake
The `--make cmake` options is deprecated and will be removed no sooner than
January 2026. Use `--make json` instead. Note that the CMake integration
shipping with verialtor (verilator-config.mk) alerady uses `--make json` so
no changes are necessary if using taht

View File

@ -42,8 +42,8 @@ For --cc/--sc, it creates:
.. list-table:: .. list-table::
* - *{prefix}*\ .cmake * - *{prefix}*\ .json
- CMake include script for compiling (from --make cmake) - JSON build definition compiling (from --make json)
* - *{prefix}*\ .mk * - *{prefix}*\ .mk
- Make include file for compiling (from --make gmake) - Make include file for compiling (from --make gmake)
* - *{prefix}*\ _classes.mk * - *{prefix}*\ _classes.mk
@ -99,8 +99,8 @@ For --hierarchical mode, it creates:
- Make dependencies of the top module (from --hierarchical) - Make dependencies of the top module (from --hierarchical)
* - *{prefix}*\ _hier.mk * - *{prefix}*\ _hier.mk
- Make file for hierarchical blocks (from --make gmake) - Make file for hierarchical blocks (from --make gmake)
* - *{prefix}*\ __hierCMakeArgs.f * - *{prefix}*\ __hierMkJsonArgs.f
- Arguments for hierarchical Verilation (from --make cmake) - Arguments for hierarchical Verilation (from --make json)
* - *{prefix}*\ __hierMkArgs.f * - *{prefix}*\ __hierMkArgs.f
- Arguments for hierarchical Verilation (from --make gmake) - Arguments for hierarchical Verilation (from --make gmake)
* - *{prefix}*\ __hierParameters.v * - *{prefix}*\ __hierParameters.v

View File

@ -59,7 +59,7 @@ When using these options:
makefiles to generate an archive (.a) containing the objects. makefiles to generate an archive (.a) containing the objects.
#. If :vlopt:`--binary` or :vlopt:`--build` is used, it calls :ref:`GNU #. If :vlopt:`--binary` or :vlopt:`--build` is used, it calls :ref:`GNU
Make` or :ref:`CMake` to build the model. Make` to build the model.
Once a model is built, the next step is typically for the user to run it, Once a model is built, the next step is typically for the user to run it,
see :ref:`Simulating`. see :ref:`Simulating`.

View File

@ -768,7 +768,7 @@ hdr
hdzhangdoc hdzhangdoc
hh hh
hier hier
hierCMakeArgs hierMkJsonArgs
hierMkArgs hierMkArgs
hierParameters hierParameters
hierVer hierVer

View File

@ -102,19 +102,19 @@
VL_DEFINE_DEBUG_FUNCTIONS; VL_DEFINE_DEBUG_FUNCTIONS;
static string V3HierCommandArgsFilename(const string& prefix, bool forCMake) { static string V3HierCommandArgsFilename(const string& prefix, bool forMkJson) {
return v3Global.opt.makeDir() + "/" + prefix return v3Global.opt.makeDir() + "/" + prefix
+ (forCMake ? "__hierCMakeArgs.f" : "__hierMkArgs.f"); + (forMkJson ? "__hierMkJsonArgs.f" : "__hierMkArgs.f");
} }
static string V3HierParametersFileName(const string& prefix) { static string V3HierParametersFileName(const string& prefix) {
return v3Global.opt.makeDir() + "/" + prefix + "__hierParameters.v"; return v3Global.opt.makeDir() + "/" + prefix + "__hierParameters.v";
} }
static void V3HierWriteCommonInputs(const V3HierBlock* hblockp, std::ostream* of, bool forCMake) { static void V3HierWriteCommonInputs(const V3HierBlock* hblockp, std::ostream* of, bool forMkJson) {
string topModuleFile; string topModuleFile;
if (hblockp) topModuleFile = hblockp->vFileIfNecessary(); if (hblockp) topModuleFile = hblockp->vFileIfNecessary();
if (!forCMake) { if (!forMkJson) {
if (!topModuleFile.empty()) *of << topModuleFile << "\n"; if (!topModuleFile.empty()) *of << topModuleFile << "\n";
for (const auto& i : v3Global.opt.vFiles()) *of << i.filename() << "\n"; for (const auto& i : v3Global.opt.vFiles()) *of << i.filename() << "\n";
} }
@ -158,10 +158,10 @@ V3HierBlock::StrGParams V3HierBlock::stringifyParams(const V3HierBlockParams::GP
return strParams; return strParams;
} }
VStringList V3HierBlock::commandArgs(bool forCMake) const { VStringList V3HierBlock::commandArgs(bool forMkJson) const {
VStringList opts; VStringList opts;
const string prefix = hierPrefix(); const string prefix = hierPrefix();
if (!forCMake) { if (!forMkJson) {
opts.push_back(" --prefix " + prefix); opts.push_back(" --prefix " + prefix);
opts.push_back(" --mod-prefix " + prefix); opts.push_back(" --mod-prefix " + prefix);
opts.push_back(" --top-module " + modp()->name()); opts.push_back(" --top-module " + modp()->name());
@ -249,17 +249,17 @@ string V3HierBlock::vFileIfNecessary() const {
return filename; return filename;
} }
void V3HierBlock::writeCommandArgsFile(bool forCMake) const { void V3HierBlock::writeCommandArgsFile(bool forMkJson) const {
const std::unique_ptr<std::ofstream> of{V3File::new_ofstream(commandArgsFilename(forCMake))}; const std::unique_ptr<std::ofstream> of{V3File::new_ofstream(commandArgsFilename(forMkJson))};
*of << "--cc\n"; *of << "--cc\n";
if (!forCMake) { if (!forMkJson) {
for (const V3HierBlock* const hierblockp : m_children) { for (const V3HierBlock* const hierblockp : m_children) {
*of << v3Global.opt.makeDir() << "/" << hierblockp->hierWrapperFilename(true) << "\n"; *of << v3Global.opt.makeDir() << "/" << hierblockp->hierWrapperFilename(true) << "\n";
} }
*of << "-Mdir " << v3Global.opt.makeDir() << "/" << hierPrefix() << " \n"; *of << "-Mdir " << v3Global.opt.makeDir() << "/" << hierPrefix() << " \n";
} }
V3HierWriteCommonInputs(this, of.get(), forCMake); V3HierWriteCommonInputs(this, of.get(), forMkJson);
const VStringList& commandOpts = commandArgs(false); const VStringList& commandOpts = commandArgs(false);
for (const string& opt : commandOpts) *of << opt << "\n"; for (const string& opt : commandOpts) *of << opt << "\n";
*of << hierBlockArgs().front() << "\n"; *of << hierBlockArgs().front() << "\n";
@ -269,8 +269,8 @@ void V3HierBlock::writeCommandArgsFile(bool forCMake) const {
*of << v3Global.opt.allArgsStringForHierBlock(false) << "\n"; *of << v3Global.opt.allArgsStringForHierBlock(false) << "\n";
} }
string V3HierBlock::commandArgsFilename(bool forCMake) const { string V3HierBlock::commandArgsFilename(bool forMkJson) const {
return V3HierCommandArgsFilename(hierPrefix(), forCMake); return V3HierCommandArgsFilename(hierPrefix(), forMkJson);
} }
string V3HierBlock::typeParametersFilename() const { string V3HierBlock::typeParametersFilename() const {
@ -456,21 +456,21 @@ V3HierBlockPlan::HierVector V3HierBlockPlan::hierBlocksSorted() const {
return sorted; return sorted;
} }
void V3HierBlockPlan::writeCommandArgsFiles(bool forCMake) const { void V3HierBlockPlan::writeCommandArgsFiles(bool forMkJson) const {
for (const_iterator it = begin(); it != end(); ++it) { for (const_iterator it = begin(); it != end(); ++it) {
it->second.writeCommandArgsFile(forCMake); it->second.writeCommandArgsFile(forMkJson);
} }
// For the top module // For the top module
const std::unique_ptr<std::ofstream> of{ const std::unique_ptr<std::ofstream> of{
V3File::new_ofstream(topCommandArgsFilename(forCMake))}; V3File::new_ofstream(topCommandArgsFilename(forMkJson))};
if (!forCMake) { if (!forMkJson) {
// Load wrappers first not to be overwritten by the original HDL // Load wrappers first not to be overwritten by the original HDL
for (const_iterator it = begin(); it != end(); ++it) { for (const_iterator it = begin(); it != end(); ++it) {
*of << it->second.hierWrapperFilename(true) << "\n"; *of << it->second.hierWrapperFilename(true) << "\n";
} }
} }
V3HierWriteCommonInputs(nullptr, of.get(), forCMake); V3HierWriteCommonInputs(nullptr, of.get(), forMkJson);
if (!forCMake) { if (!forMkJson) {
const VStringSet& cppFiles = v3Global.opt.cppFiles(); const VStringSet& cppFiles = v3Global.opt.cppFiles();
for (const string& i : cppFiles) *of << i << "\n"; for (const string& i : cppFiles) *of << i << "\n";
*of << "--top-module " << v3Global.rootp()->topModulep()->name() << "\n"; *of << "--top-module " << v3Global.rootp()->topModulep()->name() << "\n";
@ -493,8 +493,8 @@ void V3HierBlockPlan::writeCommandArgsFiles(bool forCMake) const {
*of << v3Global.opt.allArgsStringForHierBlock(true) << "\n"; *of << v3Global.opt.allArgsStringForHierBlock(true) << "\n";
} }
string V3HierBlockPlan::topCommandArgsFilename(bool forCMake) { string V3HierBlockPlan::topCommandArgsFilename(bool forMkJson) {
return V3HierCommandArgsFilename(v3Global.opt.prefix(), forCMake); return V3HierCommandArgsFilename(v3Global.opt.prefix(), forMkJson);
} }
void V3HierBlockPlan::writeParametersFiles() const { void V3HierBlockPlan::writeParametersFiles() const {

View File

@ -99,8 +99,8 @@ public:
const V3HierBlockParams& params() const { return m_params; } const V3HierBlockParams& params() const { return m_params; }
const AstNodeModule* modp() const { return m_modp; } const AstNodeModule* modp() const { return m_modp; }
// For emitting Makefile and CMakeLists.txt // For emitting Makefile and build definition JSON
VStringList commandArgs(bool forCMake) const VL_MT_DISABLED; VStringList commandArgs(bool forMkJson) const VL_MT_DISABLED;
VStringList hierBlockArgs() const VL_MT_DISABLED; VStringList hierBlockArgs() const VL_MT_DISABLED;
string hierPrefix() const VL_MT_DISABLED; string hierPrefix() const VL_MT_DISABLED;
string hierSomeFilename(bool withDir, const char* prefix, string hierSomeFilename(bool withDir, const char* prefix,
@ -112,9 +112,9 @@ public:
// Returns the original HDL file if it is not included in v3Global.opt.vFiles(). // Returns the original HDL file if it is not included in v3Global.opt.vFiles().
string vFileIfNecessary() const VL_MT_DISABLED; string vFileIfNecessary() const VL_MT_DISABLED;
// Write command line arguments to .f file for this hierarchical block // Write command line arguments to .f file for this hierarchical block
void writeCommandArgsFile(bool forCMake) const VL_MT_DISABLED; void writeCommandArgsFile(bool forMkJson) const VL_MT_DISABLED;
void writeParametersFile() const VL_MT_DISABLED; void writeParametersFile() const VL_MT_DISABLED;
string commandArgsFilename(bool forCMake) const VL_MT_DISABLED; string commandArgsFilename(bool forMkJson) const VL_MT_DISABLED;
string typeParametersFilename() const VL_MT_DISABLED; string typeParametersFilename() const VL_MT_DISABLED;
}; };
@ -146,9 +146,9 @@ public:
HierVector hierBlocksSorted() const VL_MT_DISABLED; HierVector hierBlocksSorted() const VL_MT_DISABLED;
// Write command line arguments to .f files for child Verilation run // Write command line arguments to .f files for child Verilation run
void writeCommandArgsFiles(bool forCMake) const VL_MT_DISABLED; void writeCommandArgsFiles(bool forMkJson) const VL_MT_DISABLED;
void writeParametersFiles() const VL_MT_DISABLED; void writeParametersFiles() const VL_MT_DISABLED;
static string topCommandArgsFilename(bool forCMake) VL_MT_DISABLED; static string topCommandArgsFilename(bool forMkJson) VL_MT_DISABLED;
static void createPlan(AstNetlist* nodep) VL_MT_DISABLED; static void createPlan(AstNetlist* nodep) VL_MT_DISABLED;
}; };

View File

@ -1520,6 +1520,8 @@ void V3Options::parseOptsList(FileLine* fl, const string& optdir, int argc,
DECL_OPTION("-make", CbVal, [this, fl](const char* valp) { DECL_OPTION("-make", CbVal, [this, fl](const char* valp) {
if (!std::strcmp(valp, "cmake")) { if (!std::strcmp(valp, "cmake")) {
m_cmake = true; m_cmake = true;
fl->v3warn(DEPRECATED,
"Option '--make cmake' is deprecated, use '--make json' instead");
} else if (!std::strcmp(valp, "gmake")) { } else if (!std::strcmp(valp, "gmake")) {
m_gmake = true; m_gmake = true;
} else if (!std::strcmp(valp, "json")) { } else if (!std::strcmp(valp, "json")) {

View File

@ -819,6 +819,7 @@ static void execBuildJob() {
UASSERT(v3Global.opt.build(), "--build is not specified."); UASSERT(v3Global.opt.build(), "--build is not specified.");
UASSERT(v3Global.opt.gmake(), "--build requires GNU Make."); UASSERT(v3Global.opt.gmake(), "--build requires GNU Make.");
UASSERT(!v3Global.opt.cmake(), "--build cannot use CMake."); UASSERT(!v3Global.opt.cmake(), "--build cannot use CMake.");
UASSERT(!v3Global.opt.makeJson(), "--build cannot use json build.");
VlOs::DeltaWallTime buildWallTime{true}; VlOs::DeltaWallTime buildWallTime{true};
UINFO(1, "Start Build"); UINFO(1, "Start Build");

View File

@ -1077,10 +1077,6 @@ class VlTest:
verilator_flags += ["--threads", str(param['threads'])] verilator_flags += ["--threads", str(param['threads'])]
if param['vltmt'] and re.search(r'-trace-fst ', checkflags): if param['vltmt'] and re.search(r'-trace-fst ', checkflags):
verilator_flags += ["--trace-threads 2"] verilator_flags += ["--trace-threads 2"]
if param['verilator_make_cmake']:
verilator_flags += ["--make cmake"]
if param['verilator_make_gmake']:
verilator_flags += ["--make gmake"]
if param['make_main'] and param['verilator_make_gmake']: if param['make_main'] and param['verilator_make_gmake']:
verilator_flags += ["--exe"] verilator_flags += ["--exe"]
if param['make_main'] and param['verilator_make_gmake']: if param['make_main'] and param['verilator_make_gmake']:

View File

@ -15,7 +15,11 @@ test.compile(verilator_flags2=["--build --make gmake"],
fails=True, fails=True,
expect_filename=test.golden_filename) expect_filename=test.golden_filename)
test.compile(verilator_flags2=["--build --make cmake"], test.compile(verilator_flags2=["--build --make cmake -Wno-fatal"],
fails=True,
expect_filename="t/t_flag_build_bad_cmake.out")
test.compile(verilator_flags2=["--build --make json"],
fails=True, fails=True,
expect_filename=test.golden_filename) expect_filename=test.golden_filename)

View File

@ -0,0 +1,6 @@
%Warning-DEPRECATED: Option '--make cmake' is deprecated, use '--make json' instead
... For warning description see https://verilator.org/warn/DEPRECATED?v=latest
... Use "/* verilator lint_off DEPRECATED */" and lint_on around source to disable this message.
%Error: --make cannot be used together with --build. Suggest see manual
... See the manual at https://verilator.org/verilator_doc.html?v=latest for more assistance.
%Error: Exiting due to

View File

@ -13,9 +13,6 @@ test.scenarios('simulator')
test.compile(verilator_make_gmake=False, verilator_make_cmake=True) test.compile(verilator_make_gmake=False, verilator_make_cmake=True)
if not test.have_cmake:
test.skip("cmake is not installed")
cmakecache = test.obj_dir + "/CMakeCache.txt" cmakecache = test.obj_dir + "/CMakeCache.txt"
if not os.path.exists(cmakecache): if not os.path.exists(cmakecache):
test.error(cmakecache + " does not exist") test.error(cmakecache + " does not exist")

View File

@ -12,7 +12,7 @@ import vltest_bootstrap
test.scenarios('simulator') test.scenarios('simulator')
test.top_filename = "t/t_probdist.v" test.top_filename = "t/t_probdist.v"
test.compile(verilator_make_gmake=False, verilator_make_cmake=1) test.compile(verilator_make_gmake=False, verilator_make_cmake=True)
test.execute() test.execute()

View File

@ -14,8 +14,6 @@ test.top_filename = "t/t_timing_events.v"
if not test.have_coroutines: if not test.have_coroutines:
test.skip("No coroutine support") test.skip("No coroutine support")
if not test.have_cmake:
test.skip("cmake is not installed")
if re.search(r'clang', test.cxx_version): if re.search(r'clang', test.cxx_version):
test.skip("Known clang bug on ubuntu-24.04") test.skip("Known clang bug on ubuntu-24.04")

View File

@ -11,7 +11,7 @@ import vltest_bootstrap
test.scenarios('vlt_all') test.scenarios('vlt_all')
test.compile(v_flags2=["--trace-fst"], verilator_make_gmake=False, verilator_make_cmake=1) test.compile(v_flags2=["--trace-fst"], verilator_make_gmake=False, verilator_make_cmake=True)
test.execute() test.execute()

View File

@ -16,7 +16,7 @@ if not test.have_sc:
test.compile(verilator_flags2=["--trace-fst --sc"], test.compile(verilator_flags2=["--trace-fst --sc"],
verilator_make_gmake=False, verilator_make_gmake=False,
verilator_make_cmake=1) verilator_make_cmake=True)
test.execute() test.execute()