[fix] statically link the Windows CRT in Slint

This commit is contained in:
dijunkun
2026-09-27 03:35:06 +08:00
parent 0b2eb5b106
commit 3d2235ad4e
2 changed files with 27 additions and 1 deletions
+9
View File
@@ -38,6 +38,15 @@ function setup_targets()
local runtime_dir = path.join(slint:installdir(), "lib")
local runtime_dll = path.join(runtime_dir, "slint_cpp.dll")
assert(os.isfile(runtime_dll), "Slint runtime not found: " .. runtime_dll)
import("utils.binary.deplibs")
local dependencies = deplibs(runtime_dll, {plat = "windows", arch = target:arch()})
assert(dependencies and #dependencies > 0, "Cannot inspect Slint runtime dependencies: " .. runtime_dll)
for _, dependency in ipairs(dependencies) do
local name = path.filename(dependency):lower()
assert(not (name:match("^vcruntime%d.*%.dll$") or name:match("^msvcp%d.*%.dll$") or
name:match("^msvcr%d.*%.dll$") or name:match("^concrt%d.*%.dll$")),
"Slint runtime depends on " .. dependency .. "; rebuild the Slint package with static CRT")
end
os.cp(runtime_dll, target:targetdir())
end