set codegen units properly in cargo config
This commit is contained in:
parent
0c3ce3d22e
commit
e40f93fd5f
2 changed files with 7 additions and 2 deletions
|
@ -1,3 +1,4 @@
|
||||||
|
<! local ncpus = tonumber(opt.system "nproc") !>
|
||||||
[target.x86_64-unknown-linux-gnu]
|
[target.x86_64-unknown-linux-gnu]
|
||||||
linker = "/usr/bin/clang"
|
linker = "/usr/bin/clang"
|
||||||
rustflags = ["-Clink-arg=-fuse-ld=lld"]
|
rustflags = ["-Clink-arg=-fuse-ld=lld"]
|
||||||
|
@ -5,4 +6,7 @@ rustflags = ["-Clink-arg=-fuse-ld=lld"]
|
||||||
[profile.release]
|
[profile.release]
|
||||||
lto = true
|
lto = true
|
||||||
opt-level = 3
|
opt-level = 3
|
||||||
codegen-units = 1
|
codegen-units = <% math.min(ncpus, 4) %>
|
||||||
|
|
||||||
|
[profile.debug]
|
||||||
|
codegen-units = <% ncpus %>
|
|
@ -57,7 +57,8 @@ cg.opt.system = function(cmd)
|
||||||
if handle == nil then
|
if handle == nil then
|
||||||
error("Failed to spawn process" .. cmd)
|
error("Failed to spawn process" .. cmd)
|
||||||
end
|
end
|
||||||
return handle:read("*a"):gsub("%s+", "")
|
local data, _ = handle:read("*a"):gsub("%s$", "")
|
||||||
|
return data
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Compile the input as lua. Meant to be used as a post-processor.
|
-- Compile the input as lua. Meant to be used as a post-processor.
|
||||||
|
|
Loading…
Reference in a new issue