summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--xmake/core/package/package.lua2
-rw-r--r--xmake/rules/verilator/verilator.lua4
-rw-r--r--xmake/toolchains/verilator/xmake.lua4
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})