summaryrefslogtreecommitdiff
path: root/xmake/modules/package/manager
diff options
context:
space:
mode:
authorruki <[email protected]>2019-01-29 22:34:11 +0800
committerruki <[email protected]>2019-01-29 09:25:07 +0800
commit2a8b05d146a9fd53aa5784e36dca45cbce2ce272 (patch)
treed2b942facef69e155e054fa808bdc4a256b0af01 /xmake/modules/package/manager
parent25d080557a3667ebd49015728bfe860585be0ed8 (diff)
improve to find_package
Diffstat (limited to 'xmake/modules/package/manager')
-rw-r--r--xmake/modules/package/manager/conan/find_package.lua27
-rw-r--r--xmake/modules/package/manager/conan/install_package.lua4
-rw-r--r--xmake/modules/package/manager/xmake/find_package.lua9
3 files changed, 35 insertions, 5 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
diff --git a/xmake/modules/package/manager/conan/install_package.lua b/xmake/modules/package/manager/conan/install_package.lua
index d1db99998..3d7af9078 100644
--- a/xmake/modules/package/manager/conan/install_package.lua
+++ b/xmake/modules/package/manager/conan/install_package.lua
@@ -29,14 +29,14 @@ import("lib.detect.find_tool")
-- get build directory
function _get_build_directory(name)
- return path.join(config.buildir() or os.tmpdir(), ".conan", name)
+ return path.absolute(path.join(config.buildir() or os.tmpdir(), ".conan", name))
end
-- generate conanfile.txt
function _generate_conanfile(name, opt)
-- trace
- dprint("generate conanfile.txt ..")
+ dprint("generate %s ..", path.join(_get_build_directory(name), "conanfile.txt"))
-- get conan options and imports
local options = table.wrap(opt.options)
diff --git a/xmake/modules/package/manager/xmake/find_package.lua b/xmake/modules/package/manager/xmake/find_package.lua
index dc0511476..f662a626f 100644
--- a/xmake/modules/package/manager/xmake/find_package.lua
+++ b/xmake/modules/package/manager/xmake/find_package.lua
@@ -35,17 +35,20 @@ import("lib.detect.find_library")
-- find package from the repository (maybe only include and no links)
function _find_package_from_repo(name, opt)
+ -- get build mode, e.g. debug_f7821231
+ local mode = table.concat({opt.mode or "release", opt.configs_hash}, '_')
+
-- get the prefix directories
local prefixdirs = table.wrap(opt.prefixdirs)
local platsubdirs = path.join(config.get("plat") or os.host(), config.get("arch") or os.arch())
if #prefixdirs == 0 then
- table.insert(prefixdirs, path.join(opt.islocal and config.directory() or global.directory(), "prefix", platsubdirs, opt.mode or "release"))
+ table.insert(prefixdirs, path.join(opt.islocal and config.directory() or global.directory(), "prefix", platsubdirs, mode))
end
-- find the prefix info file of package, .e.g prefix/info/z/zlib/1.2.11/info.txt
local packagedirs = {}
local packagepath = path.join(name:sub(1, 1), name, "*")
- table.insert(packagedirs, path.join(opt.islocal and config.directory() or global.directory(), "prefix", "info", platsubdirs, opt.mode or "release", packagepath))
+ table.insert(packagedirs, path.join(opt.islocal and config.directory() or global.directory(), "prefix", "info", platsubdirs, mode, packagepath))
local prefixfile = find_file("info.txt", packagedirs)
if not prefixfile then
return
@@ -256,7 +259,7 @@ end
-- find package using the xmake package manager
--
-- @param name the package name
--- @param opt the options, .e.g {verbose = true, version = "1.12.x")
+-- @param opt the options, .e.g {verbose = true, version = "1.12.x", configs_hash = "xxxxxx")
--
function main(name, opt)