Skip to content

Commit

Permalink
Merge branch 'hscurti/fastbuild-prebuild-dependencies-rework' into 'm…
Browse files Browse the repository at this point in the history
…ain'

FastBuild: small fixes for PreBuildDependencies

See merge request Sharpmake/sharpmake!481
  • Loading branch information
jspelletier committed Dec 11, 2023
2 parents c77f5af + 6e10fab commit 0aa2ebf
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions Sharpmake.Generators/FastBuild/Bff.cs
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,10 @@ List<string> skipFiles
}
}

if (isFirstSubConfig) // pre-build steps on the first config
// When we have a Library/Dll/Executable section, put the prebuild dependencies there (which is the last subconfig).
// Otherwise put it on the first object list
var preBuildTargetsOnLastSubconfig = isOutputTypeExeOrDllOrAppleApp || (isOutputTypeLib && !confUseLibraryDependencyInputs);
if ((preBuildTargetsOnLastSubconfig && isLastSubConfig) || (!preBuildTargetsOnLastSubconfig && isFirstSubConfig))
{
// the pre-steps are written in the master bff, we only need to refer their aliases
preBuildTargets.AddRange(conf.EventPreBuildExecute.Select(e => e.Key));
Expand Down Expand Up @@ -1038,12 +1041,23 @@ List<string> skipFiles
return false;
});

fastBuildBuildOnlyDependencies.AddRange(fileCustomBuildKeys);

Strings fastBuildPreBuildDependencies = new Strings();
var orderedForceUsingDeps = UtilityMethods.GetOrderedFlattenedProjectDependencies(conf, false, true);
fastBuildPreBuildDependencies.AddRange(orderedForceUsingDeps.Select(dep => GetShortProjectName(dep.Project, dep)));
fastBuildPreBuildDependencies.AddRange(preBuildTargets);

// fastBuildBuildOnlyDependencies only gets added to exe/dll sections.
// Add the prebuild steps to fastBuildPreBuildDependencies if we are building a lib
if (isOutputTypeExeOrDllOrAppleApp)
{
fastBuildBuildOnlyDependencies.AddRange(preBuildTargets);
fastBuildBuildOnlyDependencies.AddRange(fileCustomBuildKeys);
}
else if (isOutputTypeLib)
{
fastBuildPreBuildDependencies.AddRange(preBuildTargets);
if (isLastSubConfig)
fastBuildPreBuildDependencies.AddRange(fileCustomBuildKeys);
}

if (projectHasResourceFiles)
resourceFilesSections.Add(fastBuildOutputFileShortName + "_resources");
Expand Down

0 comments on commit 0aa2ebf

Please sign in to comment.