summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2019-08-28 15:23:05 +0800
committerGitHub <[email protected]>2019-08-28 15:23:05 +0800
commit57d0b3900a27add2dbd81e186c7aa496ea9d369f (patch)
tree7ad9f5b8ea5622f3f2f139a84c845693874c2f5a
parent2770648ce5f29ae5287d42115c5ce8f5f08004d9 (diff)
parent689068989bcda7bd099f920691dc388eae82bd9a (diff)
Merge pull request #554 from OpportunityLiu/dev
add Natvis file support
-rw-r--r--xmake/plugins/project/vsxmake/vsproj/templates/vcxproj.filters/#target#.vcxproj.filters7
-rw-r--r--xmake/plugins/project/vsxmake/vsproj/templates/vcxproj.filters/Include.c(incc) (renamed from xmake/plugins/project/vsxmake/vsproj/templates/vcxproj.filters/Include(inc))0
-rw-r--r--xmake/plugins/project/vsxmake/vsproj/templates/vcxproj.filters/Include.natvis(incnatvis)3
-rw-r--r--xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/#target#.vcxproj7
-rw-r--r--xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/Include.c(incc) (renamed from xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/Include(inc))0
-rw-r--r--xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/Include.natvis(incnatvis)3
-rw-r--r--xmake/plugins/project/vsxmake/vsxmake.lua15
7 files changed, 20 insertions, 15 deletions
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 @@
</None>
</ItemGroup>
<ItemGroup>
-#Import(Include)#
+#Import(Include.c)#
+#Import(Include.natvis)#
</ItemGroup>
<ItemGroup>
#Import(File.c)#
- </ItemGroup>
- <ItemGroup>
#Import(File.cxx)#
- </ItemGroup>
- <ItemGroup>
#Import(File.cu)#
</ItemGroup>
<ItemGroup>
diff --git a/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj.filters/Include(inc) b/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj.filters/Include.c(incc)
index 8c9e8a547..8c9e8a547 100644
--- a/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj.filters/Include(inc)
+++ b/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj.filters/Include.c(incc)
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 @@
+ <Natvis Include="$(XmakeProjectDir)\#path#">
+ <Filter>#dir#</Filter>
+ </Natvis> \ 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 Project="$(XmakeProgramDir)\plugins\project\vsxmake\vsproj\Xmake.props" />
<ItemGroup>
-#Import(Include)#
+#Import(Include.c)#
+#Import(Include.natvis)#
</ItemGroup>
<ItemGroup>
#Import(File.c)#
- </ItemGroup>
- <ItemGroup>
#Import(File.cxx)#
- </ItemGroup>
- <ItemGroup>
#Import(File.cu)#
</ItemGroup>
<ItemGroup>
diff --git a/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/Include(inc) b/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/Include.c(incc)
index ddafd770a..ddafd770a 100644
--- a/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/Include(inc)
+++ b/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj/Include.c(incc)
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 @@
+ <Natvis Include="$(XmakeProjectDir)\#path#">
+ <FileType>Document</FileType>
+ </Natvis> \ 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