summaryrefslogtreecommitdiff
path: root/xmake/plugins/project/clang/compile_commands.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2019-08-31 22:11:00 +0800
committerruki <[email protected]>2019-08-31 22:11:00 +0800
commit9b62ca9a3bdccb9a37f80a6dd943dfd13a502a32 (patch)
tree34f3b6fc417b0ec5cc73c722244527290f3a13d3 /xmake/plugins/project/clang/compile_commands.lua
parente7ab648aa0bb953391204c6f081519421118e1d0 (diff)
fix all codes about sourcebatches
Diffstat (limited to 'xmake/plugins/project/clang/compile_commands.lua')
-rw-r--r--xmake/plugins/project/clang/compile_commands.lua24
1 files changed, 6 insertions, 18 deletions
diff --git a/xmake/plugins/project/clang/compile_commands.lua b/xmake/plugins/project/clang/compile_commands.lua
index 4c81c2890..a9f1adf93 100644
--- a/xmake/plugins/project/clang/compile_commands.lua
+++ b/xmake/plugins/project/clang/compile_commands.lua
@@ -55,21 +55,12 @@ function _make_object(jsonfile, target, sourcefile, objectfile)
_g.firstline = false
end
--- make each objects
-function _make_each_objects(jsonfile, target, sourcekind, sourcebatch)
+-- make objects
+function _make_objects(jsonfile, target, sourcekind, sourcebatch)
for index, objectfile in ipairs(sourcebatch.objectfiles) do
_make_object(jsonfile, target, sourcebatch.sourcefiles[index], objectfile)
end
end
-
--- make single object
-function _make_single_object(jsonfile, target, sourcekind, sourcebatch)
-
- -- not supported now, ignore it directly
- for _, sourcefile in ipairs(table.wrap(sourcebatch.sourcefiles)) do
- cprint("${bright color.warning}warning: ${clear}ignore[%s]: %s", target:name(), sourcefile)
- end
-end
-- make target
function _make_target(jsonfile, target)
@@ -80,13 +71,10 @@ function _make_target(jsonfile, target)
target:set("pcxxheader", nil)
-- build source batches
- for sourcekind, sourcebatch in pairs(target:sourcebatches()) do
- if not sourcebatch.rulename then
- if type(sourcebatch.objectfiles) == "string" then
- _make_single_object(jsonfile, target, sourcekind, sourcebatch)
- else
- _make_each_objects(jsonfile, target, sourcekind, sourcebatch)
- end
+ for _, sourcebatch in pairs(target:sourcebatches()) do
+ local sourcekind = sourcebatch.sourcekind
+ if sourcekind then
+ _make_objects(jsonfile, target, sourcekind, sourcebatch)
end
end
end