Skip to content

Commit

Permalink
Merge 33b8c07 into dc93661
Browse files Browse the repository at this point in the history
  • Loading branch information
sanomari authored Oct 20, 2020
2 parents dc93661 + 33b8c07 commit ece95fa
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 17 deletions.
4 changes: 1 addition & 3 deletions tests/compiletests.run.cmd
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
setlocal
set BUILD_BASE_DIR=%~dp1
set BUILD_DIR=%~dp1
set SOURCE_DIR=%~dp0compiletests

:: find generic tools
Expand All @@ -16,12 +16,10 @@ if not exist "%CMD_NINJA%" (
set GENERATOR="%CMAKE_G_PARAM%"
set GENERATOR_OPTS=-A %PLATFORM% "-DCMAKE_CONFIGURATION_TYPES=Debug;Release"
set "MAKE_PROGRAM=%CMD_MSBUILD%"
set "BUILD_DIR=%BUILD_BASE_DIR%compiletests\%platform%"
) else (
set GENERATOR=Ninja
set GENERATOR_OPTS=-DCMAKE_BUILD_TYPE=%CONFIGURATION%
set "MAKE_PROGRAM=%CMD_NINJA%"
set "BUILD_DIR=%BUILD_BASE_DIR%compiletests\%platform%\%configuration%"
)

mkdir %BUILD_DIR% > NUL 2>&1
Expand Down
15 changes: 12 additions & 3 deletions tests/compiletests.targets
Original file line number Diff line number Diff line change
@@ -1,12 +1,21 @@
<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!-- This target depends on googletest.targets -->
<Target Name="RunCompileTests" DependsOnTargets="MakeGoogleTestBuildDir;BuildGoogleTest" BeforeTargets="ClCompile">
<PropertyGroup Label="CompileTest">
<CompileTestSourceDir>$(MSBuildThisFileDirectory)compiletests\</CompileTestSourceDir>
<CompileTestBuildDir>$(MSBuildThisFileDirectory)build\$(Platform)\$(Configuration)\compiletests\</CompileTestBuildDir>
</PropertyGroup>
<Target Name="MakeCompileTestBuildDir" Condition="!Exists('$(CompileTestBuildDir)')">
<MakeDir Directories="$(CompileTestBuildDir)" />
</Target>
<Target Name="RunCompileTests" DependsOnTargets="MakeCompileTestBuildDir" BeforeTargets="ClCompile" Condition="!Exists('$(CompileTestBuildDir)CMakeCache.txt')">
<PropertyGroup>
<VsVersion>$([System.Text.RegularExpressions.Regex]::Replace('$(VisualStudioVersion)', '^(\d+).*', '$1'))</VsVersion>
</PropertyGroup>
<SetEnv name="platform" value="$(Platform)" prefix="false" />
<SetEnv name="configuration" value="$(Configuration)" prefix="false" />
<SetEnv name="NUM_VSVERSION" value="$(VsVersion)" prefix="false" />
<Exec Command="$(MSBuildThisFileDirectory)compiletests.run.cmd &quot;$(GoogleTestBuildDir)&quot;" ConsoleToMSBuild="true" />
<Exec Command="$(MSBuildThisFileDirectory)compiletests.run.cmd &quot;$(CompileTestBuildDir)&quot;" ConsoleToMSBuild="true" />
</Target>
<Target Name="AppendCleanTargetsForCompileTest" BeforeTargets="CoreClean">
<RemoveDir Directories="$(CompileTestBuildDir)" />
</Target>
</Project>
4 changes: 1 addition & 3 deletions tests/googletest.build.cmd
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
setlocal
set BUILD_BASE_DIR=%~dp1
set BUILD_DIR=%~dp1
set GOOGLETEST_INSTALL_PATH=%~dp2

set SOURCE_DIR=%~dp0googletest
Expand Down Expand Up @@ -28,12 +28,10 @@ if not exist "%CMD_NINJA%" (
set GENERATOR="%CMAKE_G_PARAM%"
set GENERATOR_OPTS=-A %PLATFORM% "-DCMAKE_CONFIGURATION_TYPES=Debug;Release"
set "MAKE_PROGRAM=%CMD_MSBUILD%"
set "BUILD_DIR=%BUILD_BASE_DIR%googletest\%platform%"
) else (
set GENERATOR=Ninja
set GENERATOR_OPTS=-DCMAKE_BUILD_TYPE=%CONFIGURATION%
set "MAKE_PROGRAM=%CMD_NINJA%"
set "BUILD_DIR=%BUILD_BASE_DIR%googletest\%platform%\%configuration%"
)

mkdir %BUILD_DIR% > NUL 2>&1
Expand Down
21 changes: 13 additions & 8 deletions tests/googletest.targets
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Label="GoogleTest">
<GoogleTestSourceDir>$(MSBuildThisFileDirectory)googletest</GoogleTestSourceDir>
<GoogleTestBuildDir>$(MSBuildThisFileDirectory)build\</GoogleTestBuildDir>
<GoogleTestInstallDir>$([MsBuild]::NormalizePath('$(MSBuildThisFileDirectory)..\tools\googletest\'))</GoogleTestInstallDir>
<GoogleTestBuildDir>$(MSBuildThisFileDirectory)build\$(Platform)\$(Configuration)\gtest_build\</GoogleTestBuildDir>
<GoogleTestInstallDir>$([MsBuild]::NormalizePath('$(GoogleTestBuildDir)..\googletest\'))</GoogleTestInstallDir>
<IncludePath>$(GoogleTestInstallDir)include;$(IncludePath)</IncludePath>
<LibraryPath Condition="'$(Platform)' == 'Win32'">$(GoogleTestInstallDir)lib;$(LibraryPath)</LibraryPath>
<LibraryPath Condition="'$(Platform)' == 'x64'">$(GoogleTestInstallDir)lib64;$(LibraryPath)</LibraryPath>
<GoogleTestLibInstallDir Condition="'$(Platform)' == 'Win32'">$(GoogleTestInstallDir)lib</GoogleTestLibInstallDir>
<GoogleTestLibInstallDir Condition="'$(Platform)' == 'x64'">$(GoogleTestInstallDir)lib64</GoogleTestLibInstallDir>
<LibraryPath>$(GoogleTestLibInstallDir);$(LibraryPath)</LibraryPath>
<NameSuffix Condition="'$(Configuration)' == 'Debug'">d</NameSuffix>
<NameSuffix Condition="'$(Configuration)' == 'Release'"></NameSuffix>
<GTestLibName>gtest$(NameSuffix).lib</GTestLibName>
<GTestMainLibName>gtest_main$(NameSuffix).lib</GTestMainLibName>
<GTestLibPath>$(GoogleTestLibInstallDir)\$(GTestLibName)</GTestLibPath>
<GTestMainLibPath>$(GoogleTestLibInstallDir)\$(GTestMainLibName)</GTestMainLibPath>
</PropertyGroup>
<ItemDefinitionGroup Label="GoogleTest.Requirements">
<ClCompile>
Expand All @@ -16,8 +21,8 @@
</ItemDefinitionGroup>
<ItemDefinitionGroup Label="GoogleTest.Libs">
<Link>
<AdditionalDependencies>gtest$(NameSuffix).lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>gtest_main$(NameSuffix).lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>$(GTestLibName);%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>$(GTestMainLibName);%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<Target Name="MakeGoogleTestBuildDir" Condition="!Exists('$(GoogleTestBuildDir)')">
Expand All @@ -26,7 +31,7 @@
<Target Name="MakeGoogleTestInstallDir" Condition="!Exists('$(GoogleTestInstallDir)')">
<MakeDir Directories="$(GoogleTestInstallDir)" />
</Target>
<Target Name="BuildGoogleTest" DependsOnTargets="MakeGoogleTestBuildDir;MakeGoogleTestInstallDir" BeforeTargets="ClCompile">
<Target Name="BuildGoogleTest" DependsOnTargets="MakeGoogleTestBuildDir;MakeGoogleTestInstallDir" BeforeTargets="ClCompile" Condition="!Exists('$(GTestLibPath)') Or !Exists('$(GTestMainLibPath)')">
<PropertyGroup>
<VsVersion>$([System.Text.RegularExpressions.Regex]::Replace('$(VisualStudioVersion)', '^(\d+).*', '$1'))</VsVersion>
</PropertyGroup>
Expand All @@ -35,7 +40,7 @@
<SetEnv name="NUM_VSVERSION" value="$(VsVersion)" prefix="false" />
<Exec Command="$(MSBuildThisFileDirectory)googletest.build.cmd &quot;$(GoogleTestBuildDir)&quot; &quot;$(GoogleTestInstallDir)&quot;" ConsoleToMSBuild="true" />
</Target>
<Target Name="AppendCleanTargets" BeforeTargets="CoreClean">
<Target Name="AppendCleanTargetsForGoogleTest" BeforeTargets="CoreClean">
<RemoveDir Directories="$(GoogleTestBuildDir)" />
<RemoveDir Directories="$(GoogleTestInstallDir)" />
</Target>
Expand Down

0 comments on commit ece95fa

Please sign in to comment.