1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-10-25 15:53:52 +02:00

Rework locale VS project to use CustomBuildStep.

Make sure Clean, Build, and Build targets work.
Use NuGet to provide gettext for msgfmt.
This commit is contained in:
Henric Jungheim
2017-06-30 18:00:23 -07:00
parent 75bc81a1dd
commit 6ae5bd46ad
7 changed files with 54 additions and 308 deletions

View File

@@ -15,6 +15,9 @@
<RootNamespace>locale</RootNamespace>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Label="Audacity">
<MsgfmtCommand>$(MSBuildThisFileDirectory)..\..\packages\Gettext.Tools.0.19.8.1\tools\bin\msgfmt</MsgfmtCommand>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Utility</ConfigurationType>
<PlatformToolset>v120</PlatformToolset>
@@ -24,9 +27,6 @@
<PlatformToolset>v120_xp</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
<Import Project="po.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
@@ -45,29 +45,11 @@
<OutDir>$(SolutionDir)$(Configuration)\</OutDir>
<IntDir>$(Configuration)\</IntDir>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<PostBuildEvent>
<Command>for %%I in ("%WXWIN%\locale\*.po") do call :fmt %%~nI
goto :EOF
:fmt
if not exist "$(OutDir)Languages\%1" mkdir "$(OutDir)Languages\%1"
msgfmt -o "$(OutDir)Languages\%1\wxstd.mo" "%WXWIN%\locale\%1.po"
goto :EOF
</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<PostBuildEvent>
<Command>for %%I in ("%WXWIN%\locale\*.po") do call :fmt %%~nI
goto :EOF
:fmt
if not exist "$(OutDir)Languages\%1" mkdir "$(OutDir)Languages\%1"
msgfmt -o "$(OutDir)Languages\%1\wxstd.mo" "%WXWIN%\locale\%1.po"
goto :EOF
</Command>
</PostBuildEvent>
<ItemDefinitionGroup>
<msgfmt>
<OutputName>$(OutDir)Languages\%(Filename)\Audacity.mo</OutputName>
<Message>Compiling %(Filename) locale</Message>
</msgfmt>
</ItemDefinitionGroup>
<ItemGroup>
<msgfmt Include="..\..\..\locale\af.po" />
@@ -127,10 +109,46 @@ goto :EOF
<msgfmt Include="..\..\..\locale\zh_TW.po" />
</ItemGroup>
<ItemGroup>
<None Include="..\..\..\locale\audacity.pot" />
<msgfmt Include="$(WXWIN)\locale\gl_ES.po">
<OutputName>$(OutDir)Languages\gl\wxstd.mo</OutputName>
<Message>Compiling wxWidgets %(Filename) to gl locale</Message>
<Visible>false</Visible>
</msgfmt>
<msgfmt Include="$(WXWIN)\locale\ko_KR.po">
<OutputName>$(OutDir)Languages\ko\wxstd.mo</OutputName>
<Message>Compiling wxWidgets %(Filename) to ko locale</Message>
<Visible>false</Visible>
</msgfmt>
<msgfmt Include="$(WXWIN)\locale\pt.po">
<OutputName>$(OutDir)Languages\pt_PT\wxstd.mo</OutputName>
<Message>Compiling wxWidgets %(Filename) to pt_PT locale</Message>
<Visible>false</Visible>
</msgfmt>
<msgfmt Include="$(WXWIN)\locale\*.po" Exclude="@(msgfmt)">
<OutputName>$(OutDir)Languages\%(Filename)\wxstd.mo</OutputName>
<Message>Compiling wxWidgets %(Filename) locale</Message>
<Visible>false</Visible>
</msgfmt>
</ItemGroup>
<ItemGroup>
<None Include="..\..\..\locale\audacity.pot" />
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<OutputPaths Include="@(msgfmt->'%(OutputName)')" />
<OutputDirs Include="@(OutputPaths-&gt;'%(RootDir)%(Directory)'-&gt;Distinct())" />
<CustomBuildStep Include="@(msgfmt)">
<Command>"$(MsgfmtCommand)" -o "%(OutputName)" "%(FullPath)"</Command>
<Inputs>%(FullPath)</Inputs>
<Outputs>%(OutputName)</Outputs>
</CustomBuildStep>
</ItemGroup>
<Target Name="MakeOutputDirs" BeforeTargets="CustomBuildStep">
<MakeDir Directories="@(OutputDirs)" />
</Target>
<Target Name="CleanOutput" BeforeTargets="AfterClean">
<Delete Files="@(OutputPaths)" />
<RemoveDir Directories="@(OutputDirs);$(OutDir)Languages" />
</Target>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
<Import Project="po.targets" />
</ImportGroup>
</Project>
</Project>