summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornoeffn <[email protected]>2022-09-03 16:17:21 +0200
committernoeffn <[email protected]>2022-09-03 16:18:06 +0200
commit0a524bac87c80e6401caa560f4c0bf8bc16d560a (patch)
tree98a427503db46e8c500f365e7a2f10210322bfc2
parent72e4fc1453ac10299fc2257dd074c70c21865718 (diff)
adds platform mapping for vcpkg
-rw-r--r--xmake/modules/package/manager/vcpkg/configurations.lua9
-rw-r--r--xmake/modules/package/manager/vcpkg/find_package.lua7
-rw-r--r--xmake/modules/package/manager/vcpkg/install_package.lua14
3 files changed, 16 insertions, 14 deletions
diff --git a/xmake/modules/package/manager/vcpkg/configurations.lua b/xmake/modules/package/manager/vcpkg/configurations.lua
index fccde8d92..0a03f4d35 100644
--- a/xmake/modules/package/manager/vcpkg/configurations.lua
+++ b/xmake/modules/package/manager/vcpkg/configurations.lua
@@ -37,6 +37,15 @@ function arch(arch)
return archs[arch] or arch
end
+-- get platform for vcpkg
+function plat(plat)
+ local plats = {
+ macosx = "osx",
+ bsd = "freebsd",
+ }
+ return plats[plat] or plat
+end
+
-- get configurations
function main()
return {
diff --git a/xmake/modules/package/manager/vcpkg/find_package.lua b/xmake/modules/package/manager/vcpkg/find_package.lua
index b15844ede..0dc95bd0f 100644
--- a/xmake/modules/package/manager/vcpkg/find_package.lua
+++ b/xmake/modules/package/manager/vcpkg/find_package.lua
@@ -73,10 +73,9 @@ function _find_package(vcpkgdir, name, opt)
local arch = opt.arch
local plat = opt.plat
local mode = opt.mode
- if plat == "macosx" then
- plat = "osx"
- end
- arch = configurations.arch(arch)
+
+ plat = configurations.plat(plat)
+ arch = configurations.arch(arch)
-- get the vcpkg info directories
local infodirs = {}
diff --git a/xmake/modules/package/manager/vcpkg/install_package.lua b/xmake/modules/package/manager/vcpkg/install_package.lua
index cb7093943..3fdff9bca 100644
--- a/xmake/modules/package/manager/vcpkg/install_package.lua
+++ b/xmake/modules/package/manager/vcpkg/install_package.lua
@@ -47,10 +47,8 @@ function _install_for_classic(vcpkg, name, opt)
local arch = opt.arch
local plat = opt.plat
local mode = opt.mode
- if plat == "macosx" then
- plat = "osx"
- end
- arch = configurations.arch(arch)
+ plat = configurations.plat(plat)
+ arch = configurations.arch(arch)
-- init triplet
local triplet = arch .. "-" .. plat
@@ -80,12 +78,8 @@ function _install_for_manifest(vcpkg, name, opt)
-- init triplet
local arch = opt.arch
local plat = opt.plat
- if plat == "macosx" then
- plat = "osx"
- elseif plat == "bsd" then
- plat = "freebsd"
- end
- arch = configurations.arch(arch)
+ plat = configurations.plat(plat)
+ arch = configurations.arch(arch)
local triplet = arch .. "-" .. plat
if opt.plat == "windows" and configs.shared ~= true then
triplet = triplet .. "-static"