diff options
Diffstat (limited to 'xmake')
| -rw-r--r-- | xmake/rules/verilator/verilator.lua | 32 | ||||
| -rw-r--r-- | xmake/rules/verilator/xmake.lua | 26 |
2 files changed, 8 insertions, 50 deletions
diff --git a/xmake/rules/verilator/verilator.lua b/xmake/rules/verilator/verilator.lua index 72de7b91b..dbf6192bc 100644 --- a/xmake/rules/verilator/verilator.lua +++ b/xmake/rules/verilator/verilator.lua @@ -309,38 +309,6 @@ function build_cppfiles(target, jobgraph, sourcebatch, opt) local targetname = target:name() local makefile = path.join(autogendir, targetname .. "." .. makefile_type) - -- build verilog files - depend.on_changed(function() - local argv = { "--cc", "--make", makefile_type, "--prefix", targetname, "--Mdir", autogendir } - local flags = _get_verilator_flags(target) - if flags then - table.join2(argv, flags) - end - local language_flags = _get_lanuage_flags(target) - if language_flags then - table.join2(argv, language_flags) - end - local sourcefiles = sourcebatch.sourcefiles - for _, sourcefile in ipairs(sourcefiles) do - local sourcefile = sourcefile - progress.show(opt.progress or 0, "${color.build.object}compiling.verilog %s", sourcefile) - -- we need to use slashes to fix it on windows - -- @see https://github.com/verilator/verilator/issues/3873 - if is_host("windows") then - sourcefile = sourcefile:gsub("\\", "/") - end - table.insert(argv, sourcefile) - end - - -- generate c++ sourcefiles - os.vrunv(verilator, argv, { envs = toolchain:runenvs() }) - end, { - dependfile = makefile .. ".d", - files = sourcebatch.sourcefiles, - changed = target:is_rebuilt(), - lastmtime = os.mtime(makefile) - }) - -- get compiled source files local sourcefiles if support_json then diff --git a/xmake/rules/verilator/xmake.lua b/xmake/rules/verilator/xmake.lua index 6d9a0b7b0..a04d0cd55 100644 --- a/xmake/rules/verilator/xmake.lua +++ b/xmake/rules/verilator/xmake.lua @@ -30,18 +30,16 @@ rule("verilator.binary") import("verilator").config(target) end) - before_build_files(function (target, sourcebatch) - -- Just to avoid before_buildcmd_files being executed at build time + -- we need to generate cpp files before scanning c++ modules + -- https://github.com/xmake-io/xmake/issues/7624 + before_preparecmd_files(function(target, batchcmds, sourcebatch, opt) + import("verilator").buildcmd_vfiles(target, batchcmds, sourcebatch, opt) end) on_build_files(function (target, jobgraph, sourcebatch, opt) import("verilator").build_cppfiles(target, jobgraph, sourcebatch, opt) end, {jobgraph = true, batch = true, distcc = true}) - before_buildcmd_files(function(target, batchcmds, sourcebatch, opt) - import("verilator").buildcmd_vfiles(target, batchcmds, sourcebatch, opt) - end) - on_buildcmd_files(function (target, batchcmds, sourcebatch, opt) import("verilator").buildcmd_cppfiles(target, batchcmds, sourcebatch, opt) end) @@ -57,18 +55,14 @@ rule("verilator.static") import("verilator").config(target) end) - before_build_files(function (target, sourcebatch) - -- Just to avoid before_buildcmd_files being executed at build time + before_preparecmd_files(function(target, batchcmds, sourcebatch, opt) + import("verilator").buildcmd_vfiles(target, batchcmds, sourcebatch, opt) end) on_build_files(function (target, jobgraph, sourcebatch, opt) import("verilator").build_cppfiles(target, jobgraph, sourcebatch, opt) end, {jobgraph = true, batch = true, distcc = true}) - before_buildcmd_files(function(target, batchcmds, sourcebatch, opt) - import("verilator").buildcmd_vfiles(target, batchcmds, sourcebatch, opt) - end) - on_buildcmd_files(function (target, batchcmds, sourcebatch, opt) import("verilator").buildcmd_cppfiles(target, batchcmds, sourcebatch, opt) end) @@ -84,18 +78,14 @@ rule("verilator.shared") import("verilator").config(target) end) - before_build_files(function (target, sourcebatch) - -- Just to avoid before_buildcmd_files being executed at build time + before_preparecmd_files(function(target, batchcmds, sourcebatch, opt) + import("verilator").buildcmd_vfiles(target, batchcmds, sourcebatch, opt) end) on_build_files(function (target, jobgraph, sourcebatch, opt) import("verilator").build_cppfiles(target, jobgraph, sourcebatch, opt) end, {jobgraph = true, batch = true, distcc = true}) - before_buildcmd_files(function(target, batchcmds, sourcebatch, opt) - import("verilator").buildcmd_vfiles(target, batchcmds, sourcebatch, opt) - end) - on_buildcmd_files(function (target, batchcmds, sourcebatch, opt) import("verilator").buildcmd_cppfiles(target, batchcmds, sourcebatch, opt) end) |
