Added support for CopyFileToFolders via Copy buildaction

- Added full table of supported C++ values for buildaction
This commit is contained in:
Sam Surtees 2022-10-08 16:24:32 +10:00
parent 7d241a6d98
commit 80e371b320
3 changed files with 53 additions and 1 deletions

View File

@ -107,11 +107,13 @@
-- Check handling of buildaction.
--
function suite.customBuildTool_onBuildAction()
files { "test.x", "test2.cpp", "test3.cpp" }
files { "test.x", "test2.cpp", "test3.cpp", "test4.dll" }
filter "files:**.x"
buildaction "FxCompile"
filter "files:test2.cpp"
buildaction "None"
filter { "files:test4.dll" }
buildaction "Copy"
prepare()
test.capture [[
<ItemGroup>
@ -122,6 +124,12 @@
</ItemGroup>
<ItemGroup>
<None Include="test2.cpp" />
</ItemGroup>
<ItemGroup>
<CopyFileToFolders Include="test4.dll">
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">bin\Debug</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">bin\Release</DestinationFolders>
</CopyFileToFolders>
</ItemGroup>
]]
end

View File

@ -1085,6 +1085,28 @@
end
}
---
-- Copy group
---
m.categories.Copy = {
name = "Copy",
priority = 13,
emitFiles = function(prj, group)
local fileCfgFunc = {
m.excludedFromBuild,
m.destinationFolders
}
m.emitFiles(prj, group, "CopyFileToFolders", nil, fileCfgFunc)
end,
emitFilter = function(prj, group)
m.filterGroup(prj, group, "CopyFileToFolders")
end
}
---
-- Categorize files into groups.
---
@ -1836,6 +1858,13 @@
end
function m.destinationFolders(filecfg, condition)
if filecfg then
m.element("DestinationFolders", condition, vstudio.path(filecfg.config, filecfg.config.buildtarget.directory))
end
end
function m.enableDpiAwareness(cfg)
local awareness = {
None = "false",

View File

@ -8,6 +8,21 @@ buildaction ("action")
For C/C++, `action` is the name of the MSBuild action as defined by the vcxproj format; eg: `ClCompile`, `FxCompile`, `None`, etc, and may refer to any such action available to MSBuild.
| Action | Description |
|-----------------|----------------------------------------------------------------------------------|
| ClInclude | Treat the file as an include file. |
| ClCompile | Treat the file as source code; compile and link it. |
| FxCompile | Treat the file as HLSL shader source code; compile and link it. |
| None | Do nothing with this file. |
| ResourceCompile | Copy/embed the file with the project resources. |
| CustomBuild | Treat the file as custom build code; compile and optionally link it. |
| Midl | Treat the file as MIDL source code; compile and link it. |
| Masm | Treat the file as MASM source code; compile and link it. |
| Image | Treat the file as an Image. |
| Natvis | Treat the file as Natvis source; use it for custom data layouts while debugging. |
| AppxManifest | Treat the file as AppX Manifest; required for UWP applications. |
| Copy | Copy the file to the target directory. |
For C# projects, `buildaction` behaviour is special to support legacy implementation.
In C#, `action` is one of