summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2021-12-20 23:14:50 +0800
committerruki <[email protected]>2021-12-20 23:14:50 +0800
commit39349f1a4fbf510d434c01952fe1f8f7e7505259 (patch)
treeac95cc64139f6018b9edbb171b9c07204ee50602
parentc36a12cccb8639154ac3caf6441a764f6c32a5db (diff)
add triplet to vcpkg manifest
-rw-r--r--tests/projects/package/vcpkg_manifest/xmake.lua2
-rw-r--r--xmake/modules/package/manager/vcpkg/install_package.lua25
2 files changed, 18 insertions, 9 deletions
diff --git a/tests/projects/package/vcpkg_manifest/xmake.lua b/tests/projects/package/vcpkg_manifest/xmake.lua
index d7150718c..fd8a23e79 100644
--- a/tests/projects/package/vcpkg_manifest/xmake.lua
+++ b/tests/projects/package/vcpkg_manifest/xmake.lua
@@ -1,4 +1,4 @@
---add_requires("vcpkg::zlib 1.2.11", "vcpkg::fmt >=8.0.1")
+add_requires("vcpkg::zlib 1.2.11", "vcpkg::fmt >=8.0.1")
add_requires("vcpkg::arrow", {configs = {features = {"json"}}})
target("test")
diff --git a/xmake/modules/package/manager/vcpkg/install_package.lua b/xmake/modules/package/manager/vcpkg/install_package.lua
index 114cd538c..ec00fcb85 100644
--- a/xmake/modules/package/manager/vcpkg/install_package.lua
+++ b/xmake/modules/package/manager/vcpkg/install_package.lua
@@ -74,19 +74,28 @@ function _install_for_manifest(vcpkg, name, opt)
-- get configs
local configs = opt.configs or {}
- -- init argv
- local argv = {"--feature-flags=\"versions\"", "install"}
- if option.get("diagnosis") then
- table.insert(argv, "--debug")
- end
-
- -- generate platform
+ -- init triplet
local arch = opt.arch
local plat = opt.plat
if plat == "macosx" then
plat = "osx"
end
arch = configurations.arch(arch)
+ local triplet = arch .. "-" .. plat
+ if opt.plat == "windows" and opt.shared ~= true then
+ triplet = triplet .. "-static"
+ if opt.vs_runtime and opt.vs_runtime:startswith("MD") then
+ triplet = triplet .. "-md"
+ end
+ end
+
+ -- init argv
+ local argv = {"--feature-flags=\"versions\"", "install", "--triplet", triplet}
+ if option.get("diagnosis") then
+ table.insert(argv, "--debug")
+ end
+
+ -- generate platform
local platform = plat .. " & " .. arch
-- generate dependencies
@@ -120,7 +129,7 @@ function _install_for_manifest(vcpkg, name, opt)
dependencies = dependencies,
["builtin-baseline"] = baseline,
overrides = overrides}
- local tmpdir = os.tmpfile() .. ".dir"
+ local tmpdir = os.tmpfile({ramdisk = false}) .. ".dir"
json.savefile(path.join(tmpdir, "vcpkg.json"), manifest)
-- install package