diff options
| author | ruki <[email protected]> | 2018-08-21 23:17:50 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2018-08-21 13:47:05 +0800 |
| commit | c9d05eaf022540940434ca60e4c800cc2b321e01 (patch) | |
| tree | 07aec48e900bca355451f058844c746ec82fb74e | |
| parent | 3519fbff209ebf0b99290a780c1cc425b5ab99d8 (diff) | |
improve to find_pcre/pcre2 package
| -rw-r--r-- | xmake/modules/detect/packages/find_pcre.lua | 16 | ||||
| -rw-r--r-- | xmake/modules/detect/packages/find_pcre2.lua | 17 |
2 files changed, 33 insertions, 0 deletions
diff --git a/xmake/modules/detect/packages/find_pcre.lua b/xmake/modules/detect/packages/find_pcre.lua index 5e5db94c5..34a0e44ea 100644 --- a/xmake/modules/detect/packages/find_pcre.lua +++ b/xmake/modules/detect/packages/find_pcre.lua @@ -23,6 +23,7 @@ -- -- imports +import("lib.detect.vcpkg") import("lib.detect.pkg_config") -- find pcre @@ -33,6 +34,21 @@ import("lib.detect.pkg_config") -- function main(opt) + -- find package from vcpkg first + local result = vcpkg.find("pcre", opt) + if result then + local links = {} + for _, link in ipairs(result.links) do + links[link] = true + end + for _, width in ipairs({"", "16", "32"}) do + if links["pcre" .. width] then + result.links = {"pcre" .. width} + return result + end + end + end + -- find package from the current host platform if opt.plat == os.host() and opt.arch == os.arch() then for _, width in ipairs({"", "16", "32"}) do diff --git a/xmake/modules/detect/packages/find_pcre2.lua b/xmake/modules/detect/packages/find_pcre2.lua index 6ed5cfa8d..f36aad40e 100644 --- a/xmake/modules/detect/packages/find_pcre2.lua +++ b/xmake/modules/detect/packages/find_pcre2.lua @@ -23,6 +23,7 @@ -- -- imports +import("lib.detect.vcpkg") import("lib.detect.pkg_config") -- find pcre2 @@ -33,6 +34,22 @@ import("lib.detect.pkg_config") -- function main(opt) + -- find package from vcpkg first + local result = vcpkg.find("pcre2", opt) + if result then + local links = {} + for _, link in ipairs(result.links) do + links[link] = true + end + for _, width in ipairs({"8", "16", "32"}) do + if links["pcre2-" .. width] then + result.links = {"pcre2-" .. width} + result.defines = {"PCRE2_CODE_UNIT_WIDTH=" .. width} + return result + end + end + end + -- find package from the current host platform if opt.plat == os.host() and opt.arch == os.arch() then for _, width in ipairs({"8", "16", "32"}) do |
