verilator icon indicating copy to clipboard operation
verilator copied to clipboard

CMake support doesn't work with generated code

Open Timmmm opened this issue 2 years ago • 7 comments

The CMake support you've added is great but unfortunately I think it is done in a way that makes it basically impossible to use with any generated code (which is very common in my experience).

For example, suppose you would normally do this:

g++ -shared foo.cpp -o libfoo.so
verilator ... main.cpp top.sv libfoo.so

Seems pretty reasonable, but it's more or less impossible with the current CMake support because the g++ command will run at build time, and the verilator command will run at configure time (before libfoo.so exists).

Fundamentally, the verilator command should run at build time instead using add_custom_command().

I had a look at the code and actually it looks like it does do that, but then there's also some other code that calls execute_process() too which is what causes the problem.

I would guess this is a dynamic dependency issue.

Timmmm avatar Mar 07 '23 16:03 Timmmm