1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-22 22:34:33 +01:00

Merge pull request #16367 from janisozaur/googletest-20220102

Update GoogleTest version
This commit is contained in:
Michał Janiszewski
2022-05-08 21:09:50 -07:00
committed by GitHub
6 changed files with 15 additions and 30 deletions

View File

@@ -43,9 +43,6 @@
<LibsSha1 Condition="'$(Platform)'=='x64'">6eb97a49ad30442fe6d08799a0561d7cf0c95d40</LibsSha1>
<LibsUrl Condition="'$(Platform)'=='ARM64'">https://github.com/OpenRCT2/Dependencies/releases/download/v32/openrct2-libs-v32-arm64-windows-static.zip</LibsUrl>
<LibsSha1 Condition="'$(Platform)'=='ARM64'">fa5f067fcfb5e76c4d4fb6f2211b422cbbe25f26</LibsSha1>
<GtestVersion>2fe3bd994b3189899d93f1d5a881e725e046fdc2</GtestVersion>
<GtestUrl>https://github.com/google/googletest/archive/$(GtestVersion).zip</GtestUrl>
<GtestSha1>058b9df80244c03f1633cb06e9f70471a29ebb8e</GtestSha1>
<TitleSequencesUrl>https://github.com/OpenRCT2/title-sequences/releases/download/v0.4.0/title-sequences.zip</TitleSequencesUrl>
<TitleSequencesSha1>4ab0065e5a4d9f9c77d94718bbdfcfcd5a389da0</TitleSequencesSha1>
<ObjectsUrl>https://github.com/OpenRCT2/objects/releases/download/v1.2.7/objects.zip</ObjectsUrl>
@@ -65,18 +62,6 @@
Sha1="$(LibsSha1)"
CheckFile="$(DependenciesCheckFile)"
OutputDirectory="$(RootDir)lib\$(Platform)" />
<!-- googletest -->
<DownloadDependency Name="googletest"
Url="$(GtestUrl)"
Sha1="$(GtestSha1)"
CheckFile="$(DependenciesCheckFile)"
OutputDirectory="$(RootDir)lib" />
<PropertyGroup>
<GtestSrc>$(RootDir)lib\googletest-$(GtestVersion)</GtestSrc>
<GtestDst>$(RootDir)lib\googletest</GtestDst>
</PropertyGroup>
<Exec Command="cmd /c &quot;if exist &quot;$(GtestSrc)&quot; ( rmdir /S /Q &quot;$(GtestDst)&quot; 2> nul &amp; move &quot;$(GtestSrc)&quot; &quot;$(GtestDst)&quot; )&quot;" />
</Target>
<Target Name="Clean">

View File

@@ -13,11 +13,10 @@ else (SYSTEM_GTEST)
# Bootstrap GoogleTest
INCLUDE(ExternalProject)
# Use googletest with https://github.com/google/googletest/pull/1045 applied
ExternalProject_Add(
googletest-distribution
URL https://github.com/google/googletest/archive/ad49eaa0466b98f21449efaaaae817683daa8b99.tar.gz
URL_HASH SHA1=e468bfdffe7c46c14ce06bfb48a29b6201908504
URL https://github.com/google/googletest/archive/e2239ee6043f73722e7aa812a459f54a28552929.tar.gz # v1.11.0 release
URL_HASH SHA1=b0399e38211cc4fedd612f71bad7984ed4cbe8fe
TIMEOUT 10
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
@@ -32,10 +31,10 @@ else (SYSTEM_GTEST)
googletest
DEPENDS googletest-distribution
DOWNLOAD_COMMAND ""
SOURCE_DIR "${GOOGLETEST_DISTRIB_SOURCE_DIR}/googletest"
CMAKE_ARGS "-DCMAKE_CXX_FLAGS=${TARGET_M}"
BUILD_BYPRODUCTS "googletest-prefix/src/googletest-build/${CMAKE_STATIC_LIBRARY_PREFIX}gtest${CMAKE_STATIC_LIBRARY_SUFFIX}"
BUILD_BYPRODUCTS "googletest-prefix/src/googletest-build/${CMAKE_STATIC_LIBRARY_PREFIX}gtest_main${CMAKE_STATIC_LIBRARY_SUFFIX}"
SOURCE_DIR "${GOOGLETEST_DISTRIB_SOURCE_DIR}"
CMAKE_ARGS "-DCMAKE_CXX_FLAGS=${TARGET_M} -DBUILD_GMOCK=off"
BUILD_BYPRODUCTS "googletest-prefix/src/googletest-build/lib/${CMAKE_STATIC_LIBRARY_PREFIX}gtest${CMAKE_STATIC_LIBRARY_SUFFIX}"
BUILD_BYPRODUCTS "googletest-prefix/src/googletest-build/lib/${CMAKE_STATIC_LIBRARY_PREFIX}gtest_main${CMAKE_STATIC_LIBRARY_SUFFIX}"
# Disable install step
INSTALL_COMMAND ""
# Wrap download, configure and build steps in a script to log output
@@ -49,7 +48,7 @@ else (SYSTEM_GTEST)
# Library
ExternalProject_Get_Property(googletest BINARY_DIR)
set(GOOGLETEST_BINARY_DIR "${BINARY_DIR}")
set(GOOGLETEST_BINARY_DIR "${BINARY_DIR}/lib")
set(GTEST_LIBRARY_PATH ${GOOGLETEST_BINARY_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}gtest${CMAKE_STATIC_LIBRARY_SUFFIX})
set(GTEST_MAIN_LIBRARY_PATH ${GOOGLETEST_BINARY_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}gtest_main${CMAKE_STATIC_LIBRARY_SUFFIX})
set(GTEST_LIBRARY gtest)

View File

@@ -211,7 +211,7 @@ TEST_P(SimplePathfindingTest, CanFindPathFromStartToGoal)
EXPECT_TRUE(succeeded);
}
INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_SUITE_P(
ForScenario, SimplePathfindingTest,
::testing::Values(
SimplePathfindingScenario("StraightFlat", { 19, 15, 14 }, 24), SimplePathfindingScenario("SBend", { 15, 12, 14 }, 87),
@@ -244,7 +244,7 @@ TEST_P(ImpossiblePathfindingTest, CannotFindPathFromStartToGoal)
EXPECT_FALSE(FindPath(&pos, goal, 10000, ride->id));
}
INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_SUITE_P(
ForScenario, ImpossiblePathfindingTest,
::testing::Values(
SimplePathfindingScenario("PathWithGap", { 1, 6, 14 }, 10000),

View File

@@ -115,4 +115,4 @@ struct PrintReplayParameter
}
};
INSTANTIATE_TEST_CASE_P(Replay, ReplayTests, testing::ValuesIn(GetReplayFiles()), PrintReplayParameter());
INSTANTIATE_TEST_SUITE_P(Replay, ReplayTests, testing::ValuesIn(GetReplayFiles()), PrintReplayParameter());

View File

@@ -27,7 +27,7 @@ class StringTest : public testing::TestWithParam<TCase>
// Tests for String::Trim
///////////////////////////////////////////////////////////////////////////////
INSTANTIATE_TEST_CASE_P(
INSTANTIATE_TEST_SUITE_P(
TrimData, StringTest,
testing::Values(
// input after Trim after TrimStart

View File

@@ -2,7 +2,6 @@
<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="Debug|Win32">
@@ -41,8 +40,9 @@
<Import Project="..\..\openrct2.common.props" />
<PropertyGroup>
<OutDir>$(SolutionDir)bin\</OutDir>
<IncludePath>$(GtestDir);$(GtestDir)\include;$(IncludePath)</IncludePath>
<LibraryPath>$(SolutionDir)bin;$(LibraryPath)</LibraryPath>
<LibraryPath Condition="'$(Configuration)'=='Debug'">$(SolutionDir)lib\$(Platform)\debug\lib;$(LibraryPath)</LibraryPath>
<LibraryPath Condition="'$(Configuration)'!='Debug'">$(SolutionDir)lib\$(Platform)\lib;$(LibraryPath)</LibraryPath>
</PropertyGroup>
<ItemDefinitionGroup>
<ClCompile>
@@ -50,6 +50,8 @@
</ClCompile>
<Link>
<AdditionalDependencies>libopenrct2.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies Condition="'$(Configuration)'=='Debug'">gtestd.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies Condition="'$(Configuration)'!='Debug'">gtest.lib;%(AdditionalDependencies)</AdditionalDependencies>
<SubSystem>Console</SubSystem>
</Link>
<PostBuildEvent>
@@ -83,7 +85,6 @@
<ClCompile Include="RideRatings.cpp" />
<ClCompile Include="S6ImportExportTests.cpp" />
<ClCompile Include="sawyercoding_test.cpp" />
<ClCompile Include="$(GtestDir)\src\gtest-all.cc" />
<ClCompile Include="TestData.cpp" />
<ClCompile Include="tests.cpp" />
<ClCompile Include="StringTest.cpp" />