Clean up produced object dirs during Windows build

Adds some additional MSBuild magic that chops dir names
from a given base, to avoid making deep, thin hierarchies
of dirs when building especially FFmpeg and libaegisub.
This commit is contained in:
Niels Martin Hansen 2015-01-14 04:39:09 +01:00
parent 719eff39b1
commit 5bcfc81df5
4 changed files with 47 additions and 1 deletions

View File

@ -52,6 +52,7 @@
<BasicRuntimeChecks Condition="'$(Configuration)'=='Debug'">Default</BasicRuntimeChecks>
<FunctionLevelLinking Condition="'$(Configuration)'=='Debug'">true</FunctionLevelLinking>
<WholeProgramOptimization>false</WholeProgramOptimization>
<InputRelativeSourceDir>$(FfmpegSrcDir)</InputRelativeSourceDir>
</ClCompile>
</ItemDefinitionGroup>

View File

@ -39,6 +39,7 @@
<EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
<OpenMPSupport>true</OpenMPSupport>
<StructMemberAlignment>Default</StructMemberAlignment>
<InputRelativeSourceDir>$(FftwSrcDir)</InputRelativeSourceDir>
</ClCompile>
</ItemDefinitionGroup>

View File

@ -29,6 +29,7 @@
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>lagi_pre.h</PrecompiledHeaderFile>
<ForcedIncludeFiles>lagi_pre.h</ForcedIncludeFiles>
<InputRelativeSourceDir>$(SrcDir)</InputRelativeSourceDir>
</ClCompile>
</ItemDefinitionGroup>

View File

@ -15,7 +15,7 @@
</PropertyGroup>
<ItemDefinitionGroup>
<ClCompile>
<ObjectFileName>$(IntDir)/%(Directory)</ObjectFileName>
<InputRelativeSourceDir></InputRelativeSourceDir>
</ClCompile>
<Link>
<OutputFile>$(AegisubBinaryDir)$(TargetName)$(TargetExt)</OutputFile>
@ -26,4 +26,47 @@
<OutputFile>$(AegisubLibraryDir)$(ProjectName).lib</OutputFile>
</Lib>
</ItemDefinitionGroup>
<!-- Magic pseudo-target that makes object filenames relative to a given directory
First define its relation to the system build targets: It must run as part of the
"compile inputs" section, but before all the system things. The system things here
include testing whether multiple inputs might have identical outputs, which will
produce a warning which we don't want.
Then define the target, make it depend on all ClCompile items, and have a fake
output that can never be a valid filename (due to pipe character). Instead have
the output name depend on the two variables involved in how the ObjectFileName
is determined: The specified InputRelativeSourceDir, and the actual RelativeDir
for the items.
This will cause MSBuild to batch the items as appropriate.
To use this feature, add a InputRelativeSourceDir metadata to ClCompile for
a project.
-->
<PropertyGroup>
<ComputeCompileInputsTargets>
ComputeClRelativeObjectFileName;
$(ComputeCompileInputsTargets)
</ComputeCompileInputsTargets>
</PropertyGroup>
<Target
Name="ComputeClRelativeObjectFileName"
Inputs="@(ClCompile)"
Outputs="%(InputRelativeSourceDir)|%(RelativeDir)"
>
<PropertyGroup>
<InputRelativeDir>%(ClCompile.RelativeDir)</InputRelativeDir>
<InputRelativeDir Condition="!HasTrailingSlash('$(InputRelativeDir)')">$(InputRelativeDir)\</InputRelativeDir>
<InputRelativeSourceDir>%(ClCompile.InputRelativeSourceDir)</InputRelativeSourceDir>
<InputRelativeSourceDir Condition="!HasTrailingSlash('$(InputRelativeSourceDir)')">$(InputRelativeSourceDir)\</InputRelativeSourceDir>
<InputRelativeDir>$(InputRelativeDir.Replace("$(InputRelativeSourceDir)",""))</InputRelativeDir>
</PropertyGroup>
<!-- <Exec Command="echo ClCompile output for @(ClCompile -> '%(Filename)%(Extension)') to $(IntDir)$(InputRelativeDir)" /> -->
<ItemGroup>
<ClCompile Condition="'%(ClCompile.InputRelativeSourceDir)' != ''">
<ObjectFileName>$(IntDir)$(InputRelativeDir)</ObjectFileName>
</ClCompile>
</ItemGroup>
</Target>
</Project>