From 689068989bcda7bd099f920691dc388eae82bd9a Mon Sep 17 00:00:00 2001 From: OpportunityLiu Date: Wed, 28 Aug 2019 11:38:25 +0800 Subject: add Natvis file support --- .../templates/vcxproj.filters/#target#.vcxproj.filters | 7 ++----- .../vsxmake/vsproj/templates/vcxproj.filters/Include(inc) | 3 --- .../vsproj/templates/vcxproj.filters/Include.c(incc) | 3 +++ .../templates/vcxproj.filters/Include.natvis(incnatvis) | 3 +++ .../vsxmake/vsproj/templates/vcxproj/#target#.vcxproj | 7 ++----- .../project/vsxmake/vsproj/templates/vcxproj/Include(inc) | 1 - .../vsxmake/vsproj/templates/vcxproj/Include.c(incc) | 1 + .../vsproj/templates/vcxproj/Include.natvis(incnatvis) | 3 +++ xmake/plugins/project/vsxmake/vsxmake.lua | 15 ++++++++++----- 9 files changed, 24 insertions(+), 19 deletions(-) delete mode 100644 xmake/plugins/project/vsxmake/vsproj/templates/vcxproj.filters/Include(inc) create mode 100644 xmake/plugins/project/vsxmake/vsproj/templates/vcxproj.filters/Include.c(incc) create mode 100644 xmake/plugins/project/vsxmake/vsproj/templates/vcxproj.filters/Include.natvis(incnatvis) delete mode 100644 xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/Include(inc) create mode 100644 xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/Include.c(incc) create mode 100644 xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/Include.natvis(incnatvis) diff --git a/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj.filters/#target#.vcxproj.filters b/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj.filters/#target#.vcxproj.filters index ce686b448..eb8dfdb75 100644 --- a/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj.filters/#target#.vcxproj.filters +++ b/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj.filters/#target#.vcxproj.filters @@ -32,15 +32,12 @@ -#Import(Include)# +#Import(Include.c)# +#Import(Include.natvis)# #Import(File.c)# - - #Import(File.cxx)# - - #Import(File.cu)# diff --git a/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj.filters/Include(inc) b/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj.filters/Include(inc) deleted file mode 100644 index 8c9e8a547..000000000 --- a/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj.filters/Include(inc) +++ /dev/null @@ -1,3 +0,0 @@ - - #dir# - diff --git a/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj.filters/Include.c(incc) b/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj.filters/Include.c(incc) new file mode 100644 index 000000000..8c9e8a547 --- /dev/null +++ b/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj.filters/Include.c(incc) @@ -0,0 +1,3 @@ + + #dir# + diff --git a/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj.filters/Include.natvis(incnatvis) b/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj.filters/Include.natvis(incnatvis) new file mode 100644 index 000000000..a00726a8b --- /dev/null +++ b/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj.filters/Include.natvis(incnatvis) @@ -0,0 +1,3 @@ + + #dir# + \ No newline at end of file diff --git a/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/#target#.vcxproj b/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/#target#.vcxproj index 45fcab98b..9083dc278 100644 --- a/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/#target#.vcxproj +++ b/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/#target#.vcxproj @@ -32,15 +32,12 @@ #Import(XmakePath)# -#Import(Include)# +#Import(Include.c)# +#Import(Include.natvis)# #Import(File.c)# - - #Import(File.cxx)# - - #Import(File.cu)# diff --git a/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/Include(inc) b/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/Include(inc) deleted file mode 100644 index ddafd770a..000000000 --- a/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/Include(inc) +++ /dev/null @@ -1 +0,0 @@ - diff --git a/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/Include.c(incc) b/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/Include.c(incc) new file mode 100644 index 000000000..ddafd770a --- /dev/null +++ b/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/Include.c(incc) @@ -0,0 +1 @@ + diff --git a/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/Include.natvis(incnatvis) b/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/Include.natvis(incnatvis) new file mode 100644 index 000000000..5145694e7 --- /dev/null +++ b/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/Include.natvis(incnatvis) @@ -0,0 +1,3 @@ + + Document + \ No newline at end of file diff --git a/xmake/plugins/project/vsxmake/vsxmake.lua b/xmake/plugins/project/vsxmake/vsxmake.lua index 8b4bc2a38..015ecbab5 100644 --- a/xmake/plugins/project/vsxmake/vsxmake.lua +++ b/xmake/plugins/project/vsxmake/vsxmake.lua @@ -35,12 +35,13 @@ local template_targets = path.join(template_root, "Xmake.Custom.targets") local template_items = path.join(template_root, "Xmake.Custom.items") local template_itemfil = path.join(template_root, "Xmake.Custom.items.filters") -function _filter_files(files, exts) - local extset = hashset.from(exts) +function _filter_files(files, includeexts, excludeexts) + local positive = not excludeexts + local extset = hashset.from(positive and includeexts or excludeexts) local f = {} for _, file in ipairs(files) do local ext = path.extension(file) - if extset:has(ext) then + if (positive and extset:has(ext)) or not (positive or extset:has(ext)) then table.insert(f, file) end end @@ -102,8 +103,12 @@ function _buildparams(info, target, default) elseif args.filerc then local files = info._sub[target].sourcefiles table.insert(r, _filter_files(files, {".rc"})) - elseif args.inc then - table.insert(r, info._sub[target].headerfiles) + elseif args.incc then + local files = info._sub[target].headerfiles + table.insert(r, _filter_files(files, nil, {".natvis"})) + elseif args.incnatvis then + local files = info._sub[target].headerfiles + table.insert(r, _filter_files(files, {".natvis"})) end return r end -- cgit v1.3.1