From e40f93fd5fbaacdcee2ae2dec11c8e1e8304a3b0 Mon Sep 17 00:00:00 2001 From: LordMZTE Date: Sun, 13 Aug 2023 07:58:21 +0200 Subject: [PATCH] set codegen units properly in cargo config --- .cargo/{config.toml => config.toml.cgt} | 6 +++++- confgen.lua | 3 ++- 2 files changed, 7 insertions(+), 2 deletions(-) rename .cargo/{config.toml => config.toml.cgt} (51%) diff --git a/.cargo/config.toml b/.cargo/config.toml.cgt similarity index 51% rename from .cargo/config.toml rename to .cargo/config.toml.cgt index 8bef4a7..5f03110 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml.cgt @@ -1,3 +1,4 @@ + [target.x86_64-unknown-linux-gnu] linker = "/usr/bin/clang" rustflags = ["-Clink-arg=-fuse-ld=lld"] @@ -5,4 +6,7 @@ rustflags = ["-Clink-arg=-fuse-ld=lld"] [profile.release] lto = true opt-level = 3 -codegen-units = 1 +codegen-units = <% math.min(ncpus, 4) %> + +[profile.debug] +codegen-units = <% ncpus %> diff --git a/confgen.lua b/confgen.lua index b7c7a84..8d78b1c 100644 --- a/confgen.lua +++ b/confgen.lua @@ -57,7 +57,8 @@ cg.opt.system = function(cmd) if handle == nil then error("Failed to spawn process" .. cmd) end - return handle:read("*a"):gsub("%s+", "") + local data, _ = handle:read("*a"):gsub("%s$", "") + return data end -- Compile the input as lua. Meant to be used as a post-processor.