summaryrefslogtreecommitdiff
path: root/xmake/plugins/project
diff options
context:
space:
mode:
authorruki <[email protected]>2022-11-19 23:12:43 +0800
committerruki <[email protected]>2022-11-19 23:12:43 +0800
commit6ea38bc4e39c2159fb99c84ef28adc53be06893a (patch)
tree4a9fed40845107326802c09cc95689b8cc8d6fe0 /xmake/plugins/project
parent6136908a543470d0f87d49de1ec50a4245188f6b (diff)
fix build.ninja #3082
Diffstat (limited to 'xmake/plugins/project')
-rw-r--r--xmake/plugins/project/ninja/build_ninja.lua15
1 files changed, 13 insertions, 2 deletions
diff --git a/xmake/plugins/project/ninja/build_ninja.lua b/xmake/plugins/project/ninja/build_ninja.lua
index 8089bc9ce..ebf1fcc2e 100644
--- a/xmake/plugins/project/ninja/build_ninja.lua
+++ b/xmake/plugins/project/ninja/build_ninja.lua
@@ -28,6 +28,17 @@ import("core.tool.compiler")
import("lib.detect.find_tool")
import("lib.detect.find_toolname")
+-- this sourcebatch is built?
+function _sourcebatch_is_built(sourcebatch)
+ -- we can only use rulename to filter them because sourcekind may be bound to multiple rules
+ local rulename = sourcebatch.rulename
+ if rulename == "c.build" or rulename == "c++.build"
+ or rulename == "asm.build" or rulename == "cuda.build"
+ or rulename == "objc.build" or rulename == "objc++.build" then
+ return true
+ end
+end
+
-- add header
function _add_header(ninjafile)
ninjafile:print([[# this is the build file for project %s
@@ -265,8 +276,8 @@ function _add_build_for_target(ninjafile, target)
ninjafile:print("")
-- build target objects
- for _, sourcebatch in pairs(target:sourcebatches()) do
- if sourcebatch.sourcekind then
+ for _, sourcebatch in table.orderpairs(target:sourcebatches()) do
+ if _sourcebatch_is_built(sourcebatch) then
_add_build_for_objects(ninjafile, target, sourcebatch)
end
end