diff options
| author | ruki <[email protected]> | 2019-01-24 00:48:14 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2019-01-23 22:49:27 +0800 |
| commit | dae284b933cea7f3717a5a0dee3f18304b3fb1e0 (patch) | |
| tree | 4c8e23bb698b570ff5d150f9004106384ff1c359 /xmake/modules/detect/packages/find_libxml2.lua | |
| parent | 7d9fe778c235da802039bf46c62cd4142f4719e4 (diff) | |
improve lib.detect.find_package
Diffstat (limited to 'xmake/modules/detect/packages/find_libxml2.lua')
| -rw-r--r-- | xmake/modules/detect/packages/find_libxml2.lua | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/xmake/modules/detect/packages/find_libxml2.lua b/xmake/modules/detect/packages/find_libxml2.lua index 307ac0899..2a71e3b99 100644 --- a/xmake/modules/detect/packages/find_libxml2.lua +++ b/xmake/modules/detect/packages/find_libxml2.lua @@ -23,7 +23,7 @@ -- -- imports -import("lib.detect.pkg_config") +import("package.manager.find_package") -- find libxml2 -- @@ -33,16 +33,25 @@ import("lib.detect.pkg_config") -- function main(opt) - -- find package from the current host platform - if opt.plat == os.host() and opt.arch == os.arch() then - local result = pkg_config.find("libxml2") - if result then - local includedirs = {} - for _, includedir in ipairs(result.includedirs) do + -- find package by the builtin script + local result = opt.find_package("libxml2", opt) + + -- find package from the homebrew package manager + if not result and opt.plat == os.host() and opt.arch == os.arch() then + result = find_package("brew::libxml2/libxml-2.0", opt) + end + + -- patch "include/libxml2" + if result then + local includedirs = {} + for _, includedir in ipairs(result.includedirs) do + if includedir:endswith("include") then table.insert(includedirs, path.join(includedir, "libxml2")) + else + table.insert(includedirs, includedir) end - result.includedirs = includedirs - return result end + result.includedirs = includedirs end + return result end |
