summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2024-05-29 22:35:23 +0800
committerruki <[email protected]>2024-05-29 22:35:23 +0800
commit4ffaa7f613818c915baa56849124acc2227398cb (patch)
treeef56d1eec3f57317d6cea890f263c0bcbca48b94
parent9656518aa9bde944342d75a13d5d0412568754c5 (diff)
use static lib stub for cargo
-rw-r--r--xmake/modules/package/manager/cargo/install_package.lua8
1 files changed, 7 insertions, 1 deletions
diff --git a/xmake/modules/package/manager/cargo/install_package.lua b/xmake/modules/package/manager/cargo/install_package.lua
index 7c9844c29..97fd1a07e 100644
--- a/xmake/modules/package/manager/cargo/install_package.lua
+++ b/xmake/modules/package/manager/cargo/install_package.lua
@@ -92,11 +92,17 @@ function main(name, opt)
-- https://github.com/rust-lang/cargo/issues/10534#issuecomment-1087631050
local tomlfile = io.open(cargotoml, "a")
tomlfile:print("")
+ tomlfile:print("[lib]")
+ tomlfile:print("crate-type = [\"staticlib\"]")
+ tomlfile:print("")
tomlfile:print("[workspace]")
tomlfile:print("")
tomlfile:close()
else
local tomlfile = io.open(cargotoml, "w")
+ tomlfile:print("[lib]")
+ tomlfile:print("crate-type = [\"staticlib\"]")
+ tomlfile:print("")
tomlfile:print("[package]")
tomlfile:print("name = \"cargodeps\"")
tomlfile:print("version = \"0.1.0\"")
@@ -125,7 +131,7 @@ target = "%s"
end
-- generate main.rs
- local file = io.open(path.join(sourcedir, "src", "main.rs"), "w")
+ local file = io.open(path.join(sourcedir, "src", "lib.rs"), "w")
if configs.main == false then
file:print("#![no_main]")
end