summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--xmake/modules/detect/packages/find_pcre.lua16
-rw-r--r--xmake/modules/detect/packages/find_pcre2.lua17
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