Desktop builds with their own profile: thin LTO and 16 codegen units, compiled on all cores

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Richard ZinkandClaude Opus 5.5 committed 2026-11-07 22:49:28 +01:00
1 parent 4175ca7f97
commit 8c33051913
2 files changed
+14 -6

No files matched your search

+8
View File
@@ -18,6 +18,14 @@ codegen-units = 1
[profile.dev] [profile.dev]
opt-level = 1 opt-level = 1
# desktop builds (tools/build_desktop.py): optimised like release, but compiled on all cores
# (several codegen units, thin LTO); release keeps one unit and full LTO for the smallest,
# fastest WASM
[profile.desktop]
inherits = "release"
lto = "thin"
codegen-units = 16
# desktop builds: system file dialog (xdg portal on Linux) and sound output # desktop builds: system file dialog (xdg portal on Linux) and sound output
[target.'cfg(not(target_arch = "wasm32"))'.dependencies] [target.'cfg(not(target_arch = "wasm32"))'.dependencies]
rfd = { version = "0.17", default-features = false, features = ["xdg-portal"] } rfd = { version = "0.17", default-features = false, features = ["xdg-portal"] }
+6 -6
View File
@@ -149,8 +149,8 @@ def build_linux(ver):
# libasound is only linked by name: its own glibc references are the user's system's business # libasound is only linked by name: its own glibc references are the user's system's business
env["RUSTFLAGS"] = (env.get("RUSTFLAGS", "") + " -C link-arg=-Wl,--allow-shlib-undefined").strip() env["RUSTFLAGS"] = (env.get("RUSTFLAGS", "") + " -C link-arg=-Wl,--allow-shlib-undefined").strip()
log(f"Linux build (glibc {GLIBC})") log(f"Linux build (glibc {GLIBC})")
run([cargo(), "zigbuild", "--release", "--target", f"x86_64-unknown-linux-gnu.{GLIBC}"], env=env) run([cargo(), "zigbuild", "--profile", "desktop", "--target", f"x86_64-unknown-linux-gnu.{GLIBC}"], env=env)
binary = ROOT / "target" / "x86_64-unknown-linux-gnu" / "release" / "dungeoncraft" binary = ROOT / "target" / "x86_64-unknown-linux-gnu" / "desktop" / "dungeoncraft"
appdir = ROOT / "target" / "AppDir" appdir = ROOT / "target" / "AppDir"
shutil.rmtree(appdir, ignore_errors=True) shutil.rmtree(appdir, ignore_errors=True)
@@ -175,9 +175,9 @@ def build_windows(ver):
need_target("x86_64-pc-windows-gnu") need_target("x86_64-pc-windows-gnu")
env = zig_env() env = zig_env()
log("Windows build") log("Windows build")
run([cargo(), "zigbuild", "--release", "--target", "x86_64-pc-windows-gnu"], env=env) run([cargo(), "zigbuild", "--profile", "desktop", "--target", "x86_64-pc-windows-gnu"], env=env)
out = DIST / f"DungeonCraft-{ver}-windows-x64.exe" out = DIST / f"DungeonCraft-{ver}-windows-x64.exe"
shutil.copy2(ROOT / "target" / "x86_64-pc-windows-gnu" / "release" / "dungeoncraft.exe", out) shutil.copy2(ROOT / "target" / "x86_64-pc-windows-gnu" / "desktop" / "dungeoncraft.exe", out)
return out return out
@@ -193,13 +193,13 @@ def build_macos(ver):
env["MACOSX_DEPLOYMENT_TARGET"] = "11.0" env["MACOSX_DEPLOYMENT_TARGET"] = "11.0"
for t in arches: for t in arches:
log(f"macOS build {t}") log(f"macOS build {t}")
run([cargo(), "build", "--release", "--target", t], env=env) run([cargo(), "build", "--profile", "desktop", "--target", t], env=env)
app = ROOT / "target" / "DungeonCraft.app" app = ROOT / "target" / "DungeonCraft.app"
shutil.rmtree(app, ignore_errors=True) shutil.rmtree(app, ignore_errors=True)
(app / "Contents" / "MacOS").mkdir(parents=True) (app / "Contents" / "MacOS").mkdir(parents=True)
(app / "Contents" / "Resources").mkdir(parents=True) (app / "Contents" / "Resources").mkdir(parents=True)
run(["lipo", "-create", "-output", app / "Contents" / "MacOS" / "DungeonCraft"] + [ROOT / "target" / t / "release" / "dungeoncraft" for t in arches]) run(["lipo", "-create", "-output", app / "Contents" / "MacOS" / "DungeonCraft"] + [ROOT / "target" / t / "desktop" / "dungeoncraft" for t in arches])
short = ver.lstrip("v").replace("-", ".") short = ver.lstrip("v").replace("-", ".")
(app / "Contents" / "Info.plist").write_text(INFO_PLIST.format(short=short, version=ver), encoding="utf-8") (app / "Contents" / "Info.plist").write_text(INFO_PLIST.format(short=short, version=ver), encoding="utf-8")