Closed ChemistAion closed 1 year ago
If someone will stuck with similar issue here is what I did:
public override void PostConfigureAll(Configuration conf, CustomTarget target)
{
string packageDir = "$(TargetDir)d3d12";
conf.EventPreBuild.Add(string.Format(@"mkdir ""{0}"" >nul", packageDir));
conf.EventPreBuild.Add(conf.CreateTargetCopyCommand(@"[project.SharpmakeCsPath]\packages\agilitysdk\build\native\bin\x64\d3d12core.dll", $"{packageDir}", ""));
conf.EventPreBuild.Add(conf.CreateTargetCopyCommand(@"[project.SharpmakeCsPath]\packages\agilitysdk\build\native\bin\x64\d3d12SDKLayers.dll", $"{packageDir}", ""));
}
Common macros for MSBuild commands and properties: https://learn.microsoft.com/en-us/cpp/build/reference/common-macros-for-build-commands-and-properties?view=msvc-170
I will leave this issue open for now, until someone from sharpmake team would confirm that I am doing THIS correctly.
Just use conf.TargetCopyFilesToSubDirectory
:)
(not part of sharpmake team anymore though :D)
Perfect, thanks for pointing out that one.
@belkiss (or someone from the Sharpmake team)
...ehh, could you please assist me with this?
After some trials, I am unsure about how to properly utilize conf.TargetCopyFilesToSubDirectory
(possibly due to my limited C# skills).
As mentioned earlier, here is my use case: https://github.com/ubisoft/Sharpmake/issues/268#issuecomment-1509116417
Please note that I also require the creation of the d3d12 directory during the process. Is it possible to achieve this in a single step?
Solution:
using System;
using System.Collections.Generic;
///
public override void PostConfigureAll(Configuration conf, CustomTarget target)
{
conf.TargetCopyFiles.Add(@"[project.SharpmakeCsPath]\packages\pix\bin\x64\winpixeventruntime.dll");
conf.TargetCopyFiles.Add(@"[project.SharpmakeCsPath]\externals\rps\tools\rps_hlslc\win-x64\rps-jit.dll");
conf.TargetCopyFilesToSubDirectory.Add(new KeyValuePair<string, string>(@"[project.SharpmakeCsPath]\packages\agilitysdk\build\native\bin\x64\d3d12core.*", "d3d12"));
conf.TargetCopyFilesToSubDirectory.Add(new KeyValuePair<string, string>(@"[project.SharpmakeCsPath]\packages\agilitysdk\build\native\bin\x64\d3d12sdklayers.*", "d3d12"));
conf.TargetCopyFilesToSubDirectory.Add(new KeyValuePair<string, string>(@"[project.SharpmakeCsPath]\externals\rps\tools\rps_hlslc\win-x64\dxcompiler.dll", "rps_hlslc"));
conf.TargetCopyFilesToSubDirectory.Add(new KeyValuePair<string, string>(@"[project.SharpmakeCsPath]\externals\rps\tools\rps_hlslc\win-x64\dxil.dll", "rps_hlslc"));
conf.TargetCopyFilesToSubDirectory.Add(new KeyValuePair<string, string>(@"[project.SharpmakeCsPath]\externals\rps\tools\rps_hlslc\win-x64\rps-hlslc.exe", "rps_hlslc"));
}
I need to copy some bin-files into a sub-dir of TargetCopyFilesPath, namely:
d3d12
This sub-dir should be visible within working-dir of a target execI am aware of
EventPreBuild
andTargetCopyCommandCreator/CreateTargetCopyCommand
, that works underPostConfigureAll(...)
but I am somehow stuck with no full examples/test on how to use these in VS ...unfortunately, this linux-one does not move me forward:sharpmake\samples\HelloLinux\HelloLinux.CommonProject.sharpmake.cs
I have managed to create a sub-dir within
PostConfigureAll(...)
byconf.EventPreBuild.Add($"mkdir {packageDir}");
but that's all what I can achieve for now...Could you please point me out/provide an example how to copy into
d3d12
as a target sub-dir?