Skip to content

Commit

Permalink
Additional Flags for CustomFileBuildStepData (#322)
Browse files Browse the repository at this point in the history
* Additional flag for CustomFileBuildStep

This adds one new flag:
- UseExecutableFromSystemPath: This will skip resolve of the executable and will not add the executable to AdditionalInputs. This should be used only if your executable is on system path.

---------

Co-authored-by: Sharlock93 <[email protected]>
  • Loading branch information
Sharlock93 and Sharlock93 authored Feb 2, 2024
1 parent 8f9a027 commit 0f38fe2
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
5 changes: 4 additions & 1 deletion Sharpmake.Generators/VisualStudio/Vcxproj.cs
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,10 @@ public static Dictionary<string, CombinedCustomFileBuildStep> CombineCustomFileB
foreach (var customBuildStep in buildSteps)
{
var relativeBuildStep = customBuildStep.MakePathRelative(resolver, (path, commandRelative) => Util.SimplifyPath(Util.PathGetRelative(referencePath, path)));
relativeBuildStep.AdditionalInputs.Add(relativeBuildStep.Executable);
if(!customBuildStep.UseExecutableFromSystemPath)
{
relativeBuildStep.AdditionalInputs.Add(relativeBuildStep.Executable);
}
// Build the command.
string command = string.Format(
"\"{0}\" {1}",
Expand Down
11 changes: 10 additions & 1 deletion Sharpmake/Project.Configuration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2199,6 +2199,10 @@ public enum ProjectFilter
/// </summary>
public string Executable = "";
/// <summary>
/// Use this to indicate the executable is in the system Path
/// </summary>
public bool UseExecutableFromSystemPath = false;
/// <summary>
/// These are the arguments to pass to the executable.
/// </summary>
/// <remarks>
Expand Down Expand Up @@ -2808,7 +2812,12 @@ internal void Resolve(Resolver resolver)
{
customFileBuildStep.Resolve(resolver);
Util.ResolvePath(Project.SourceRootPath, ref customFileBuildStep.KeyInput);
Util.ResolvePath(Project.SourceRootPath, ref customFileBuildStep.Executable);

if(!customFileBuildStep.UseExecutableFromSystemPath)
{
Util.ResolvePath(Project.SourceRootPath, ref customFileBuildStep.Executable);
}

Util.ResolvePath(Project.SourceRootPath, ref customFileBuildStep.Output);
Util.ResolvePath(Project.SourceRootPath, ref customFileBuildStep.AdditionalInputs);
}
Expand Down

0 comments on commit 0f38fe2

Please sign in to comment.