Building Verilator to work with multiple C++ compilers
When building Verilator, the configure script discovers options for the target C++ compiler and writes them into VERILATOR_ROOT/include/verilated.mk. So using an alternative compiler is not just a case of using CXX=clang on the design makefile because the wrong options will be passed in. You would have to override these options, e.g. you could override CFG_CXXFLAGS_NO_UNUSED, but making sure to keep any options that were needed, like -faligned-new.
Is there some way to make Verilator be less tightly bound to the C++ compiler, and particularly allow a single installation of Verilator to be used with either GCC and Clang?
I guess the ideal would be for the verilated C++ source to compile clean with both compilers and not need compiler-specific overrides like -Wno-bool-operation or -Wno-used-but-set-variable.
Alternatively, Verilator could do a mini 'configure' at some point when compiling the design, to find out the right command line for the target C++ compiler.
RE: Building Verilator to work with multiple C++ compilers - Added by Wilson Snyder about 1 year ago
In general, except for compile options Verilated code is designed to work on any target compiler (i.e. output code doesn't use config.h). So it should just be a matter of knowing what switches your compiler needs.
To support better, the best way to handle compile options otherwise would probably be to use configure's cross compilation/target compiler features. If you want to figure out how to do that and provide patches I'll take them.