diff options
| author | wenjiu <[email protected]> | 2025-04-02 23:16:51 +0800 |
|---|---|---|
| committer | wenjiu <[email protected]> | 2025-04-02 23:16:51 +0800 |
| commit | c4d40d3641dc2d2219e41deb9d6482f87e082ffb (patch) | |
| tree | f4e066f8942b352a76d2db849b2d79a62ac9171f /xmake | |
| parent | 18bab4f32a2c48b5bea4e94c3fbff360ded90088 (diff) | |
feat(verilator): Support Verilator target build to shared library
Signed-off-by: wenjiu <[email protected]>
Diffstat (limited to 'xmake')
| -rw-r--r-- | xmake/rules/verilator/xmake.lua | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/xmake/rules/verilator/xmake.lua b/xmake/rules/verilator/xmake.lua index 76d213096..4e6f49397 100644 --- a/xmake/rules/verilator/xmake.lua +++ b/xmake/rules/verilator/xmake.lua @@ -73,3 +73,29 @@ rule("verilator.static") import("verilator").buildcmd_cppfiles(target, batchcmds, sourcebatch, opt) end) +rule("verilator.shared") + add_deps("c++") + set_extensions(".v", ".sv") + on_load(function (target) + target:set("kind", "shared") + end) + + on_config(function (target) + import("verilator").config(target) + end) + + before_build_files(function (target, sourcebatch) + -- Just to avoid before_buildcmd_files being executed at build time + end) + + on_build_files(function (target, batchjobs, sourcebatch, opt) + import("verilator").build_cppfiles(target, batchjobs, sourcebatch, opt) + end, {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) |
