diff options
| author | ruki <[email protected]> | 2019-01-29 22:34:11 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2019-01-29 09:25:07 +0800 |
| commit | 2a8b05d146a9fd53aa5784e36dca45cbce2ce272 (patch) | |
| tree | d2b942facef69e155e054fa808bdc4a256b0af01 /xmake/modules/package/manager/conan/find_package.lua | |
| parent | 25d080557a3667ebd49015728bfe860585be0ed8 (diff) | |
improve to find_package
Diffstat (limited to 'xmake/modules/package/manager/conan/find_package.lua')
| -rw-r--r-- | xmake/modules/package/manager/conan/find_package.lua | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/xmake/modules/package/manager/conan/find_package.lua b/xmake/modules/package/manager/conan/find_package.lua index bc386d50a..ca39a2f12 100644 --- a/xmake/modules/package/manager/conan/find_package.lua +++ b/xmake/modules/package/manager/conan/find_package.lua @@ -24,6 +24,12 @@ -- imports import("core.base.option") +import("core.project.config") + +-- get build info file +function _get_buildinfo_file(name) + return path.absolute(path.join(config.buildir() or os.tmpdir(), ".conan", name, "conanbuildinfo.xmake.lua")) +end -- find package using the conan package manager -- @@ -32,4 +38,25 @@ import("core.base.option") -- function main(name, opt) + -- get the build info + local buildinfo_file = _get_buildinfo_file(name) + if not os.isfile(buildinfo_file) then + return + end + + -- load build info + local buildinfo = io.load(buildinfo_file) + + -- get the package info of the given platform, architecture and mode + local found = false + local result = {} + for k, v in pairs(buildinfo[opt.plat .. "_" .. opt.arch .. "_" .. opt.mode]) do + if #table.wrap(v) > 0 then + result[k] = v + found = true + end + end + if found then + return result + end end |
