mirror of
https://github.com/kunkundi/crossdesk.git
synced 2026-07-25 00:38:41 +08:00
build: install Rust toolchain for Slint
This commit is contained in:
Vendored
+35
@@ -0,0 +1,35 @@
|
|||||||
|
package("rust")
|
||||||
|
set_kind("toolchain")
|
||||||
|
set_homepage("https://rust-lang.org")
|
||||||
|
set_description("Rust is a general-purpose programming language emphasizing performance, type safety, and concurrency.")
|
||||||
|
|
||||||
|
add_versions("1.92.0", "")
|
||||||
|
|
||||||
|
add_deps("ca-certificates", {host = true, private = true})
|
||||||
|
add_deps("rustup", {host = true, private = true, system = false})
|
||||||
|
|
||||||
|
on_install(function(package)
|
||||||
|
import("core.tools.rustc.target_triple")
|
||||||
|
|
||||||
|
local host_target = assert(target_triple(package:plat(), package:arch()),
|
||||||
|
"failed to determine the Rust host target triple")
|
||||||
|
local version = package:version():shortstr()
|
||||||
|
local toolchain_name = version .. "-" .. host_target
|
||||||
|
local rustup_home = assert(os.getenv("RUSTUP_HOME"), "cannot find rustup home")
|
||||||
|
|
||||||
|
os.vrunv("rustup", {"install", "--no-self-update", toolchain_name})
|
||||||
|
os.vmv(path.join(rustup_home, "toolchains", toolchain_name, "*"), package:installdir())
|
||||||
|
|
||||||
|
-- Keep the Xmake-managed toolchain isolated from rustup after installation.
|
||||||
|
os.vrm(path.join(rustup_home, "toolchains", toolchain_name))
|
||||||
|
os.vrm(path.join(rustup_home, "update-hashes", toolchain_name))
|
||||||
|
|
||||||
|
package:addenv("RC", "bin/rustc" .. (is_host("windows") and ".exe" or ""))
|
||||||
|
package:mark_as_pathenv("RC")
|
||||||
|
end)
|
||||||
|
|
||||||
|
on_test(function(package)
|
||||||
|
os.vrun("cargo --version")
|
||||||
|
os.vrun("rustc --version")
|
||||||
|
end)
|
||||||
|
package_end()
|
||||||
Vendored
+1
@@ -10,6 +10,7 @@ package("slint")
|
|||||||
add_configs("shared", {description = "Build the Slint runtime as a shared library", default = true, type = "boolean", readonly = true})
|
add_configs("shared", {description = "Build the Slint runtime as a shared library", default = true, type = "boolean", readonly = true})
|
||||||
|
|
||||||
add_deps("cmake")
|
add_deps("cmake")
|
||||||
|
add_deps("rust 1.92.0", {host = true, private = true, system = false})
|
||||||
|
|
||||||
on_load(function(package)
|
on_load(function(package)
|
||||||
package:add("includedirs", "include/slint")
|
package:add("includedirs", "include/slint")
|
||||||
|
|||||||
Vendored
+1
-1
@@ -1 +1 @@
|
|||||||
includes("cpp-httplib", "slint")
|
includes("cpp-httplib", "rust", "slint")
|
||||||
|
|||||||
Reference in New Issue
Block a user