summaryrefslogtreecommitdiff
path: root/xmake/plugins
diff options
context:
space:
mode:
authorA2va <[email protected]>2023-09-30 17:58:56 +0200
committerA2va <[email protected]>2023-09-30 17:58:56 +0200
commit434993362b6c4a6a2f20bd634b71eb4f27221253 (patch)
tree69244a043f8bb9d2587ecff0722096cbb16e4985 /xmake/plugins
parentb637e0acc32faeeda669e135c546999c4a8e0c17 (diff)
Fix orderpairs with sourcebatches
Diffstat (limited to 'xmake/plugins')
-rw-r--r--xmake/plugins/project/cmake/cmakelists.lua9
-rw-r--r--xmake/plugins/project/ninja/build_ninja.lua3
-rw-r--r--xmake/plugins/project/vstudio/impl/vs201x.lua6
3 files changed, 12 insertions, 6 deletions
diff --git a/xmake/plugins/project/cmake/cmakelists.lua b/xmake/plugins/project/cmake/cmakelists.lua
index e4cf59e96..e0b12ae1a 100644
--- a/xmake/plugins/project/cmake/cmakelists.lua
+++ b/xmake/plugins/project/cmake/cmakelists.lua
@@ -381,7 +381,8 @@ end
function _add_target_sources(cmakelists, target, outputdir)
local has_cuda = false
cmakelists:print("target_sources(%s PRIVATE", target:name())
- for _, sourcebatch in table.orderpairs(target:sourcebatches()) do
+ local sourcebatches, _ = target:sourcebatches()
+ for _, sourcebatch in table.orderpairs(sourcebatches) do
if _sourcebatch_is_built(sourcebatch) then
for _, sourcefile in ipairs(sourcebatch.sourcefiles) do
cmakelists:print(" " .. _get_relative_unix_path(sourcefile, outputdir))
@@ -612,7 +613,8 @@ function _add_target_compile_options(cmakelists, target, outputdir)
end
-- add cflags/cxxflags for the specific source files
- for _, sourcebatch in table.orderpairs(target:sourcebatches()) do
+ local sourcebatches, _ = target:sourcebatches()
+ for _, sourcebatch in table.orderpairs(sourcebatches) do
if _sourcebatch_is_built(sourcebatch) then
for _, sourcefile in ipairs(sourcebatch.sourcefiles) do
_add_target_sourcefiles_flags(cmakelists, target, sourcefile, "cxxflags", outputdir)
@@ -835,7 +837,8 @@ function _add_target_link_libraries(cmakelists, target, outputdir)
-- add other object files, maybe from custom rules
local objectfiles_set = hashset.new()
- for _, sourcebatch in table.orderpairs(target:sourcebatches()) do
+ local sourcebatches, _ = target:sourcebatches()
+ for _, sourcebatch in table.orderpairs(sourcebatches) do
if _sourcebatch_is_built(sourcebatch) then
for _, objectfile in ipairs(sourcebatch.objectfiles) do
objectfiles_set:insert(objectfile)
diff --git a/xmake/plugins/project/ninja/build_ninja.lua b/xmake/plugins/project/ninja/build_ninja.lua
index 360bb075c..8e5677e45 100644
--- a/xmake/plugins/project/ninja/build_ninja.lua
+++ b/xmake/plugins/project/ninja/build_ninja.lua
@@ -366,7 +366,8 @@ function _add_build_for_target(ninjafile, target, outputdir)
ninjafile:print("")
-- build target objects
- for _, sourcebatch in table.orderpairs(target:sourcebatches()) do
+ local sourcebatches, _ = target:sourcebatches()
+ for _, sourcebatch in table.orderpairs(sourcebatches) do
if _sourcebatch_is_built(sourcebatch) then
_add_build_for_objects(ninjafile, target, sourcebatch, outputdir)
end
diff --git a/xmake/plugins/project/vstudio/impl/vs201x.lua b/xmake/plugins/project/vstudio/impl/vs201x.lua
index 511494b19..699b5df47 100644
--- a/xmake/plugins/project/vstudio/impl/vs201x.lua
+++ b/xmake/plugins/project/vstudio/impl/vs201x.lua
@@ -213,7 +213,8 @@ function _make_custom_commands(target, vcxprojdir)
local commands = {}
_make_custom_commands_for_target(commands, target, vcxprojdir, "before")
_make_custom_commands_for_target(commands, target, vcxprojdir)
- for _, sourcebatch in table.orderpairs(target:sourcebatches()) do
+ local sourcebatches, _ = target:sourcebatches()
+ for _, sourcebatch in table.orderpairs(sourcebatches) do
local rulename = sourcebatch.rulename
local sourcekind = sourcebatch.sourcekind
if rulename ~= "c.build" and rulename ~= "c++.build" and rulename ~= "asm.build" and rulename ~= "cuda.build" and sourcekind ~= "mrc" then
@@ -281,7 +282,8 @@ function _make_targetinfo(mode, arch, target, vcxprojdir)
local firstcompflags = nil
targetinfo.compflags = {}
targetinfo.compargvs = {}
- for _, sourcebatch in table.orderpairs(target:sourcebatches()) do
+ local sourcebatches, _ = target:sourcebatches()
+ for _, sourcebatch in table.orderpairs(sourcebatches) do
local sourcekind = sourcebatch.sourcekind
local rulename = sourcebatch.rulename
if sourcekind then