diff options
| author | ruki <[email protected]> | 2021-09-17 05:51:16 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2021-09-17 05:51:16 +0800 |
| commit | 86617f0db836447e9ea2d36cbfb281139e32e7f6 (patch) | |
| tree | 13b9672d17be09f92a7cf899e06f9435d0833d69 | |
| parent | 388ee60e90ade5ff712314d96036bbb3e789a3ea (diff) | |
| parent | 620ed4992ba78c11620e18591dcab85acc7bd600 (diff) | |
Merge pull request #1680 from xmake-io/fixpath
fix precompile path
| -rw-r--r-- | xmake/modules/private/action/require/impl/actions/install.lua | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/xmake/modules/private/action/require/impl/actions/install.lua b/xmake/modules/private/action/require/impl/actions/install.lua index e733cebfd..b6dad65d2 100644 --- a/xmake/modules/private/action/require/impl/actions/install.lua +++ b/xmake/modules/private/action/require/impl/actions/install.lua @@ -91,6 +91,33 @@ function _patch_pkgconfig(package) end end +-- fix paths for the precompiled package +-- @see https://github.com/xmake-io/xmake/issues/1671 +function _fix_paths_for_precompiled_package(package) + local librarydir = package:installdir("lib") + local filepaths = {path.join(librarydir, "cmake", "*", "*.cmake")} + for _, filepath in ipairs(filepaths) do + for _, file in ipairs(os.files(filepath)) do + io.gsub(file, "(\"(.-)\")", function(_, value) + if value:find(package:buildhash(), 1, true) and value:find(package:name(), 1, true) then + local result + local splitinfo = value:split(package:buildhash(), {plain = true}) + if #splitinfo == 2 then + result = path.join(package:installdir(), splitinfo[2]) + elseif #splitinfo == 1 then + result = package:installdir() + end + if result then + result = result:gsub("\\", "/") + vprint("fix path: %s in %s", result, path.filename(file)) + return "\"" .. result .. "\"" + end + end + end) + end + end +end + -- check package toolchains function _check_package_toolchains(package) for _, toolchain_inst in pairs(package:toolchains()) do @@ -196,6 +223,11 @@ function main(package) -- this package is installed now if installed_now then + -- fix paths for the precompiled package + if package:is_plat("windows") and not package:is_built() and not package:is_system() then + _fix_paths_for_precompiled_package(package) + end + -- patch pkg-config files for package _patch_pkgconfig(package) |
