goldendict-ng/MSBuild/QtExtensions/rcc.targets
Tvangeste ba94dd1314 Created a VS2012 project and solution for GoldenDict
It uses excellent Visual Studio extensions for Qt,
written by Adam Badura (@adambadura). Many thanks!

The project file is fully functional in Release-Qt4 configuration,
for both x32 and x64 architectures.

I decided not to use the official Qt Plugin, since it
generates HUGE and broken project files which is painful
to maintain.

Here we have a pure visual studio solution with proper
Visual Studio extensions to support Qt-based development.

These extensions cover RCC, Lrelease, MOC and UIC,
automagically invoking them when needed, with basically
no need for manual steps to maintain.

Also, GoldenDict can be built from the command line as well,
no Visual Studio is required:

For Win32:
MSBuild /m goldendict.sln /v:m /nologo /p:Configuration=Release-Qt4 /p:Platform=win32

For x64:
MSBuild /m goldendict.sln /v:m /nologo /p:Configuration=Release-Qt4 /p:Platform=x64
2013-08-16 15:47:12 +02:00

125 lines
4.7 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<!--
This file is (c) 2013 Adam Badura.
Part of GoldenDict. Licensed under GPLv3 or later, see the LICENSE file.
-->
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<PropertyPageSchema Include="$(MSBuildThisFileDirectory)$(MSBuildThisFileName).xml" />
<AvailableItemName Include="QtRCCCompile">
<Targets>QtRCCCompile</Targets>
</AvailableItemName>
</ItemGroup>
<PropertyGroup>
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
</PropertyGroup>
<UsingTask
TaskName="QtRCC"
TaskFactory="XamlTaskFactory"
AssemblyName="Microsoft.Build.Tasks.v4.0">
<Task>$(MSBuildThisFileDirectory)$(MSBuildThisFileName).xml</Task>
</UsingTask>
<Target
Name="SelectQtRCCCompile"
DependsOnTargets="_SelectedFiles;SelectCustomBuild"
>
<ItemGroup Condition="'@(SelectedFiles)' != ''">
<QtRCCCompile
Remove="@(QtRCCCompile)"
Condition="'%(Identity)' != '@(SelectedFiles)'"
/>
</ItemGroup>
</Target>
<Target Name="CalculateQtRCCDeps"
DependsOnTargets="SelectQtRCCCompile"
Outputs="%(QtRCCCompile.Identity)">
<Message Text="Calculating dependencies for %(QtRCCCompile.Identity)" />
<!-- Look into the qrc file and fetch all the referenced files -->
<XmlPeek XmlInputPath="%(QtRCCCompile.FullPath)"
Query="//file/text()">
<Output TaskParameter="Result" ItemName="QtRCCDeps" />
</XmlPeek>
<!-- Add the calculated dependencies to the AdditionalDependencies -->
<ItemGroup>
<QtRCCCompile>
<AdditionalDependencies>@(QtRCCDeps);%(QtRCCCompile.AdditionalDependencies)</AdditionalDependencies>
</QtRCCCompile>
</ItemGroup>
<Message Text="Actual Dependencies: @(QtRCCCompile->'%(AdditionalDependencies)')" />
</Target>
<Target
Name="QtRCCCompile"
Condition="'@(QtRCCCompile)' != ''"
DependsOnTargets="SelectQtRCCCompile;CalculateQtRCCDeps"
Inputs="@(QtRCCCompile);%(QtRCCCompile.AdditionalDependencies);"
Outputs="%(OutputFile)"
>
<Message Text="RCC %(QtRCCCompile.Identity) -> $([System.IO.Path]::GetFileName('%(QtRCCCompile.OutputFile)'))"
Importance="high"/>
<ItemGroup>
<QtRCCCompile_tlog
Include="%(QtRCCCompile.OutputFile)"
Condition="'%(QtRCCCompile.OutputFile)' != '' and '%(QtRCCCompile.ExcludedFromBuild)' != 'true'"
>
<Source>@(QtRCCCompile, '|')</Source>
</QtRCCCompile_tlog>
</ItemGroup>
<WriteLinesToFile
Condition="'@(QtRCCCompile_tlog)' != '' and '%(QtRCCCompile_tlog.ExcludedFromBuild)' != 'true'"
File="$(IntDir)$(ProjectName).write.1.tlog"
Lines="^%(QtRCCCompile_tlog.Source);@(QtRCCCompile_tlog-&gt;'%(Fullpath)')"
/>
<MakeDir
Directories="$([System.IO.Path]::GetDirectoryName('%(QtRCCCompile.OutputFile)'))"
/>
<QtRCC
Condition="'%(QtRCCCompile.ExcludedFromBuild)' != 'true'"
OutputFile="%(QtRCCCompile.OutputFile)"
ExternalInitializationFunction="%(QtRCCCompile.ExternalInitializationFunction)"
Threshold="%(QtRCCCompile.Threshold)"
CompressLevel="%(QtRCCCompile.CompressLevel)"
Root="%(QtRCCCompile.Root)"
DisableCompression="%(QtRCCCompile.DisableCompression)"
Binary="%(QtRCCCompile.Binary)"
Inputs="%(QtRCCCompile.Identity)"
AdditionalOptions="%(QtRCCCompile.AdditionalOptions)"
CommandLineTemplate="%(QtRCCCompile.CommandLineTemplate)"
/>
</Target>
<Target
Name="QtRCCCompileAndInclude"
Condition="'@(QtRCCCompile)' != ''"
DependsOnTargets="SelectQtRCCCompile;QtRCCCompile"
>
<ItemGroup>
<ClCompile
Include="%(QtRCCCompile.OutputFile)"
Condition="'%(QtRCCCompile.ExcludedFromBuild)' != 'true'"
>
<AutoGen>True</AutoGen>
<DependentUpon>%(QtRCCCompile.Identity)</DependentUpon>
<WarningLevel>TurnOffAllWarnings</WarningLevel>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<AssemblerListingLocation Condition="'%(QtRCCCompile.ClCompileAssemblerListingLocation)' != ''">%(QtRCCCompile.ClCompileAssemblerListingLocation)</AssemblerListingLocation>
<ObjectFileName Condition="'%(QtRCCCompile.ClCompileObjectFileName)' != ''">%(QtRCCCompile.ClCompileObjectFileName)</ObjectFileName>
<XMLDocumentationFileName Condition="'%(QtRCCCompile.ClCompileXMLDocumentationFileName)' != ''">%(QtRCCCompile.ClCompileXMLDocumentationFileName)</XMLDocumentationFileName>
</ClCompile>
</ItemGroup>
</Target>
<Target
Name="_QtRCCCompile"
BeforeTargets="ClCompile"
DependsOnTargets="$(BeforeQtRCCCompileTargets);QtRCCCompileAndInclude;$(AfterQtRCCCompileTargets)"
/>
</Project>