From 147fdfa379133d0d7d7f075ac9b4905401ff7126 Mon Sep 17 00:00:00 2001 From: usernameak Date: Sat, 6 Jun 2026 21:07:10 +0200 Subject: vsxmake: custom source types in solution explorer This allows seeing source files added by add_files but not directly supported by xmake (e.g. when support is provided by a custom rule) --- xmake/plugins/project/vsxmake/vsxmake.lua | 6 ++++++ .../vsproj/templates/vcxproj.filters/#target#.vcxproj.filters | 3 +++ .../vsxmake/vsproj/templates/vcxproj.filters/File.none(filenone) | 3 +++ xmake/scripts/vsxmake/vsproj/templates/vcxproj/#target#.vcxproj | 3 +++ xmake/scripts/vsxmake/vsproj/templates/vcxproj/File.none(filenone) | 1 + 5 files changed, 16 insertions(+) create mode 100644 xmake/scripts/vsxmake/vsproj/templates/vcxproj.filters/File.none(filenone) create mode 100644 xmake/scripts/vsxmake/vsproj/templates/vcxproj/File.none(filenone) diff --git a/xmake/plugins/project/vsxmake/vsxmake.lua b/xmake/plugins/project/vsxmake/vsxmake.lua index cd61dfcbf..6084d6b84 100644 --- a/xmake/plugins/project/vsxmake/vsxmake.lua +++ b/xmake/plugins/project/vsxmake/vsxmake.lua @@ -150,6 +150,12 @@ function _buildparams(info, target, default) elseif args.filecs then -- for c# local files = info._targets[target].sourcefiles table.insert(r, _filter_files(files, {".cs"})) + elseif args.filenone then -- for custom build steps + local files = info._targets[target].sourcefiles + table.insert(r, _filter_files(files, nil, { + ".c", ".cpp", ".cc", ".cxx", ".mpp", ".mxx", ".cppm", ".ixx", + ".cu", ".obj", ".o", ".rc", ".ui", ".qrc", ".ts", ".cs" + })) elseif args.incc then local files = table.join(info._targets[target].headerfiles or {}, info._targets[target].extrafiles) table.insert(r, _filter_files(files, nil, {".natvis"})) diff --git a/xmake/scripts/vsxmake/vsproj/templates/vcxproj.filters/#target#.vcxproj.filters b/xmake/scripts/vsxmake/vsproj/templates/vcxproj.filters/#target#.vcxproj.filters index 998c8af83..7d8131262 100644 --- a/xmake/scripts/vsxmake/vsproj/templates/vcxproj.filters/#target#.vcxproj.filters +++ b/xmake/scripts/vsxmake/vsproj/templates/vcxproj.filters/#target#.vcxproj.filters @@ -49,6 +49,9 @@ #Import(File.ui)# #Import(File.qrc)# #Import(File.ts)# + + +#Import(File.none)# diff --git a/xmake/scripts/vsxmake/vsproj/templates/vcxproj.filters/File.none(filenone) b/xmake/scripts/vsxmake/vsproj/templates/vcxproj.filters/File.none(filenone) new file mode 100644 index 000000000..9aee25191 --- /dev/null +++ b/xmake/scripts/vsxmake/vsproj/templates/vcxproj.filters/File.none(filenone) @@ -0,0 +1,3 @@ + + #dir# + diff --git a/xmake/scripts/vsxmake/vsproj/templates/vcxproj/#target#.vcxproj b/xmake/scripts/vsxmake/vsproj/templates/vcxproj/#target#.vcxproj index 21a7eb99a..a01ae9554 100644 --- a/xmake/scripts/vsxmake/vsproj/templates/vcxproj/#target#.vcxproj +++ b/xmake/scripts/vsxmake/vsproj/templates/vcxproj/#target#.vcxproj @@ -51,6 +51,9 @@ #Import(File.ui)# #Import(File.qrc)# #Import(File.ts)# + + +#Import(File.none)#