Skip to content

Commit

Permalink
windows: static link vcruntime140.dll
Browse files Browse the repository at this point in the history
  • Loading branch information
liias committed Dec 29, 2023
1 parent c6c074e commit a16bae5
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 1 deletion.
5 changes: 4 additions & 1 deletion .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
[build]
# Set explicit target while developing for platform other than host platform
#target = "aarch64-pc-windows-msvc"
target = "aarch64-pc-windows-msvc"
#target = "aarch64-unknown-linux-gnu"
#target = "aarch64-apple-darwin"

[target.'cfg(all(windows, target_env = "msvc"))']
rustflags = ["-C", "target-feature=+crt-static"]
7 changes: 7 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,9 @@ dunce = "1.0.4"
# Requires rc.exe from the Windows SDK (or windres.exe and ar.exe from minGW64)
winres = "0.1.12"

# statically link vcruntime140.dll instead of requiring user to install the runtime
static_vcruntime = "2.0"

#[profile.dev]
#lto = true

Expand Down
3 changes: 3 additions & 0 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ fn main() {
let mut res = winres::WindowsResource::new();
res.set_icon("extra/windows/icons/browsers.ico");
res.compile().unwrap();

// statically link vcruntime140.dll instead of requiring user to install the runtime
static_vcruntime::metabuild();
}

#[cfg(target_os = "linux")]
Expand Down

0 comments on commit a16bae5

Please sign in to comment.