From 49c51af841532f3d495da3ad5a7cc0b5dbdc4b8b Mon Sep 17 00:00:00 2001 From: Geza Lore Date: Wed, 8 Oct 2025 15:40:17 +0200 Subject: [PATCH] Deprecate '--make cmake' option (#6540) --- docs/guide/deprecations.rst | 6 ++++ docs/guide/files.rst | 8 ++--- docs/guide/verilating.rst | 2 +- docs/spelling.txt | 2 +- src/V3HierBlock.cpp | 40 +++++++++++------------ src/V3HierBlock.h | 12 +++---- src/V3Options.cpp | 2 ++ src/Verilator.cpp | 1 + test_regress/driver.py | 4 --- test_regress/t/t_flag_build_bad.py | 6 +++- test_regress/t/t_flag_build_bad_cmake.out | 6 ++++ test_regress/t/t_flag_make_cmake.py | 3 -- test_regress/t/t_probdist_cmake.py | 2 +- test_regress/t/t_timing_cmake.py | 2 -- test_regress/t/t_trace_fst_cmake.py | 2 +- test_regress/t/t_trace_fst_sc_cmake.py | 2 +- 16 files changed, 55 insertions(+), 45 deletions(-) create mode 100644 test_regress/t/t_flag_build_bad_cmake.out diff --git a/docs/guide/deprecations.rst b/docs/guide/deprecations.rst index 130197f18..c1e82e560 100644 --- a/docs/guide/deprecations.rst +++ b/docs/guide/deprecations.rst @@ -20,3 +20,9 @@ C++14 compiler support XML output Verilator currently supports XML parser output (enabled with `--xml-only`). 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 diff --git a/docs/guide/files.rst b/docs/guide/files.rst index e04323ad9..85e46c3e5 100644 --- a/docs/guide/files.rst +++ b/docs/guide/files.rst @@ -42,8 +42,8 @@ For --cc/--sc, it creates: .. list-table:: - * - *{prefix}*\ .cmake - - CMake include script for compiling (from --make cmake) + * - *{prefix}*\ .json + - JSON build definition compiling (from --make json) * - *{prefix}*\ .mk - Make include file for compiling (from --make gmake) * - *{prefix}*\ _classes.mk @@ -99,8 +99,8 @@ For --hierarchical mode, it creates: - Make dependencies of the top module (from --hierarchical) * - *{prefix}*\ _hier.mk - Make file for hierarchical blocks (from --make gmake) - * - *{prefix}*\ __hierCMakeArgs.f - - Arguments for hierarchical Verilation (from --make cmake) + * - *{prefix}*\ __hierMkJsonArgs.f + - Arguments for hierarchical Verilation (from --make json) * - *{prefix}*\ __hierMkArgs.f - Arguments for hierarchical Verilation (from --make gmake) * - *{prefix}*\ __hierParameters.v diff --git a/docs/guide/verilating.rst b/docs/guide/verilating.rst index cc8caadc6..af0b8df25 100644 --- a/docs/guide/verilating.rst +++ b/docs/guide/verilating.rst @@ -59,7 +59,7 @@ When using these options: makefiles to generate an archive (.a) containing the objects. #. 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, see :ref:`Simulating`. diff --git a/docs/spelling.txt b/docs/spelling.txt index 00c7f9aa6..f05654a9c 100644 --- a/docs/spelling.txt +++ b/docs/spelling.txt @@ -768,7 +768,7 @@ hdr hdzhangdoc hh hier -hierCMakeArgs +hierMkJsonArgs hierMkArgs hierParameters hierVer diff --git a/src/V3HierBlock.cpp b/src/V3HierBlock.cpp index 038ec1ae3..81a2fe807 100644 --- a/src/V3HierBlock.cpp +++ b/src/V3HierBlock.cpp @@ -102,19 +102,19 @@ 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 - + (forCMake ? "__hierCMakeArgs.f" : "__hierMkArgs.f"); + + (forMkJson ? "__hierMkJsonArgs.f" : "__hierMkArgs.f"); } static string V3HierParametersFileName(const string& prefix) { 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; if (hblockp) topModuleFile = hblockp->vFileIfNecessary(); - if (!forCMake) { + if (!forMkJson) { if (!topModuleFile.empty()) *of << topModuleFile << "\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; } -VStringList V3HierBlock::commandArgs(bool forCMake) const { +VStringList V3HierBlock::commandArgs(bool forMkJson) const { VStringList opts; const string prefix = hierPrefix(); - if (!forCMake) { + if (!forMkJson) { opts.push_back(" --prefix " + prefix); opts.push_back(" --mod-prefix " + prefix); opts.push_back(" --top-module " + modp()->name()); @@ -249,17 +249,17 @@ string V3HierBlock::vFileIfNecessary() const { return filename; } -void V3HierBlock::writeCommandArgsFile(bool forCMake) const { - const std::unique_ptr of{V3File::new_ofstream(commandArgsFilename(forCMake))}; +void V3HierBlock::writeCommandArgsFile(bool forMkJson) const { + const std::unique_ptr of{V3File::new_ofstream(commandArgsFilename(forMkJson))}; *of << "--cc\n"; - if (!forCMake) { + if (!forMkJson) { for (const V3HierBlock* const hierblockp : m_children) { *of << v3Global.opt.makeDir() << "/" << hierblockp->hierWrapperFilename(true) << "\n"; } *of << "-Mdir " << v3Global.opt.makeDir() << "/" << hierPrefix() << " \n"; } - V3HierWriteCommonInputs(this, of.get(), forCMake); + V3HierWriteCommonInputs(this, of.get(), forMkJson); const VStringList& commandOpts = commandArgs(false); for (const string& opt : commandOpts) *of << opt << "\n"; *of << hierBlockArgs().front() << "\n"; @@ -269,8 +269,8 @@ void V3HierBlock::writeCommandArgsFile(bool forCMake) const { *of << v3Global.opt.allArgsStringForHierBlock(false) << "\n"; } -string V3HierBlock::commandArgsFilename(bool forCMake) const { - return V3HierCommandArgsFilename(hierPrefix(), forCMake); +string V3HierBlock::commandArgsFilename(bool forMkJson) const { + return V3HierCommandArgsFilename(hierPrefix(), forMkJson); } string V3HierBlock::typeParametersFilename() const { @@ -456,21 +456,21 @@ V3HierBlockPlan::HierVector V3HierBlockPlan::hierBlocksSorted() const { return sorted; } -void V3HierBlockPlan::writeCommandArgsFiles(bool forCMake) const { +void V3HierBlockPlan::writeCommandArgsFiles(bool forMkJson) const { for (const_iterator it = begin(); it != end(); ++it) { - it->second.writeCommandArgsFile(forCMake); + it->second.writeCommandArgsFile(forMkJson); } // For the top module const std::unique_ptr of{ - V3File::new_ofstream(topCommandArgsFilename(forCMake))}; - if (!forCMake) { + V3File::new_ofstream(topCommandArgsFilename(forMkJson))}; + if (!forMkJson) { // Load wrappers first not to be overwritten by the original HDL for (const_iterator it = begin(); it != end(); ++it) { *of << it->second.hierWrapperFilename(true) << "\n"; } } - V3HierWriteCommonInputs(nullptr, of.get(), forCMake); - if (!forCMake) { + V3HierWriteCommonInputs(nullptr, of.get(), forMkJson); + if (!forMkJson) { const VStringSet& cppFiles = v3Global.opt.cppFiles(); for (const string& i : cppFiles) *of << i << "\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"; } -string V3HierBlockPlan::topCommandArgsFilename(bool forCMake) { - return V3HierCommandArgsFilename(v3Global.opt.prefix(), forCMake); +string V3HierBlockPlan::topCommandArgsFilename(bool forMkJson) { + return V3HierCommandArgsFilename(v3Global.opt.prefix(), forMkJson); } void V3HierBlockPlan::writeParametersFiles() const { diff --git a/src/V3HierBlock.h b/src/V3HierBlock.h index ddee89738..2666ce718 100644 --- a/src/V3HierBlock.h +++ b/src/V3HierBlock.h @@ -99,8 +99,8 @@ public: const V3HierBlockParams& params() const { return m_params; } const AstNodeModule* modp() const { return m_modp; } - // For emitting Makefile and CMakeLists.txt - VStringList commandArgs(bool forCMake) const VL_MT_DISABLED; + // For emitting Makefile and build definition JSON + VStringList commandArgs(bool forMkJson) const VL_MT_DISABLED; VStringList hierBlockArgs() const VL_MT_DISABLED; string hierPrefix() const VL_MT_DISABLED; 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(). string vFileIfNecessary() const VL_MT_DISABLED; // 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; - string commandArgsFilename(bool forCMake) const VL_MT_DISABLED; + string commandArgsFilename(bool forMkJson) const VL_MT_DISABLED; string typeParametersFilename() const VL_MT_DISABLED; }; @@ -146,9 +146,9 @@ public: HierVector hierBlocksSorted() const VL_MT_DISABLED; // 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; - static string topCommandArgsFilename(bool forCMake) VL_MT_DISABLED; + static string topCommandArgsFilename(bool forMkJson) VL_MT_DISABLED; static void createPlan(AstNetlist* nodep) VL_MT_DISABLED; }; diff --git a/src/V3Options.cpp b/src/V3Options.cpp index 7fdb162cd..b5b233f39 100644 --- a/src/V3Options.cpp +++ b/src/V3Options.cpp @@ -1520,6 +1520,8 @@ void V3Options::parseOptsList(FileLine* fl, const string& optdir, int argc, DECL_OPTION("-make", CbVal, [this, fl](const char* valp) { if (!std::strcmp(valp, "cmake")) { m_cmake = true; + fl->v3warn(DEPRECATED, + "Option '--make cmake' is deprecated, use '--make json' instead"); } else if (!std::strcmp(valp, "gmake")) { m_gmake = true; } else if (!std::strcmp(valp, "json")) { diff --git a/src/Verilator.cpp b/src/Verilator.cpp index 6f5907bec..7b752c98a 100644 --- a/src/Verilator.cpp +++ b/src/Verilator.cpp @@ -819,6 +819,7 @@ static void execBuildJob() { UASSERT(v3Global.opt.build(), "--build is not specified."); UASSERT(v3Global.opt.gmake(), "--build requires GNU Make."); UASSERT(!v3Global.opt.cmake(), "--build cannot use CMake."); + UASSERT(!v3Global.opt.makeJson(), "--build cannot use json build."); VlOs::DeltaWallTime buildWallTime{true}; UINFO(1, "Start Build"); diff --git a/test_regress/driver.py b/test_regress/driver.py index 83264817e..d6914fdb8 100755 --- a/test_regress/driver.py +++ b/test_regress/driver.py @@ -1077,10 +1077,6 @@ class VlTest: verilator_flags += ["--threads", str(param['threads'])] if param['vltmt'] and re.search(r'-trace-fst ', checkflags): 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']: verilator_flags += ["--exe"] if param['make_main'] and param['verilator_make_gmake']: diff --git a/test_regress/t/t_flag_build_bad.py b/test_regress/t/t_flag_build_bad.py index 6161025f1..5bfed0801 100755 --- a/test_regress/t/t_flag_build_bad.py +++ b/test_regress/t/t_flag_build_bad.py @@ -15,7 +15,11 @@ test.compile(verilator_flags2=["--build --make gmake"], fails=True, 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, expect_filename=test.golden_filename) diff --git a/test_regress/t/t_flag_build_bad_cmake.out b/test_regress/t/t_flag_build_bad_cmake.out new file mode 100644 index 000000000..690010506 --- /dev/null +++ b/test_regress/t/t_flag_build_bad_cmake.out @@ -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 diff --git a/test_regress/t/t_flag_make_cmake.py b/test_regress/t/t_flag_make_cmake.py index 1802450e1..da3b67fa1 100755 --- a/test_regress/t/t_flag_make_cmake.py +++ b/test_regress/t/t_flag_make_cmake.py @@ -13,9 +13,6 @@ test.scenarios('simulator') 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" if not os.path.exists(cmakecache): test.error(cmakecache + " does not exist") diff --git a/test_regress/t/t_probdist_cmake.py b/test_regress/t/t_probdist_cmake.py index 3dba41365..db9e11c29 100755 --- a/test_regress/t/t_probdist_cmake.py +++ b/test_regress/t/t_probdist_cmake.py @@ -12,7 +12,7 @@ import vltest_bootstrap test.scenarios('simulator') 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() diff --git a/test_regress/t/t_timing_cmake.py b/test_regress/t/t_timing_cmake.py index ec436bda4..b14b62754 100755 --- a/test_regress/t/t_timing_cmake.py +++ b/test_regress/t/t_timing_cmake.py @@ -14,8 +14,6 @@ test.top_filename = "t/t_timing_events.v" if not test.have_coroutines: test.skip("No coroutine support") -if not test.have_cmake: - test.skip("cmake is not installed") if re.search(r'clang', test.cxx_version): test.skip("Known clang bug on ubuntu-24.04") diff --git a/test_regress/t/t_trace_fst_cmake.py b/test_regress/t/t_trace_fst_cmake.py index 8e70813e5..bb960e236 100755 --- a/test_regress/t/t_trace_fst_cmake.py +++ b/test_regress/t/t_trace_fst_cmake.py @@ -11,7 +11,7 @@ import vltest_bootstrap 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() diff --git a/test_regress/t/t_trace_fst_sc_cmake.py b/test_regress/t/t_trace_fst_sc_cmake.py index b5d8f5f0e..29dd1e13f 100755 --- a/test_regress/t/t_trace_fst_sc_cmake.py +++ b/test_regress/t/t_trace_fst_sc_cmake.py @@ -16,7 +16,7 @@ if not test.have_sc: test.compile(verilator_flags2=["--trace-fst --sc"], verilator_make_gmake=False, - verilator_make_cmake=1) + verilator_make_cmake=True) test.execute()