From c9eacb29c8b3d067e6a64f8eb23c0ef5043d7b5c Mon Sep 17 00:00:00 2001 From: ruki Date: Sat, 9 May 2020 17:13:54 +0800 Subject: improve vcpkg --- xmake/modules/package/manager/vcpkg/find_package.lua | 4 +++- xmake/modules/package/manager/vcpkg/install_package.lua | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/xmake/modules/package/manager/vcpkg/find_package.lua b/xmake/modules/package/manager/vcpkg/find_package.lua index 78e4ff335..2dbf51cfe 100644 --- a/xmake/modules/package/manager/vcpkg/find_package.lua +++ b/xmake/modules/package/manager/vcpkg/find_package.lua @@ -57,8 +57,10 @@ function main(name, opt) -- find the package info file, e.g. zlib_1.2.11-3_x86-windows[-static].list local triplet = arch .. "-" .. plat - if plat == "windows" and opt.pkgconfigs and opt.pkgconfigs.vs_runtime == "MT" then + local pkgconfigs = opt.pkgconfigs + if plat == "windows" and pkgconfigs and pkgconfigs.shared ~= true then triplet = triplet .. "-static" + assert(not pkgconfigs.vs_runtime or pkgconfigs.vs_runtime:startswith("MT"), "only support static libraries with /MT[d] for vcpkg!") end local infofile = find_file(format("%s_*_%s.list", name, triplet), infodir) diff --git a/xmake/modules/package/manager/vcpkg/install_package.lua b/xmake/modules/package/manager/vcpkg/install_package.lua index c46ec6723..60e06e7fa 100644 --- a/xmake/modules/package/manager/vcpkg/install_package.lua +++ b/xmake/modules/package/manager/vcpkg/install_package.lua @@ -50,8 +50,9 @@ function main(name, opt) -- init triplet local triplet = arch .. "-" .. plat - if opt.plat == "windows" and opt.vs_runtime == "MT" then + if opt.plat == "windows" and opt.shared ~= true then triplet = triplet .. "-static" + assert(not opt.vs_runtime or opt.vs_runtime:startswith("MT"), "only support static libraries with /MT[d] for vcpkg!") end -- init argv -- cgit v1.3.1