Automatically download googletest

This commit is contained in:
Ted John 2016-12-02 13:36:03 +00:00
parent 872976bff4
commit d26e1df21e
2 changed files with 14 additions and 2 deletions

View File

@ -65,6 +65,8 @@
<LibsUrl>https://github.com/OpenRCT2/Dependencies/releases/download/v$(TargetLibsVersion)/openrct2-libs-vs2015.zip</LibsUrl>
<LibsPath>$(RootDir)lib\</LibsPath>
<LibsVersionPath>$(LibsPath)libversion</LibsVersionPath>
<GtestVersion>1.8.0</GtestVersion>
<GtestUrl>https://github.com/google/googletest/archive/release-$(GtestVersion).zip</GtestUrl>
</PropertyGroup>
<ItemGroup>
@ -122,6 +124,7 @@
<Target Name="DownloadLibs">
<PropertyGroup>
<LibsZipPath>$(LibsPath)openrct2-libs-vs2015.zip</LibsZipPath>
<GtestZipPath>$(LibsPath)gtest.zip</GtestZipPath>
</PropertyGroup>
<!-- Clean libs directory -->
@ -129,10 +132,18 @@
<MakeDir Directories="$(LibsPath)" />
<Message Text="Downloading libraries..." Importance="normal" />
<!-- prebuilt libs -->
<Exec Command="powershell -ExecutionPolicy Unrestricted -Command &quot;Invoke-WebRequest '$(LibsUrl)' -OutFile '$(LibsZipPath)'&quot;" StandardOutputImportance="low" />
<Unzip Input="$(LibsZipPath)" OutputDirectory="$(LibsPath)" />
<Delete Files="$(LibsZipPath)" ContinueOnError="true" />
<!-- googletest -->
<Message Text="Downloading googletest..." Importance="normal" />
<Exec Command="powershell -ExecutionPolicy Unrestricted -Command &quot;Invoke-WebRequest '$(GtestUrl)' -OutFile '$(GtestZipPath)'&quot;" StandardOutputImportance="low" />
<Unzip Input="$(GtestZipPath)" OutputDirectory="$(LibsPath)" />
<Delete Files="$(GtestZipPath)" ContinueOnError="true" />
<Exec Command="cmd /c move &quot;$(LibsPath)googletest-release-$(GtestVersion)&quot; &quot;$(LibsPath)googletest&quot;" />
<!-- Update libversion file -->
<WriteLinesToFile Lines="$(TargetLibsVersion)" File="$(LibsVersionPath)" Overwrite="true" />
</Target>

View File

@ -2,6 +2,7 @@
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<SolutionDir Condition="'$(SolutionDir)'==''">..\..\</SolutionDir>
<GtestDir Condition="'$(GtestDir)'==''">$(SolutionDir)lib\googletest\googletest</GtestDir>
</PropertyGroup>
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="DebugTests|Win32">
@ -32,7 +33,7 @@
<Import Project="..\..\openrct2.common.props" />
<PropertyGroup>
<OutDir>$(SolutionDir)bin\tests\</OutDir>
<IncludePath>$(GTestDir)\googletest;$(GTestDir)\googletest\include;$(SolutionDir)src;$(IncludePath)</IncludePath>
<IncludePath>$(GtestDir);$(GtestDir)\include;$(SolutionDir)src;$(IncludePath)</IncludePath>
<LibraryPath>$(SolutionDir)bin;$(LibraryPath)</LibraryPath>
</PropertyGroup>
<ItemDefinitionGroup>
@ -48,7 +49,7 @@
<ItemGroup>
<ClCompile Include="LanguagePackTest.cpp" />
<ClCompile Include="sawyercoding_test.cpp" />
<ClCompile Include="$(GTestDir)\googletest\src\gtest-all.cc" />
<ClCompile Include="$(GtestDir)\src\gtest-all.cc" />
<ClCompile Include="tests.cpp" />
</ItemGroup>