diff options
| author | ruki <[email protected]> | 2019-10-25 00:48:22 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2019-10-24 22:50:18 +0800 |
| commit | 2f623aed782cd56f9cdd28e94e258c854cbfeab8 (patch) | |
| tree | 6d0c3e6e5a1e5b9dd26f99f5388b4dff5073ff22 /xmake/modules | |
| parent | e5f1534779029d20e2cb3f1d92405f7d88a976e0 (diff) | |
support vs_runtime for vcpkg
Diffstat (limited to 'xmake/modules')
| -rw-r--r-- | xmake/modules/lib/detect/find_package.lua | 3 | ||||
| -rw-r--r-- | xmake/modules/package/manager/vcpkg/find_package.lua | 12 | ||||
| -rw-r--r-- | xmake/modules/package/manager/vcpkg/install_package.lua | 8 |
3 files changed, 17 insertions, 6 deletions
diff --git a/xmake/modules/lib/detect/find_package.lua b/xmake/modules/lib/detect/find_package.lua index 7401d03c6..b928d722c 100644 --- a/xmake/modules/lib/detect/find_package.lua +++ b/xmake/modules/lib/detect/find_package.lua @@ -31,7 +31,8 @@ import("package.manager.find_package") -- @param opt the options -- e.g. { verbose = false, force = false, plat = "iphoneos", arch = "arm64", mode = "debug", version = "1.0.x", -- linkdirs = {"/usr/lib"}, includedirs = "/usr/include", links = {"ssl"}, includes = {"ssl.h"} --- packagedirs = {"/tmp/packages"}, system = true, cachekey = "xxxx"} +-- packagedirs = {"/tmp/packages"}, system = true, cachekey = "xxxx" +-- pkgconfigs = {..}} -- -- @return {links = {"ssl", "crypto", "z"}, linkdirs = {"/usr/local/lib"}, includedirs = {"/usr/local/include"}} -- diff --git a/xmake/modules/package/manager/vcpkg/find_package.lua b/xmake/modules/package/manager/vcpkg/find_package.lua index aa47e35a1..ec7cf6775 100644 --- a/xmake/modules/package/manager/vcpkg/find_package.lua +++ b/xmake/modules/package/manager/vcpkg/find_package.lua @@ -27,7 +27,7 @@ import("core.project.target") -- find package from the brew package manager -- --- @param name the package name, e.g. zlib, pcre/libpcre16 +-- @param name the package name, e.g. zlib, pcre -- @param opt the options, e.g. {verbose = true, version = "1.12.x") -- function main(name, opt) @@ -55,8 +55,12 @@ function main(name, opt) -- get the vcpkg info directory local infodir = path.join(installdir, "vcpkg", "info") - -- find the package info file, e.g. zlib_1.2.11-3_x86-windows.list - local infofile = find_file(format("%s_*_%s-%s.list", name, arch, plat), infodir) + -- 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 + triplet = triplet .. "-static" + end + local infofile = find_file(format("%s_*_%s.list", name, triplet), infodir) -- save includedirs, linkdirs and links local result = nil @@ -74,7 +78,7 @@ function main(name, opt) -- get linkdirs and links if (plat == "windows" and line:endswith(".lib")) or line:endswith(".a") then - if line:find(plat .. (mode == "debug" and "/debug" or "") .. "/lib/", 1, true) then + if line:find(triplet .. (mode == "debug" and "/debug" or "") .. "/lib/", 1, true) then result = result or {} result.links = result.links or {} result.linkdirs = result.linkdirs or {} diff --git a/xmake/modules/package/manager/vcpkg/install_package.lua b/xmake/modules/package/manager/vcpkg/install_package.lua index 3ee244c2f..b38fdad15 100644 --- a/xmake/modules/package/manager/vcpkg/install_package.lua +++ b/xmake/modules/package/manager/vcpkg/install_package.lua @@ -48,8 +48,14 @@ function main(name, opt) arch = "x64" end + -- init triplet + local triplet = arch .. "-" .. plat + if opt.plat == "windows" and opt.vs_runtime == "MT" then + triplet = triplet .. "-static" + end + -- init argv - local argv = {"install", string.format("%s:%s-%s", name, arch, plat)} + local argv = {"install", name .. ":" .. triplet} -- install package os.vrunv(path.join(vcpkgdir, "vcpkg"), argv) |
