Skip to content

Commit

Permalink
[Custom Build Steps] Fixes to get custom build steps working.
Browse files Browse the repository at this point in the history
* Add quotes to executable to support spaces in paths since the quotes can't be added by the user.
* Standardize the path when looking up the build step since it may be lower cased.
  • Loading branch information
kudaba committed Feb 10, 2022
1 parent a0c127e commit 72046c0
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Sharpmake.Generators/VisualStudio/Vcxproj.cs
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ public static Dictionary<string, CombinedCustomFileBuildStep> CombineCustomFileB
relativeBuildStep.AdditionalInputs.Add(relativeBuildStep.Executable);
// Build the command.
string command = string.Format(
"{0} {1}",
@"""{0}"" {1}",
relativeBuildStep.Executable,
relativeBuildStep.ExecutableArguments
);
Expand Down Expand Up @@ -1430,10 +1430,12 @@ IList<string> skipFiles
{
fileGenerator.Write(Template.Project.ProjectFilesCustomBuildBegin);

var standardPath = Util.PathMakeStandard(file.FileNameProjectRelative);

foreach (Project.Configuration conf in context.ProjectConfigurations)
{
CombinedCustomFileBuildStep buildStep;
if (configurationCustomFileBuildSteps[conf].TryGetValue(file.FileNameProjectRelative, out buildStep))
if (configurationCustomFileBuildSteps[conf].TryGetValue(standardPath, out buildStep))
{
using (fileGenerator.Declare("conf", conf))
using (fileGenerator.Declare("platformName", Util.GetPlatformString(conf.Platform, conf.Project, conf.Target)))
Expand Down

0 comments on commit 72046c0

Please sign in to comment.