Skip to content

Commit

Permalink
Added SourceFilesExclude and Regex to Project.Configuration, it is no…
Browse files Browse the repository at this point in the history
…w possible to use these properties to exclude files on a Configuration level

Vcxprojec will now use ResolvedSourceFilesExclude instead of ResolveSourceFilesBuildExclude to determine if file should be added or not
  • Loading branch information
DJLink committed Oct 3, 2018
1 parent b38b431 commit 18d6e23
Show file tree
Hide file tree
Showing 5 changed files with 75 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Sharpmake.Generators/VisualStudio/Vcxproj.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1092,7 +1092,7 @@ private void GenerateFilesSection(IVcxprojGenerationContext context, IFileGenera
bool addFile = false;
foreach (Project.Configuration conf in context.ProjectConfigurations)
{
if (conf.ResolvedSourceFilesBuildExclude.Contains(projectFile.FileName) == false)
if (conf.ResolvedSourceFilesExclude.Contains(projectFile.FileName) == false)
{
addFile = true;
break;
Expand Down
10 changes: 10 additions & 0 deletions Sharpmake/Project.Configuration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,14 @@ public OutputType Output

public Strings SourceFilesFiltersRegex = new Strings();

/// <summary>
/// Excluded file from project for this configuration
/// </summary>
public Strings SourceFilesExclude = new Strings();

public Strings SourceFilesExcludeRegex = new Strings();


/// <summary>
/// Sources file that match this regex will be compiled as C Files
/// </summary>
Expand Down Expand Up @@ -972,6 +980,8 @@ public void GeneratorSetGeneratedInformation(string executableExtension, string

public Strings ResolvedSourceFilesBuildExclude = new Strings();

public Strings ResolvedSourceFilesExclude = new Strings();

public Strings ResolvedSourceFilesBlobExclude = new Strings();

public Strings ResolvedSourceFilesWithCompileAsCOption = new Strings();
Expand Down
16 changes: 16 additions & 0 deletions Sharpmake/Project.cs
Original file line number Diff line number Diff line change
Expand Up @@ -787,8 +787,23 @@ internal virtual void ResolveSourceFiles(Builder builder)
if (conf.IsFastBuild && conf.FastBuildBlobbed)
fastBuildBlobs = true;

var confSourceFilesExcludeRegex = RegexCache.GetCachedRegexes(conf.SourceFilesExcludeRegex);

// Remove file that match conf.SourceFilesExcludeRegex
if (AddMatchFiles(RootPath, Util.PathGetRelative(RootPath, SourceFiles), SourceFiles, ref conf.SourceFilesExclude, confSourceFilesExcludeRegex))
System.Diagnostics.Debugger.Break();
if (AddMatchFiles(RootPath, Util.PathGetRelative(RootPath, ResourceFiles), ResourceFiles, ref conf.SourceFilesExclude, confSourceFilesExcludeRegex))
System.Diagnostics.Debugger.Break();
if (AddMatchFiles(RootPath, Util.PathGetRelative(RootPath, NatvisFiles), NatvisFiles, ref conf.SourceFilesExclude, confSourceFilesExcludeRegex))
System.Diagnostics.Debugger.Break();

conf.ResolvedSourceFilesBuildExclude.AddRange(SourceFilesExclude);

//Add SourceFilesExclude also to ResolvedSourceFilesBuildExclude in case we end up needing file for
//another configuration that way it gets added but excluded from build in this config
conf.ResolvedSourceFilesBuildExclude.AddRange(conf.SourceFilesExclude);
conf.ResolvedSourceFilesExclude.AddRange(conf.SourceFilesExclude);

// add SourceFilesBuildExclude from the project
if (DebugBreaks.ShouldBreakOnSourcePath(DebugBreaks.Context.Resolving, ResolvedSourceFilesBuildExclude))
System.Diagnostics.Debugger.Break();
Expand Down Expand Up @@ -912,6 +927,7 @@ internal virtual void ResolveSourceFiles(Builder builder)
conf.ResolvedSourceFilesBuildExclude.Add(sourceFile);
}
Util.ResolvePath(SourceRootPath, ref conf.ResolvedSourceFilesBuildExclude);
Util.ResolvePath(SourceRootPath, ref conf.ResolvedSourceFilesExclude);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -488,14 +488,44 @@
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Retail|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="obj\win64\qt\debug\moc_floatcosanglespinbox.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Retail|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="obj\win64\qt\debug\moc_privatewidget.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Retail|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="obj\win64\qt\release\moc_floatanglespinbox.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Retail|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="obj\win64\qt\release\moc_floatcosanglespinbox.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Retail|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="obj\win64\qt\release\moc_privatewidget.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Retail|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="obj\win64\qt\retail\moc_floatanglespinbox.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="obj\win64\qt\retail\moc_floatcosanglespinbox.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Retail|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="obj\win64\qt\retail\moc_privatewidget.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Retail|x64'">true</ExcludedFromBuild>
</ClCompile>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,30 @@
<ClCompile Include="obj\win64\qt\debug\moc_floatanglespinbox.cpp">
<Filter>projects\obj\win64\qt\debug</Filter>
</ClCompile>
<ClCompile Include="obj\win64\qt\debug\moc_floatcosanglespinbox.cpp">
<Filter>projects\obj\win64\qt\debug</Filter>
</ClCompile>
<ClCompile Include="obj\win64\qt\debug\moc_privatewidget.cpp">
<Filter>projects\obj\win64\qt\debug</Filter>
</ClCompile>
<ClCompile Include="obj\win64\qt\release\moc_floatanglespinbox.cpp">
<Filter>projects\obj\win64\qt\release</Filter>
</ClCompile>
<ClCompile Include="obj\win64\qt\release\moc_floatcosanglespinbox.cpp">
<Filter>projects\obj\win64\qt\release</Filter>
</ClCompile>
<ClCompile Include="obj\win64\qt\release\moc_privatewidget.cpp">
<Filter>projects\obj\win64\qt\release</Filter>
</ClCompile>
<ClCompile Include="obj\win64\qt\retail\moc_floatanglespinbox.cpp">
<Filter>projects\obj\win64\qt\retail</Filter>
</ClCompile>
<ClCompile Include="obj\win64\qt\retail\moc_floatcosanglespinbox.cpp">
<Filter>projects\obj\win64\qt\retail</Filter>
</ClCompile>
<ClCompile Include="obj\win64\qt\retail\moc_privatewidget.cpp">
<Filter>projects\obj\win64\qt\retail</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\codebase\stdafx.h" />
Expand Down

0 comments on commit 18d6e23

Please sign in to comment.