diff options
| author | ruki <[email protected]> | 2023-01-14 22:22:36 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2023-01-14 22:22:36 +0800 |
| commit | 39c9b4f33db3d41a304fee2b380917713589efbb (patch) | |
| tree | fce7d72190f0575cce6f50d0277036d445474545 | |
| parent | 57b4a29f08d9663684047e89a80615cbac132ff4 (diff) | |
improve VERILATOR_ROOT
| -rw-r--r-- | xmake/core/package/package.lua | 2 | ||||
| -rw-r--r-- | xmake/rules/verilator/verilator.lua | 4 | ||||
| -rw-r--r-- | xmake/toolchains/verilator/xmake.lua | 4 |
3 files changed, 7 insertions, 3 deletions
diff --git a/xmake/core/package/package.lua b/xmake/core/package/package.lua index af7dc3879..a3723661f 100644 --- a/xmake/core/package/package.lua +++ b/xmake/core/package/package.lua @@ -934,7 +934,7 @@ function _instance:envs() if path.is_absolute(value) then table.insert(newvalues, value) else - table.insert(newvalues, path.join(self:installdir(), value)) + table.insert(newvalues, path.normalize(path.join(self:installdir(), value))) end end values = newvalues diff --git a/xmake/rules/verilator/verilator.lua b/xmake/rules/verilator/verilator.lua index 0cfd39724..376a8dcb0 100644 --- a/xmake/rules/verilator/verilator.lua +++ b/xmake/rules/verilator/verilator.lua @@ -94,7 +94,7 @@ $finish ; end endmodule]]) os.mkdir(tmpdir) - os.runv(verilator, argv) + os.runv(verilator, argv, {envs = toolchain:runenvs()}) -- parse some configurations from cmakefile local verilator_root @@ -185,7 +185,7 @@ function build_cppfiles(target, batchjobs, sourcebatch, opt) table.join2(argv, sourcefiles) -- generate c++ sourcefiles - os.vrunv(verilator, argv) + os.vrunv(verilator, argv, {envs = toolchain:runenvs()}) end, {dependfile = cmakefile .. ".d", files = sourcebatch.sourcefiles, diff --git a/xmake/toolchains/verilator/xmake.lua b/xmake/toolchains/verilator/xmake.lua index 2419b1f34..f3d93a3db 100644 --- a/xmake/toolchains/verilator/xmake.lua +++ b/xmake/toolchains/verilator/xmake.lua @@ -31,6 +31,10 @@ toolchain("verilator") local envs = package:get("envs") if envs then table.join2(paths, envs.PATH) + local verilator_root = envs.VERILATOR_ROOT + if verilator_root then + toolchain:add("runenvs", "VERILATOR_ROOT", table.unwrap(verilator_root)) + end end end local verilator = find_tool("verilator", {paths = paths}) |
