diff --git a/.cargo/config.toml b/.cargo/config.toml new file mode 100644 index 0000000..4985474 --- /dev/null +++ b/.cargo/config.toml @@ -0,0 +1,6 @@ +# Compile C/C++ dependencies (e.g. smartmontools) with /MT instead of /MD. +# Otherwise they link the C++ STL dynamically and the binary needs +# MSVCP140.dll, which isn't present on a clean Windows install. +# See framework_tool/build.rs for how vcruntime is linked statically. +[target.'cfg(all(windows, target_env = "msvc"))'] +rustflags = ["-C", "target-feature=+crt-static"] diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3d577f6..5ae6a91 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -148,6 +148,19 @@ jobs: - name: Check if Windows tool can start run: target/release/framework_tool.exe --help + # The runner has the VC++ redistributable installed, a clean Windows doesn't + - name: Check Windows tool doesn't need VC++ redistributable + shell: pwsh + run: | + $vs = & "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" -latest -property installationPath + $dumpbin = Get-ChildItem "$vs\VC\Tools\MSVC\*\bin\Hostx64\x64\dumpbin.exe" | Select-Object -First 1 + $deps = & $dumpbin /dependents target/release/framework_tool.exe + $deps + if ($deps -match '(?i)(msvcp|vcruntime)\d+') { + Write-Error "framework_tool.exe depends on the VC++ redistributable" + exit 1 + } + # Upload release build so that vcruntime is statically linked - name: Upload Windows App uses: actions/upload-artifact@v6