Rework InstallHeaders target to be more regular

This commit is contained in:
Niels Martin Hansen 2015-01-18 21:52:27 +01:00
parent 773b60c36c
commit 59ab4cd09b
17 changed files with 121 additions and 57 deletions

View file

@ -10,7 +10,6 @@
<PropertyGroup Label="AegisubConfiguration">
<AegisubProjectType>lib</AegisubProjectType>
<SrcDir>..\..\vendor\csri\</SrcDir>
<HeaderRoot>$(SrcDir)include</HeaderRoot>
</PropertyGroup>
<ImportGroup Label="PropertySheets">
<Import Project="$(MSBuildThisFileDirectory)..\aegisub.props" />
@ -22,6 +21,9 @@
<PreprocessorDefinitions>CSRI_NO_EXPORT;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(SrcDir)include\;$(SrcDir)lib\;$(SrcDir)lib\win32\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<InstallHeader>
<HeaderRoot>$(SrcDir)include</HeaderRoot>
</InstallHeader>
</ItemDefinitionGroup>
<!-- Source files -->

View file

@ -9,7 +9,6 @@
<PropertyGroup Label="AegisubConfiguration">
<AegisubProjectType>lib</AegisubProjectType>
<SrcDir>..\..\vendor\wxWidgets\src\expat\lib</SrcDir>
<HeaderRoot>$(SrcDir)</HeaderRoot>
</PropertyGroup>
<ImportGroup Label="PropertySheets">
<Import Project="$(MSBuildThisFileDirectory)..\aegisub.props" />
@ -20,6 +19,9 @@
<ClCompile>
<PreprocessorDefinitions>COMPILED_FROM_DSP;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<InstallHeader>
<HeaderRoot>$(SrcDir)</HeaderRoot>
</InstallHeader>
</ItemDefinitionGroup>
<!-- Source files -->

View file

@ -11,9 +11,6 @@
<ImportGroup Label="PropertySheets">
<Import Project="$(MSBuildThisFileDirectory)..\aegisub.props" />
</ImportGroup>
<PropertyGroup>
<HeaderRoot>$(FfmpegSrcDir)</HeaderRoot>
</PropertyGroup>
<!-- Project specific configuration -->
<ItemDefinitionGroup>
@ -54,6 +51,9 @@
<WholeProgramOptimization>false</WholeProgramOptimization>
<InputRelativeSourceDir>$(FfmpegSrcDir)</InputRelativeSourceDir>
</ClCompile>
<InstallHeader>
<HeaderRoot>$(FfmpegSrcDir)</HeaderRoot>
</InstallHeader>
<Yasm>
<InputRelativeSourceDir>$(FfmpegSrcDir)\</InputRelativeSourceDir>
</Yasm>
@ -1073,9 +1073,9 @@
</ItemGroup>
<ItemGroup>
<InstallHeaderTo Include="$(MSBuildThisFileDirectory)\libavutil\avconfig.h">
<Destination>libavutil\</Destination>
</InstallHeaderTo>
<InstallHeader Include="$(MSBuildThisFileDirectory)\libavutil\avconfig.h">
<HeaderRoot>$(MSBuildThisFileDirectory)</HeaderRoot>
</InstallHeader>
<InstallHeader Include="$(FfmpegSrcDir)\libavcodec\audiodsp.h" />
<InstallHeader Include="$(FfmpegSrcDir)\libavcodec\avcodec.h" />

View file

@ -16,7 +16,6 @@
<PropertyGroup>
<Ffms2PreprocessorHaalisource Condition="'$(Ffms2UseAtl)'!='0'">HAALISOURCE;</Ffms2PreprocessorHaalisource>
<HeaderRoot>$(FfmsSrcDir)\include</HeaderRoot>
</PropertyGroup>
<!-- Project specific configuration -->
@ -42,6 +41,9 @@
<Link>
<AdditionalLibraryDirectories>$(AegisubLibraryDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Link>
<InstallHeader>
<HeaderRoot>$(FfmsSrcDir)\include</HeaderRoot>
</InstallHeader>
</ItemDefinitionGroup>
<!-- Source files -->

View file

@ -15,9 +15,6 @@
</ImportGroup>
<!-- Project specific configuration -->
<PropertyGroup>
<HeaderRoot>$(FftwSrcDir)\api</HeaderRoot>
</PropertyGroup>
<ItemDefinitionGroup>
<ClCompile>
<AdditionalIncludeDirectories>
@ -41,6 +38,9 @@
<StructMemberAlignment>Default</StructMemberAlignment>
<InputRelativeSourceDir>$(FftwSrcDir)</InputRelativeSourceDir>
</ClCompile>
<InstallHeader>
<HeaderRoot>$(FftwSrcDir)\api</HeaderRoot>
</InstallHeader>
</ItemDefinitionGroup>
<!-- Source files -->

View file

@ -15,9 +15,6 @@
</ImportGroup>
<!-- Project specific configuration -->
<PropertyGroup>
<HeaderRoot>$(FontconfigSrcDir)</HeaderRoot>
</PropertyGroup>
<ItemDefinitionGroup>
<ClCompile>
<AdditionalIncludeDirectories>
@ -30,6 +27,9 @@
%(PreprocessorDefinitions)
</PreprocessorDefinitions>
</ClCompile>
<InstallHeader>
<HeaderRoot>$(FontconfigSrcDir)</HeaderRoot>
</InstallHeader>
</ItemDefinitionGroup>
<!-- Project References -->

View file

@ -15,9 +15,6 @@
</ImportGroup>
<!-- Project specific configuration -->
<PropertyGroup>
<HeaderRoot>$(Freetype2SrcDir)\include</HeaderRoot>
</PropertyGroup>
<ItemDefinitionGroup>
<ClCompile>
<AdditionalIncludeDirectories>$(Freetype2SrcDir)\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
@ -29,6 +26,9 @@
<ResourceCompile>
<Culture>0x0409</Culture>
</ResourceCompile>
<InstallHeader>
<HeaderRoot>$(Freetype2SrcDir)\include</HeaderRoot>
</InstallHeader>
</ItemDefinitionGroup>
<!-- Source files -->

View file

@ -54,8 +54,11 @@
<ClCompile Include="$(FribidiSrcDir)\lib\fribidi-run.c" />
<ClCompile Include="$(FribidiSrcDir)\lib\fribidi-shape.c" />
<ClCompile Include="$(FribidiSrcDir)\lib\fribidi.c" />
<InstallHeaderTo Include="$(FribidiSrcDir)\lib\*.h;$(MSBuildThisFileDirectory)fribidi-config.h">
<Destination>fribidi\</Destination>
</InstallHeaderTo>
<InstallHeader Include="$(FribidiSrcDir)\lib\*.h">
<HeaderRoot>$(FribidiSrcDir)\lib</HeaderRoot>
</InstallHeader>
<InstallHeader Include="$(MSBuildThisFileDirectory)fribidi-config.h">
<HeaderRoot>$(MSBuildThisFileDirectory)</HeaderRoot>
</InstallHeader>
</ItemGroup>
</Project>

View file

@ -76,6 +76,14 @@
</Target>
<!-- Source files -->
<ItemGroup>
<InstallHeader Include="$(IcuSrcDir)\i18n\unicode\*.h">
<HeaderRoot>$(IcuSrcDir)\i18n</HeaderRoot>
</InstallHeader>
<InstallHeader Include="$(IcuSrcDir)\common\unicode\*.h">
<HeaderRoot>$(IcuSrcDir)\common</HeaderRoot>
</InstallHeader>
</ItemGroup>
<ItemGroup>
<ClCompile Include="$(AegisubObjectDir)\$(IcuDt).c" />
<ClCompile Include="$(IcuSrcDir)\common\ubidi.c" />
@ -364,9 +372,6 @@
<ClInclude Include="$(IcuSrcDir)\common\uvectr32.h" />
<ClInclude Include="$(IcuSrcDir)\common\uvectr64.h" />
<ClInclude Include="$(IcuSrcDir)\common\wintz.h" />
<InstallHeaderTo Include="$(IcuSrcDir)\common\unicode\*.h">
<Destination>unicode\</Destination>
</InstallHeaderTo>
</ItemGroup>
<ItemGroup>
<ClCompile Include="$(IcuSrcDir)\i18n\filteredbrk.cpp" />
@ -689,9 +694,6 @@
<ClInclude Include="$(IcuSrcDir)\i18n\uspoof_conf.h" />
<ClInclude Include="$(IcuSrcDir)\i18n\uspoof_impl.h" />
<ClInclude Include="$(IcuSrcDir)\i18n\uspoof_wsconf.h" />
<InstallHeaderTo Include="$(IcuSrcDir)\i18n\unicode\*.h">
<Destination>unicode\</Destination>
</InstallHeaderTo>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\luajit-minilua\luajit-minilua.vcxproj">

View file

@ -1,27 +1,42 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemDefinitionGroup>
<InstallHeader>
<Destination></Destination>
</InstallHeader>
</ItemDefinitionGroup>
<Target
Name="ComputeHeaderOutputs"
Inputs="@(InstallHeader)"
Outputs="@(InstallHeader->'%(HeaderRoot)|%(RelativeDir)')"
BeforeTargets="InstallHeaders"
>
<CalculateOutputDir
Items="@(InstallHeader)"
SourceDir="%(HeaderRoot)"
DestinationDir="$(AegisubSourceBase)include"
>
<Output ItemName="_InstallHeader" TaskParameter="Outputs" />
</CalculateOutputDir>
</Target>
<Target
Name="InstallHeaders"
BeforeTargets="ClCompile"
Inputs="@(InstallHeader)"
Outputs="@(InstallHeader->Replace($(HeaderRoot), $(AegisubSourceBase)include))"
Inputs="@(_InstallHeader)"
Outputs="@(_InstallHeader->'%(OutputDir)%(Destination)%(Filename)%(Extension)')"
>
<Error
Condition="'%(_InstallHeader.OutputDir)' == ''"
Text="OutputDir for _InstallHeader item is blank, problem during ComputeHeaderOutputs target?"
/>
<Copy
SourceFiles="@(InstallHeader)"
DestinationFiles="@(InstallHeader->Replace($(HeaderRoot), $(AegisubSourceBase)include))"
SkipUnchangedFiles="true"
/>
</Target>
<Target
Name="InstallHeadersTo"
BeforeTargets="ClCompile"
Inputs="@(InstallHeaderTo)"
Outputs="@(InstallHeaderTo -> '$(AegisubSourceBase)include\%(Destination)%(Filename)%(Extension)')"
>
<Copy
SourceFiles="@(InstallHeaderTo)"
DestinationFiles="@(InstallHeaderTo -> '$(AegisubSourceBase)include\%(Destination)%(Filename)%(Extension)')"
SourceFiles="@(_InstallHeader)"
DestinationFiles="@(_InstallHeader->'%(OutputDir)%(Destination)%(Filename)%(Extension)')"
SkipUnchangedFiles="true"
/>
</Target>
</Project>

View file

@ -29,15 +29,16 @@
%(PreprocessorDefinitions)
</PreprocessorDefinitions>
</ClCompile>
<InstallHeaderTo>
<InstallHeader>
<HeaderRoot>$(LibassSrcDir)\libass</HeaderRoot>
<Destination>ass\</Destination>
</InstallHeaderTo>
</InstallHeader>
</ItemDefinitionGroup>
<!-- Source files -->
<ItemGroup>
<InstallHeaderTo Include="$(LibassSrcDir)\libass\ass.h" />
<InstallHeaderTo Include="$(LibassSrcDir)\libass\ass_types.h" />
<InstallHeader Include="$(LibassSrcDir)\libass\ass.h" />
<InstallHeader Include="$(LibassSrcDir)\libass\ass_types.h" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="$(LibassSrcDir)\libass\ass.h" />

View file

@ -15,15 +15,15 @@
</ImportGroup>
<!-- Project specific configuration -->
<PropertyGroup>
<HeaderRoot>$(SrcDir)\include</HeaderRoot>
</PropertyGroup>
<ItemDefinitionGroup>
<ClCompile>
<AdditionalIncludeDirectories>$(SrcDir)include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<CompileAs>CompileAsC</CompileAs>
</ClCompile>
<InstallHeader>
<HeaderRoot>$(SrcDir)include</HeaderRoot>
</InstallHeader>
</ItemDefinitionGroup>
<!-- Source files -->

View file

@ -9,7 +9,6 @@
<PropertyGroup Label="AegisubConfiguration">
<AegisubProjectType>lib</AegisubProjectType>
<SrcDir>..\..\vendor\wxWidgets\src\png\</SrcDir>
<HeaderRoot>$(SrcDir)</HeaderRoot>
</PropertyGroup>
<ImportGroup Label="PropertySheets">
<Import Project="$(MSBuildThisFileDirectory)..\aegisub.props" />
@ -21,6 +20,12 @@
<Project>{10f22a5a-dd9e-44a1-ba2e-2a9a7c78b0ee}</Project>
</ProjectReference>
</ItemGroup>
<ItemDefinitionGroup>
<InstallHeader>
<HeaderRoot>$(SrcDir)</HeaderRoot>
</InstallHeader>
</ItemDefinitionGroup>
<!-- Source files -->
<ItemGroup>

View file

@ -15,9 +15,6 @@
</ImportGroup>
<!-- Project specific configuration -->
<PropertyGroup>
<HeaderRoot>$(SrcDir)\include</HeaderRoot>
</PropertyGroup>
<ItemDefinitionGroup>
<ClCompile>
<PreprocessorDefinitions>
@ -27,6 +24,9 @@
</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(AegisubObjectDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<InstallHeader>
<HeaderRoot>$(SrcDir)include</HeaderRoot>
</InstallHeader>
</ItemDefinitionGroup>
<!-- BuildVM stuff -->

View file

@ -5,5 +5,31 @@
</PropertyGroup>
<UsingTask TaskName="GitVersion" AssemblyFile="$(AegisubBinaryDir)BuildTasks.dll" />
<UsingTask TaskName="CalculateOutputDir" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll" >
<ParameterGroup>
<Items ParameterType="Microsoft.Build.Framework.ITaskItem[]" Required="true" />
<SourceDir Required="true" />
<DestinationDir Required="true" />
<Outputs ParameterType="Microsoft.Build.Framework.ITaskItem[]" Output="true" />
</ParameterGroup>
<Task>
<Code Type="Fragment" Language="cs"><![CDATA[
Outputs = new TaskItem[Items.Length];
char[] backslash = new char[] {'\\'};
var srcdir = SourceDir.Replace('/', '\\').TrimEnd(backslash) + "\\";
var dstdir = DestinationDir.Replace('/', '\\').TrimEnd(backslash) + "\\";
int i = 0;
foreach (var item in Items) {
var itemDir = item.GetMetadata("RelativeDir"); // the dir specified in the item Include= attribute
var outputDir = itemDir.Replace(srcdir, dstdir).Replace('/', '\\').TrimEnd(backslash) + "\\";
var output = new TaskItem(item);
((ITaskItem2)output).SetMetadataValueLiteral("OutputDir", outputDir);
Outputs[i] = output;
i++;
}
]]></Code>
</Task>
</UsingTask>
</Project>

View file

@ -9,7 +9,6 @@
<PropertyGroup Label="AegisubConfiguration">
<AegisubProjectType>lib</AegisubProjectType>
<SrcDir>..\..\vendor\wxWidgets\</SrcDir>
<HeaderRoot>$(SrcDir)include</HeaderRoot>
</PropertyGroup>
<ImportGroup Label="PropertySheets">
<Import Project="$(MSBuildThisFileDirectory)..\aegisub.props" />
@ -23,6 +22,9 @@
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>wx/wxprec.h</PrecompiledHeaderFile>
</ClCompile>
<InstallHeader>
<HeaderRoot>$(SrcDir)include</HeaderRoot>
</InstallHeader>
</ItemDefinitionGroup>
<Target Name="InstallSetup"

View file

@ -20,8 +20,12 @@
<!-- Source files -->
<ItemGroup>
<InstallHeaderTo Include="$(ZlibSrcDir)\zlib.h" />
<InstallHeaderTo Include="$(MSBuildThisFileDirectory)\zconf.h" />
<InstallHeader Include="$(ZlibSrcDir)\zlib.h">
<HeaderRoot>$(ZlibSrcDir)</HeaderRoot>
</InstallHeader>
<InstallHeader Include="$(MSBuildThisFileDirectory)\zconf.h">
<HeaderRoot>$(MSBuildThisFileDirectory)</HeaderRoot>
</InstallHeader>
</ItemGroup>
<ItemGroup>
<ClCompile Include="$(ZlibSrcDir)\adler32.c" />