diff options
| author | ruki <[email protected]> | 2019-09-04 10:09:50 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2019-09-04 10:09:50 +0800 |
| commit | 1a1eac4f9e099eed250d72f309cf479efbb15a1c (patch) | |
| tree | bd0341661b3db9fc2f557b6b4186d5193671371d /xmake/plugins/project/vstudio/impl | |
| parent | c97ee9d0ba48ac615caa9f239436645bc2e0af5a (diff) | |
| parent | 3d72809db048911efec3d52106dd6968349ef4d1 (diff) | |
Merge pull request #563 from xmake-io/buildrules
Separate build rules for specific language files from action/build
Diffstat (limited to 'xmake/plugins/project/vstudio/impl')
| -rw-r--r-- | xmake/plugins/project/vstudio/impl/vs200x_vcproj.lua | 11 | ||||
| -rw-r--r-- | xmake/plugins/project/vstudio/impl/vs201x.lua | 5 | ||||
| -rw-r--r-- | xmake/plugins/project/vstudio/impl/vs201x_vcxproj.lua | 10 |
3 files changed, 16 insertions, 10 deletions
diff --git a/xmake/plugins/project/vstudio/impl/vs200x_vcproj.lua b/xmake/plugins/project/vstudio/impl/vs200x_vcproj.lua index 106b97709..149330276 100644 --- a/xmake/plugins/project/vstudio/impl/vs200x_vcproj.lua +++ b/xmake/plugins/project/vstudio/impl/vs200x_vcproj.lua @@ -251,8 +251,9 @@ function _make_configurations(vcprojfile, vsinfo, target, vcprojdir) -- save compiler flags local compflags=nil - for sourcekind, sourcebatch in pairs(target:sourcebatches()) do - if not sourcebatch.rulename then + for _, sourcebatch in pairs(target:sourcebatches()) do + local sourcekind = sourcebatch.sourcekind + if sourcekind then for _, sourcefile in ipairs(sourcebatch.sourcefiles) do local flags = compiler.compflags(sourcefile, {target = target}) if sourcekind == "cc" or sourcekind == "cxx" then @@ -526,7 +527,8 @@ function _make_files(vcprojfile, vsinfo, target, vcprojdir) local sourcebatches = target:sourcebatches() -- c/cxx files vcprojfile:enter("<Filter Name=\"Source Files\">") - for sourcekind, sourcebatch in pairs(sourcebatches) do + for _, sourcebatch in pairs(sourcebatches) do + local sourcekind = sourcebatch.sourcekind if sourcekind ~= "mrc" then local objectfiles = sourcebatch.objectfiles for idx, sourcefile in ipairs(sourcebatch.sourcefiles) do @@ -540,7 +542,8 @@ function _make_files(vcprojfile, vsinfo, target, vcprojdir) -- *.rc files vcprojfile:enter("<Filter Name=\"Resource Files\">") - for sourcekind, sourcebatch in pairs(sourcebatches) do + for _, sourcebatch in pairs(sourcebatches) do + local sourcekind = sourcebatch.sourcekind if sourcekind == "mrc" then local objectfiles = sourcebatch.objectfiles for idx, sourcefile in ipairs(sourcebatch.sourcefiles) do diff --git a/xmake/plugins/project/vstudio/impl/vs201x.lua b/xmake/plugins/project/vstudio/impl/vs201x.lua index af0a18d0c..4d68019bb 100644 --- a/xmake/plugins/project/vstudio/impl/vs201x.lua +++ b/xmake/plugins/project/vstudio/impl/vs201x.lua @@ -74,8 +74,9 @@ function _make_targetinfo(mode, arch, target) local firstcompflags = nil targetinfo.compflags = {} targetinfo.compargvs = {} - for sourcekind, sourcebatch in pairs(target:sourcebatches()) do - if not sourcebatch.rulename then + for _, sourcebatch in pairs(target:sourcebatches()) do + local sourcekind = sourcebatch.sourcekind + if sourcekind then for idx, sourcefile in ipairs(sourcebatch.sourcefiles) do local compflags = compiler.compflags(sourcefile, {target = target}) if not firstcompflags and (sourcekind == "cc" or sourcekind == "cxx") then diff --git a/xmake/plugins/project/vstudio/impl/vs201x_vcxproj.lua b/xmake/plugins/project/vstudio/impl/vs201x_vcxproj.lua index 8f6549281..65a6bad0a 100644 --- a/xmake/plugins/project/vstudio/impl/vs201x_vcxproj.lua +++ b/xmake/plugins/project/vstudio/impl/vs201x_vcxproj.lua @@ -457,8 +457,9 @@ function _make_common_items(vcxprojfile, vsinfo, target, vcxprojdir) local files_count = 0 local first_flags = nil targetinfo.sourceflags = {} - for sourcekind, sourcebatch in pairs(targetinfo.sourcebatches) do - if not sourcebatch.rulename and (sourcekind == "cc" or sourcekind == "cxx" or sourcekind == "as" or sourcekind == "mrc") then + for _, sourcebatch in pairs(targetinfo.sourcebatches) do + local sourcekind = sourcebatch.sourcekind + if (sourcekind == "cc" or sourcekind == "cxx" or sourcekind == "as" or sourcekind == "mrc") then for _, sourcefile in ipairs(sourcebatch.sourcefiles) do -- make compiler flags @@ -715,8 +716,9 @@ function _make_source_files(vcxprojfile, vsinfo, target, vcxprojdir) -- make source file infos local sourceinfos = {} for _, targetinfo in ipairs(target.info) do - for sourcekind, sourcebatch in pairs(targetinfo.sourcebatches) do - if not sourcebatch.rulename and (sourcekind == "cc" or sourcekind == "cxx" or sourcekind == "as" or sourcekind == "mrc") then + for _, sourcebatch in pairs(targetinfo.sourcebatches) do + local sourcekind = sourcebatch.sourcekind + if (sourcekind == "cc" or sourcekind == "cxx" or sourcekind == "as" or sourcekind == "mrc") then local objectfiles = sourcebatch.objectfiles for idx, sourcefile in ipairs(sourcebatch.sourcefiles) do local objectfile = objectfiles[idx] |
