From 40cf3c4b16e7e008307c2f2596f569f7ea5f9adb Mon Sep 17 00:00:00 2001 From: Wilson Snyder Date: Thu, 1 Jan 2026 09:27:20 -0500 Subject: [PATCH] Remove deprecated `--make cmake`. --- Changes | 3 +- docs/guide/deprecations.rst | 6 - docs/guide/exe_verilator.rst | 8 +- src/CMakeLists.txt | 2 - src/Makefile_obj.in | 1 - src/V3EmitCMake.cpp | 241 ---------------------- src/V3EmitCMake.h | 30 --- src/V3Options.cpp | 10 +- src/V3Options.h | 2 - src/Verilator.cpp | 9 +- test_regress/t/t_flag_build_bad.py | 4 - test_regress/t/t_flag_build_bad_cmake.out | 6 - 12 files changed, 12 insertions(+), 310 deletions(-) delete mode 100644 src/V3EmitCMake.cpp delete mode 100644 src/V3EmitCMake.h delete mode 100644 test_regress/t/t_flag_build_bad_cmake.out diff --git a/Changes b/Changes index a27ded2de..e7ac03f55 100644 --- a/Changes +++ b/Changes @@ -13,7 +13,8 @@ Verilator 5.045 devel **Other:** -* Remove `--xml-only`. +* Remove deprecated `--xml-only`. +* Remove deprecated `--make cmake`. Verilator 5.044 2026-01-01 diff --git a/docs/guide/deprecations.rst b/docs/guide/deprecations.rst index edeb4201e..050975a4f 100644 --- a/docs/guide/deprecations.rst +++ b/docs/guide/deprecations.rst @@ -16,9 +16,3 @@ C++14 compiler support (Although this date has expired, this change is currently on hold until the Ubuntu LTS versions of GCC and clang use C++20 by default, estimated May 2028.) - -`--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 Verilator (verilator-config.mk) already uses - `--make json` so no changes are necessary if using that. diff --git a/docs/guide/exe_verilator.rst b/docs/guide/exe_verilator.rst index c5e2aeb6d..60057de32 100644 --- a/docs/guide/exe_verilator.rst +++ b/docs/guide/exe_verilator.rst @@ -1069,8 +1069,12 @@ Summary: Generates a script for the specified build tool. - Supported values are ``gmake`` for GNU Make, or ``cmake`` for CMake, or - ``json`` to create a JSON file to feed other build tools. + Supported values are ``gmake`` for GNU Make, or ``json`` to create a + JSON file to feed other build tools. + + Verilator also supports building with CMake, but CMakeLists.txt + under-the-covers uses the ``--make json`` output format. There was a + native ``--make cmake`` but it was removed in Version 5.046. Multiple options can be specified together. If no build tool is specified, gmake is assumed. The executable of gmake can be configured diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index a69bcd640..8bcf9077d 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -90,7 +90,6 @@ set(HEADERS V3EmitCConstInit.h V3EmitCFunc.h V3EmitCMain.h - V3EmitCMake.h V3EmitMk.h V3EmitMkJson.h V3EmitV.h @@ -260,7 +259,6 @@ set(COMMON_SOURCES V3EmitCImp.cpp V3EmitCInlines.cpp V3EmitCMain.cpp - V3EmitCMake.cpp V3EmitCModel.cpp V3EmitCPch.cpp V3EmitCSyms.cpp diff --git a/src/Makefile_obj.in b/src/Makefile_obj.in index 9c8e51560..b21fdd7a1 100644 --- a/src/Makefile_obj.in +++ b/src/Makefile_obj.in @@ -271,7 +271,6 @@ RAW_OBJS_PCH_ASTNOMT = \ V3DiagSarif.o \ V3DupFinder.o \ V3EmitCMain.o \ - V3EmitCMake.o \ V3EmitCModel.o \ V3EmitCSyms.o \ V3EmitMk.o \ diff --git a/src/V3EmitCMake.cpp b/src/V3EmitCMake.cpp deleted file mode 100644 index c1ebc8359..000000000 --- a/src/V3EmitCMake.cpp +++ /dev/null @@ -1,241 +0,0 @@ -// -*- mode: C++; c-file-style: "cc-mode" -*- -//************************************************************************* -// DESCRIPTION: Verilator: Emit CMake file list -// -// Code available from: https://verilator.org -// -//************************************************************************* -// -// Copyright 2004-2026 by Wilson Snyder. This program is free software; you -// can redistribute it and/or modify it under the terms of either the GNU -// Lesser General Public License Version 3 or the Perl Artistic License -// Version 2.0. -// SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0 -// -//************************************************************************* - -#include "V3PchAstNoMT.h" // VL_MT_DISABLED_CODE_UNIT - -#include "V3EmitCMake.h" - -#include "V3EmitCBase.h" -#include "V3HierBlock.h" -#include "V3Os.h" - -#include - -VL_DEFINE_DEBUG_FUNCTIONS; - -// TODO: this file is completely uncovered by tests - -// ###################################################################### -// Emit statements - -class CMakeEmitter final { - - // METHODS - - // STATIC FUNCTIONS - - // Concatenate all strings in 'strs' with ' ' between them. - template - static string cmake_list(const T_List& strs) { - string s; - for (const std::string& itr : strs) { - if (!s.empty()) s += ' '; - s += '"'; - s += V3OutFormatter::quoteNameControls(itr); - s += '"'; - } - return s; - } - static string cmake_list(const VFileLibList& strs) { - string s; - for (const VFileLibName& itr : strs) { - if (!s.empty()) s += ' '; - s += '"'; - s += V3OutFormatter::quoteNameControls(itr.filename()); - s += '"'; - } - return s; - } - - // Print CMake variable set command: output raw_value unmodified - // cache_type should be empty for a normal variable - // "BOOL", "FILEPATH", "PATH", "STRING" or "INTERNAL" for a CACHE variable - // See https://cmake.org/cmake/help/latest/command/set.html - static void cmake_set_raw(std::ofstream& of, const string& name, const string& raw_value, - const string& cache_type = "", const string& docstring = "") { - of << "set(" << name << " " << raw_value; - if (!cache_type.empty()) of << " CACHE " << cache_type << " \"" << docstring << '"'; - of << ")\n"; - } - - static void cmake_set(std::ofstream& of, const string& name, const string& value, - const string& cache_type = "", const string& docstring = "") { - const string raw_value = '"' + value + '"'; - cmake_set_raw(of, name, raw_value, cache_type, docstring); - } - - static void emitOverallCMake() { - const std::unique_ptr of{ - V3File::new_ofstream(v3Global.opt.makeDir() + "/" + v3Global.opt.prefix() + ".cmake")}; - const string name = v3Global.opt.prefix(); - - *of << "# Verilated -*- CMake -*-\n"; - *of << "# DESCR" - "IPTION: Verilator output: CMake include script with class lists\n"; - *of << "#\n"; - *of << "# This CMake script lists generated Verilated files, for " - "including in higher level CMake scripts.\n"; - *of << "# This file is meant to be consumed by the verilate() function,\n"; - *of << "# which becomes available after executing `find_package(verilator).\n"; - - *of << "\n### Constants...\n"; - cmake_set(*of, "PERL", V3OutFormatter::quoteNameControls(V3Options::getenvPERL()), - "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)"); - cmake_set(*of, "VERILATOR_SOLVER", - V3OutFormatter::quoteNameControls(V3Options::getenvVERILATOR_SOLVER()), "STRING", - "Default SMT solver for constrained randomization (from $VERILATOR_SOLVER)"); - - *of << "\n### Compiler flags...\n"; - - *of << "# User CFLAGS (from -CFLAGS on Verilator command line)\n"; - cmake_set_raw(*of, name + "_USER_CFLAGS", cmake_list(v3Global.opt.cFlags())); - - *of << "# User LDLIBS (from -LDFLAGS on Verilator command line)\n"; - cmake_set_raw(*of, name + "_USER_LDLIBS", cmake_list(v3Global.opt.ldLibs())); - - *of << "\n### Switches...\n"; - - *of << "# SystemC output mode? 0/1 (from --sc)\n"; - cmake_set_raw(*of, name + "_SC", v3Global.opt.systemC() ? "1" : "0"); - *of << "# Coverage output mode? 0/1 (from --coverage)\n"; - cmake_set_raw(*of, name + "_COVERAGE", v3Global.opt.coverage() ? "1" : "0"); - *of << "# Timing mode? 0/1\n"; - cmake_set_raw(*of, name + "_TIMING", v3Global.usesTiming() ? "1" : "0"); - *of << "# Threaded output mode? 1/N threads (from --threads)\n"; - cmake_set_raw(*of, name + "_THREADS", cvtToStr(v3Global.opt.threads())); - *of << "# FST Tracing output mode? 0/1 (from --trace-fst)\n"; - cmake_set_raw(*of, name + "_TRACE_FST", (v3Global.opt.traceEnabledFst()) ? "1" : "0"); - *of << "# SAIF Tracing output mode? 0/1 (from --trace-saif)\n"; - cmake_set_raw(*of, name + "_TRACE_SAIF", (v3Global.opt.traceEnabledSaif()) ? "1" : "0"); - *of << "# VCD Tracing output mode? 0/1 (from --trace-vcd)\n"; - cmake_set_raw(*of, name + "_TRACE_VCD", (v3Global.opt.traceEnabledVcd()) ? "1" : "0"); - - *of << "\n### Sources...\n"; - std::vector classes_fast; - std::vector classes_slow; - std::vector support_fast; - std::vector support_slow; - std::vector global; - for (AstNodeFile* nodep = v3Global.rootp()->filesp(); nodep; - nodep = VN_AS(nodep->nextp(), NodeFile)) { - const AstCFile* const cfilep = VN_CAST(nodep, CFile); - if (cfilep && cfilep->source()) { - if (cfilep->support()) { - if (cfilep->slow()) { - support_slow.push_back(cfilep->name()); - } else { - support_fast.push_back(cfilep->name()); - } - } else { - if (cfilep->slow()) { - classes_slow.push_back(cfilep->name()); - } else { - classes_fast.push_back(cfilep->name()); - } - } - } - } - - for (const string& cpp : v3Global.verilatedCppFiles()) - global.emplace_back("${VERILATOR_ROOT}/include/"s + cpp); - - if (!v3Global.opt.libCreate().empty()) { - global.emplace_back(v3Global.opt.makeDir() + "/" + v3Global.opt.libCreate() + ".cpp"); - } - - *of << "# Global classes, need linked once per executable\n"; - cmake_set_raw(*of, name + "_GLOBAL", cmake_list(global)); - *of << "# Generated module classes, non-fast-path, compile with low/medium optimization\n"; - cmake_set_raw(*of, name + "_CLASSES_SLOW", cmake_list(classes_slow)); - *of << "# Generated module classes, fast-path, compile with highest optimization\n"; - cmake_set_raw(*of, name + "_CLASSES_FAST", cmake_list(classes_fast)); - *of << "# Generated support classes, non-fast-path, compile with " - "low/medium optimization\n"; - cmake_set_raw(*of, name + "_SUPPORT_SLOW", cmake_list(support_slow)); - *of << "# Generated support classes, fast-path, compile with highest optimization\n"; - cmake_set_raw(*of, name + "_SUPPORT_FAST", cmake_list(support_fast)); - - *of << "# All dependencies\n"; - cmake_set_raw(*of, name + "_DEPS", cmake_list(V3File::getAllDeps())); - - *of << "# User .cpp files (from .cpp's on Verilator command line)\n"; - cmake_set_raw(*of, name + "_USER_CLASSES", cmake_list(v3Global.opt.cppFiles())); - if (const V3HierGraph* const graphp = v3Global.hierGraphp()) { - *of << "# Verilate hierarchical blocks\n"; - // Sorted hierarchical blocks in order of leaf-first. - *of << "get_target_property(TOP_TARGET_NAME \"${TARGET}\" NAME)\n"; - for (const V3GraphVertex& vtx : vlstd::reverse_view(graphp->vertices())) { - const V3HierBlock* const hblockp = vtx.as(); - const string prefix = hblockp->hierPrefix(); - *of << "add_library(" << prefix << " STATIC)\n"; - *of << "target_link_libraries(${TOP_TARGET_NAME} PRIVATE " << prefix << ")\n"; - if (!hblockp->outEmpty()) { - *of << "target_link_libraries(" << prefix << " INTERFACE"; - for (const V3GraphEdge& edge : hblockp->outEdges()) { - const V3HierBlock* const dependencyp = edge.top()->as(); - *of << " " << dependencyp->hierPrefix(); - } - *of << ")\n"; - } - *of << "verilate(" << prefix << " PREFIX " << prefix << " TOP_MODULE " - << hblockp->modp()->name() << " DIRECTORY " - << v3Global.opt.makeDir() + "/" + prefix << " SOURCES "; - for (const V3GraphEdge& edge : hblockp->outEdges()) { - const V3HierBlock* const dependencyp = edge.top()->as(); - *of << " " - << v3Global.opt.makeDir() + "/" + dependencyp->hierWrapperFilename(true); - } - *of << " "; - const string vFile = hblockp->vFileIfNecessary(); - if (!vFile.empty()) *of << vFile << " "; - for (const auto& i : v3Global.opt.vFiles()) - *of << V3Os::filenameRealPath(i.filename()) << " "; - *of << " VERILATOR_ARGS "; - *of << "-f " << hblockp->commandArgsFilename(true) - << " -CFLAGS -fPIC" // hierarchical block will be static, but may be linked - // with .so - << ")\n"; - } - *of << "\n# Verilate the top module that refers to lib-create wrappers of above\n"; - *of << "verilate(${TOP_TARGET_NAME} PREFIX " << v3Global.opt.prefix() << " TOP_MODULE " - << v3Global.rootp()->topModulep()->name() << " DIRECTORY " - << v3Global.opt.makeDir() << " SOURCES "; - for (const V3GraphVertex& vtx : graphp->vertices()) { - const V3HierBlock* const hblockp = vtx.as(); - *of << " " << v3Global.opt.makeDir() + "/" + hblockp->hierWrapperFilename(true); - } - *of << " " << cmake_list(v3Global.opt.vFiles()); - *of << " VERILATOR_ARGS "; - *of << "-f " << graphp->topCommandArgsFilename(true); - *of << ")\n"; - } - } - -public: - explicit CMakeEmitter() { emitOverallCMake(); } - virtual ~CMakeEmitter() = default; -}; - -void V3EmitCMake::emit() { - UINFO(2, __FUNCTION__ << ":"); - const CMakeEmitter emitter; -} diff --git a/src/V3EmitCMake.h b/src/V3EmitCMake.h deleted file mode 100644 index 7d39784f2..000000000 --- a/src/V3EmitCMake.h +++ /dev/null @@ -1,30 +0,0 @@ -// -*- mode: C++; c-file-style: "cc-mode" -*- -//************************************************************************* -// DESCRIPTION: Verilator: Emit CMake file list -// -// Code available from: https://verilator.org -// -//************************************************************************* -// -// Copyright 2003-2026 by Wilson Snyder. This program is free software; you -// can redistribute it and/or modify it under the terms of either the GNU -// Lesser General Public License Version 3 or the Perl Artistic License -// Version 2.0. -// SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0 -// -//************************************************************************* - -#ifndef VERILATOR_V3EMITCMAKE_H_ -#define VERILATOR_V3EMITCMAKE_H_ - -#include "config_build.h" -#include "verilatedos.h" - -//============================================================================ - -class V3EmitCMake final { -public: - static void emit() VL_MT_DISABLED; -}; - -#endif // Guard diff --git a/src/V3Options.cpp b/src/V3Options.cpp index 13c46e813..9b55f8390 100644 --- a/src/V3Options.cpp +++ b/src/V3Options.cpp @@ -951,7 +951,7 @@ void V3Options::notify() VL_MT_DISABLED { "--json-only or --E option"); } - if (m_build && (m_gmake || m_cmake || m_makeJson)) { + if (m_build && (m_gmake || m_makeJson)) { cmdfl->v3error("--make cannot be used together with --build. Suggest see manual"); } @@ -982,7 +982,7 @@ void V3Options::notify() VL_MT_DISABLED { } // Make sure at least one make system is enabled - if (!m_gmake && !m_cmake && !m_makeJson) m_gmake = true; + if (!m_gmake && !m_makeJson) m_gmake = true; if (m_hierarchical && (m_hierChild || !m_hierBlocks.empty())) { cmdfl->v3error( @@ -1583,11 +1583,7 @@ void V3Options::parseOptsList(FileLine* fl, const string& optdir, int argc, DECL_OPTION("-main", OnOff, &m_main); DECL_OPTION("-main-top-name", Set, &m_mainTopName); 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")) { + if (!std::strcmp(valp, "gmake")) { m_gmake = true; } else if (!std::strcmp(valp, "json")) { m_makeJson = true; diff --git a/src/V3Options.h b/src/V3Options.h index b329762e3..cabbcbec7 100644 --- a/src/V3Options.h +++ b/src/V3Options.h @@ -226,7 +226,6 @@ private: bool m_bboxUnsup = false; // main switch: --bbox-unsup bool m_binary = false; // main switch: --binary bool m_build = false; // main switch: --build - bool m_cmake = false; // main switch: --make cmake bool m_context = true; // main switch: --Wcontext bool m_coverageExpr = false; // main switch: --coverage-expr bool m_coverageLine = false; // main switch: --coverage-block @@ -504,7 +503,6 @@ public: bool build() const { return m_build; } string buildDepBin() const { return m_buildDepBin; } void buildDepBin(const string& flag) { m_buildDepBin = flag; } - bool cmake() const { return m_cmake; } bool context() const VL_MT_SAFE { return m_context; } bool coverage() const VL_MT_SAFE { return m_coverageLine || m_coverageToggle || m_coverageExpr || m_coverageUser; diff --git a/src/Verilator.cpp b/src/Verilator.cpp index f895dffb8..ec0a82f3e 100644 --- a/src/Verilator.cpp +++ b/src/Verilator.cpp @@ -47,7 +47,6 @@ #include "V3DiagSarif.h" #include "V3EmitC.h" #include "V3EmitCMain.h" -#include "V3EmitCMake.h" #include "V3EmitMk.h" #include "V3EmitMkJson.h" #include "V3EmitV.h" @@ -652,7 +651,7 @@ static void process() { if (!v3Global.opt.lintOnly() && !v3Global.opt.serializeOnly() && !v3Global.opt.dpiHdrOnly()) { if (v3Global.opt.main()) V3EmitCMain::emit(); - // V3EmitMk/V3EmitCMake/V3EmitMkJson must be after all other emitters, + // V3EmitMk/V3EmitMkJson must be after all other emitters, // as they and below code visits AstCFiles added earlier size_t src_f_cnt = 0; for (AstNode* nodep = v3Global.rootp()->filesp(); nodep; nodep = nodep->nextp()) { @@ -660,7 +659,6 @@ static void process() { src_f_cnt += cfilep->source() ? 1 : 0; } if (src_f_cnt >= V3EmitMk::PARALLEL_FILE_CNT_THRESHOLD) v3Global.useParallelBuild(true); - if (v3Global.opt.cmake()) V3EmitCMake::emit(); if (v3Global.opt.makeJson()) V3EmitMkJson::emit(); if (v3Global.opt.gmake()) V3EmitMk::emitmk(); } @@ -762,10 +760,6 @@ static bool verilate(const string& argString) { hierGraphp->writeCommandArgsFiles(false); V3EmitMk::emitHierVerilation(hierGraphp); } - if (v3Global.opt.cmake()) { - hierGraphp->writeCommandArgsFiles(true); - V3EmitCMake::emit(); - } if (v3Global.opt.makeJson()) { hierGraphp->writeCommandArgsFiles(true); V3EmitMkJson::emit(); @@ -829,7 +823,6 @@ static string buildMakeCmd(const string& makefile, const string& target) { 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/t/t_flag_build_bad.py b/test_regress/t/t_flag_build_bad.py index 5bfed0801..ccd2e882f 100755 --- a/test_regress/t/t_flag_build_bad.py +++ b/test_regress/t/t_flag_build_bad.py @@ -15,10 +15,6 @@ test.compile(verilator_flags2=["--build --make gmake"], fails=True, expect_filename=test.golden_filename) -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 deleted file mode 100644 index 690010506..000000000 --- a/test_regress/t/t_flag_build_bad_cmake.out +++ /dev/null @@ -1,6 +0,0 @@ -%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