Make unit tests available in Release builds

This commit is contained in:
Birunthan Mohanathas 2013-06-13 21:13:57 +03:00
parent c5e2a7a2cb
commit 8a086ffdcb
4 changed files with 19 additions and 11 deletions

View File

@ -20,7 +20,7 @@ echo.
if not exist "%VCVARSALL%" echo ERROR: vcvarsall.bat not found & goto END if not exist "%VCVARSALL%" echo ERROR: vcvarsall.bat not found & goto END
call "%VCVARSALL%" x86 > nul call "%VCVARSALL%" x86 > nul
set MSBUILD="msbuild.exe" /p:PlatformToolset=v110_xp;VisualStudioVersion=11.0 set MSBUILD="msbuild.exe" /p:PlatformToolset=v110_xp;VisualStudioVersion=11.0;ExcludeTests=false
if exist "Certificate.bat" call "Certificate.bat" > nul if exist "Certificate.bat" call "Certificate.bat" > nul
set SIGNTOOL="signtool.exe" sign /t http://time.certum.pl /f "%CERTFILE%" /p "%CERTKEY%" set SIGNTOOL="signtool.exe" sign /t http://time.certum.pl /f "%CERTFILE%" /p "%CERTKEY%"

View File

@ -13,13 +13,13 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="MathParser_Test.cpp"> <ClCompile Include="MathParser_Test.cpp">
<ExcludedFromBuild>$(ExcludeTestFile)</ExcludedFromBuild> <ExcludedFromBuild>$(ExcludeTests)</ExcludedFromBuild>
</ClCompile> </ClCompile>
<ClCompile Include="PathUtil_Test.cpp"> <ClCompile Include="PathUtil_Test.cpp">
<ExcludedFromBuild>$(ExcludeTestFile)</ExcludedFromBuild> <ExcludedFromBuild>$(ExcludeTests)</ExcludedFromBuild>
</ClCompile> </ClCompile>
<ClCompile Include="StringUtil_Test.cpp"> <ClCompile Include="StringUtil_Test.cpp">
<ExcludedFromBuild>$(ExcludeTestFile)</ExcludedFromBuild> <ExcludedFromBuild>$(ExcludeTests)</ExcludedFromBuild>
</ClCompile> </ClCompile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View File

@ -48,7 +48,7 @@
</ClCompile> </ClCompile>
<Link> <Link>
<AdditionalDependencies>comctl32.lib;Wininet.lib;UxTheme.lib;Winmm.lib;gdiplus.lib;Iphlpapi.lib;shlwapi.lib;d2d1.lib;dwrite.lib;windowscodecs.lib;Version.lib;%(AdditionalDependencies)</AdditionalDependencies> <AdditionalDependencies>comctl32.lib;Wininet.lib;UxTheme.lib;Winmm.lib;gdiplus.lib;Iphlpapi.lib;shlwapi.lib;d2d1.lib;dwrite.lib;windowscodecs.lib;Version.lib;%(AdditionalDependencies)</AdditionalDependencies>
<DelayLoadDLLs>Winmm.dll;Version.dll;d2d1.dll;dwrite.dll</DelayLoadDLLs> <DelayLoadDLLs>Winmm.dll;Version.dll;d2d1.dll;dwrite.dll;$(DelayLoadTestDLL)</DelayLoadDLLs>
<ModuleDefinitionFile>Exports.def</ModuleDefinitionFile> <ModuleDefinitionFile>Exports.def</ModuleDefinitionFile>
</Link> </Link>
</ItemDefinitionGroup> </ItemDefinitionGroup>
@ -61,7 +61,7 @@
</ClCompile> </ClCompile>
<Link> <Link>
<AdditionalDependencies>comctl32.lib;Wininet.lib;UxTheme.lib;Winmm.lib;gdiplus.lib;Iphlpapi.lib;shlwapi.lib;d2d1.lib;dwrite.lib;windowscodecs.lib;Version.lib;%(AdditionalDependencies)</AdditionalDependencies> <AdditionalDependencies>comctl32.lib;Wininet.lib;UxTheme.lib;Winmm.lib;gdiplus.lib;Iphlpapi.lib;shlwapi.lib;d2d1.lib;dwrite.lib;windowscodecs.lib;Version.lib;%(AdditionalDependencies)</AdditionalDependencies>
<DelayLoadDLLs>Winmm.dll;Version.dll;d2d1.dll;dwrite.dll</DelayLoadDLLs> <DelayLoadDLLs>Winmm.dll;Version.dll;d2d1.dll;dwrite.dll;$(DelayLoadTestDLL)</DelayLoadDLLs>
<ModuleDefinitionFile>Exports.def</ModuleDefinitionFile> <ModuleDefinitionFile>Exports.def</ModuleDefinitionFile>
</Link> </Link>
</ItemDefinitionGroup> </ItemDefinitionGroup>
@ -88,7 +88,7 @@
<PrecompiledHeader>Use</PrecompiledHeader> <PrecompiledHeader>Use</PrecompiledHeader>
</ClCompile> </ClCompile>
<ClCompile Include="ConfigParser_Test.cpp"> <ClCompile Include="ConfigParser_Test.cpp">
<ExcludedFromBuild>$(ExcludeTestFile)</ExcludedFromBuild> <ExcludedFromBuild>$(ExcludeTests)</ExcludedFromBuild>
</ClCompile> </ClCompile>
<ClCompile Include="DialogAbout.cpp"> <ClCompile Include="DialogAbout.cpp">
<PrecompiledHeader>Use</PrecompiledHeader> <PrecompiledHeader>Use</PrecompiledHeader>

View File

@ -32,14 +32,24 @@
<!-- Macros for unit testing. --> <!-- Macros for unit testing. -->
<PropertyGroup Label="UserMacros"> <PropertyGroup Label="UserMacros">
<ExcludeTestFile>true</ExcludeTestFile> <!-- This is set to true by Build.bat when building full builds. -->
<ExcludeTestFile Condition="'$(Configuration)'=='Debug'">false</ExcludeTestFile> <ExcludeTests>false</ExcludeTests>
<!-- Non-static projects must delayload CppUnitTestFramework.dll to avoid the "module not found" <!-- Non-static projects must delayload CppUnitTestFramework.dll to avoid the "module not found"
errors (since CppUnitTestFramework.dll is available only when running tests). --> errors (since CppUnitTestFramework.dll is available only when running tests). -->
<DelayLoadTestDLL Condition="'$(ConfigurationType)'!='StaticLibrary'">Microsoft.VisualStudio.TestTools.CppUnitTestFramework.dll</DelayLoadTestDLL> <DelayLoadTestDLL Condition="'$(ConfigurationType)'!='StaticLibrary'">Microsoft.VisualStudio.TestTools.CppUnitTestFramework.dll</DelayLoadTestDLL>
<DelayLoadTestDLL Condition="'$(ExcludeTests)'=='true'"></DelayLoadTestDLL>
</PropertyGroup> </PropertyGroup>
<ItemDefinitionGroup Condition="'$(ExcludeTests)'=='false'">
<ClCompile>
<AdditionalIncludeDirectories>$(VCInstallDir)UnitTest\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<AdditionalLibraryDirectories>$(VCInstallDir)UnitTest\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup> <ItemDefinitionGroup>
<ClCompile> <ClCompile>
<!-- Set the version macros to 0x0601 (Win7) to avoid using Win8 specific features in the Win8 SDK. --> <!-- Set the version macros to 0x0601 (Win7) to avoid using Win8 specific features in the Win8 SDK. -->
@ -58,13 +68,11 @@
<ItemDefinitionGroup Condition="'$(Configuration)'=='Debug'"> <ItemDefinitionGroup Condition="'$(Configuration)'=='Debug'">
<ClCompile> <ClCompile>
<AdditionalIncludeDirectories>$(VCInstallDir)UnitTest\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<Optimization>Disabled</Optimization> <Optimization>Disabled</Optimization>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
</ClCompile> </ClCompile>
<Link> <Link>
<AdditionalLibraryDirectories>$(VCInstallDir)UnitTest\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
</Link> </Link>
<ResourceCompile> <ResourceCompile>