summaryrefslogtreecommitdiff
path: root/xmake/plugins
diff options
context:
space:
mode:
authorruki <[email protected]>2023-02-18 00:43:06 +0800
committerruki <[email protected]>2023-02-18 00:43:06 +0800
commit008d4d6b28b0475b4fc1cf0f88fcff7fd0f3c71b (patch)
tree8502c84f39dc8baee83078aa13ac0c624db5d535 /xmake/plugins
parent1e09fd1f030bc9f0deb4b7f2c6c406ebc2622639 (diff)
add executable_path
Diffstat (limited to 'xmake/plugins')
-rw-r--r--xmake/plugins/project/clang/compile_commands.lua20
1 files changed, 3 insertions, 17 deletions
diff --git a/xmake/plugins/project/clang/compile_commands.lua b/xmake/plugins/project/clang/compile_commands.lua
index e82bfb4f7..24a580d34 100644
--- a/xmake/plugins/project/clang/compile_commands.lua
+++ b/xmake/plugins/project/clang/compile_commands.lua
@@ -25,6 +25,7 @@ import("core.project.rule")
import("core.project.project")
import("core.language.language")
import("private.utils.batchcmds")
+import("private.utils.executable_path")
-- escape path
function _escape_path(p)
@@ -58,7 +59,6 @@ function _translate_arguments(arguments)
local cc = path.basename(arguments[1]):lower()
local is_include = false
local lsp = _get_lsp()
- local program_map = {}
for idx, arg in ipairs(arguments) do
-- convert path to string, maybe we need convert path, but not supported now.
arg = tostring(arg)
@@ -108,22 +108,8 @@ function _translate_arguments(arguments)
-- @see
-- https://github.com/xmake-io/xmake/issues/3159
-- https://github.com/xmake-io/xmake/issues/3286
- if idx == 1 and is_host("macosx") and arg:find("xcrun -sdk", 1, true) then
- local cmd = program_map[arg]
- if cmd == nil then
- cmd = arg:gsub("xcrun %-sdk (%S+) (%S+)", function (plat, cc)
- return "xcrun -sdk " .. plat .. " -f " .. cc
- end)
- local splitinfo = cmd:split("%s")
- local binpath = try {function() return os.iorunv(splitinfo[1], table.slice(splitinfo, 2) or {}) end}
- if binpath then
- binpath = binpath:trim()
- if #binpath > 0 then
- arg = binpath
- end
- end
- program_map[arg] = cmd
- end
+ if idx == 1 then
+ arg = executable_path(arg)
end
table.insert(args, arg)
end