diff options
| author | ruki <[email protected]> | 2021-09-29 22:38:25 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2021-09-29 22:38:25 +0800 |
| commit | 9b6ed10af9394ac3db541f848ab3405b7d0daf3d (patch) | |
| tree | 0231379130068a4d342d37271b250c9e30e2f979 /xmake/core/package | |
| parent | e582b4601a0821bf9a94ac1b568aff55c842131e (diff) | |
improve find_package
Diffstat (limited to 'xmake/core/package')
| -rw-r--r-- | xmake/core/package/package.lua | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/xmake/core/package/package.lua b/xmake/core/package/package.lua index a29c4fd1f..5c7a04d34 100644 --- a/xmake/core/package/package.lua +++ b/xmake/core/package/package.lua @@ -521,8 +521,16 @@ end -- get the cached directory of this package function _instance:cachedir() - local name = self:name():lower():gsub("::", "_") - return path.join(package.cachedir(), name:sub(1, 1):lower(), name, self:version_str()) + local cachedir = self._CACHEDIR + if not cachedir then + cachedir = self:get("cachedir") + if not cachedir then + local name = self:name():lower():gsub("::", "_") + cachedir = path.join(package.cachedir(), name:sub(1, 1):lower(), name, self:version_str()) + end + self._CACHEDIR = cachedir + end + return cachedir end -- get the installed directory of this package @@ -1213,6 +1221,7 @@ function _instance:find_tool(name, opt) opt = opt or {} self._find_tool = self._find_tool or sandbox_module.import("lib.detect.find_tool", {anonymous = true}) return self._find_tool(name, {cachekey = opt.cachekey or "fetch_package_system", + installdir = self:installdir(), require_version = opt.require_version, norun = opt.norun, force = opt.force}) @@ -1228,6 +1237,7 @@ function _instance:find_package(name, opt) end return self._find_package(name, { force = opt.force, + installdir = self:installdir(), require_version = opt.require_version, mode = self:mode(), plat = self:plat(), @@ -1721,6 +1731,7 @@ function package.apis() , "package.set_description" , "package.set_parallelize" , "package.set_sourcedir" + , "package.set_cachedir" , "package.set_installdir" -- package.add_xxx , "package.add_deps" |
