From a08af1a2537a2b1df386cd138c4a424c50fbc6cc Mon Sep 17 00:00:00 2001 From: Ted John Date: Fri, 2 Dec 2016 00:34:14 +0000 Subject: [PATCH 01/11] Get tests to build for Windows and VS --- openrct2.sln | 14 +++++ openrct2.vcxproj | 8 ++- src/platform/windows.c | 2 +- test/tests/sawyercoding_test.cpp | 3 + test/tests/tests.cpp | 13 ++++ test/tests/tests.vcxproj | 101 +++++++++++++++++++++++++++++++ 6 files changed, 138 insertions(+), 3 deletions(-) create mode 100644 test/tests/tests.cpp create mode 100644 test/tests/tests.vcxproj diff --git a/openrct2.sln b/openrct2.sln index a9f6803221..37c5ec1170 100644 --- a/openrct2.sln +++ b/openrct2.sln @@ -7,6 +7,11 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "openrct2", "openrct2.vcxpro EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testpaint", "test\testpaint\testpaint.vcxproj", "{57E60BA1-FB76-4316-909E-C1449C142327}" EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tests", "test\tests\tests.vcxproj", "{62B020FA-E4FB-4C6E-B32A-DC999470F155}" + ProjectSection(ProjectDependencies) = postProject + {D24D94F6-2A74-480C-B512-629C306CE92F} = {D24D94F6-2A74-480C-B512-629C306CE92F} + EndProjectSection +EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{2202A816-377D-4FA0-A7AF-7D4105F8A4FB}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{480B577D-4E4A-4757-9A42-28A9AD33E6B0}" @@ -33,6 +38,14 @@ Global {57E60BA1-FB76-4316-909E-C1449C142327}.Release|Win32.ActiveCfg = Release|Win32 {57E60BA1-FB76-4316-909E-C1449C142327}.Release|Win32.Build.0 = Release|Win32 {57E60BA1-FB76-4316-909E-C1449C142327}.Release|x64.ActiveCfg = Release|Win32 + {62B020FA-E4FB-4C6E-B32A-DC999470F155}.Debug|Win32.ActiveCfg = Debug|Win32 + {62B020FA-E4FB-4C6E-B32A-DC999470F155}.Debug|Win32.Build.0 = Debug|Win32 + {62B020FA-E4FB-4C6E-B32A-DC999470F155}.Debug|x64.ActiveCfg = Debug|x64 + {62B020FA-E4FB-4C6E-B32A-DC999470F155}.Debug|x64.Build.0 = Debug|x64 + {62B020FA-E4FB-4C6E-B32A-DC999470F155}.Release|Win32.ActiveCfg = Release|Win32 + {62B020FA-E4FB-4C6E-B32A-DC999470F155}.Release|Win32.Build.0 = Release|Win32 + {62B020FA-E4FB-4C6E-B32A-DC999470F155}.Release|x64.ActiveCfg = Release|x64 + {62B020FA-E4FB-4C6E-B32A-DC999470F155}.Release|x64.Build.0 = Release|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -40,5 +53,6 @@ Global GlobalSection(NestedProjects) = preSolution {D24D94F6-2A74-480C-B512-629C306CE92F} = {2202A816-377D-4FA0-A7AF-7D4105F8A4FB} {57E60BA1-FB76-4316-909E-C1449C142327} = {480B577D-4E4A-4757-9A42-28A9AD33E6B0} + {62B020FA-E4FB-4C6E-B32A-DC999470F155} = {480B577D-4E4A-4757-9A42-28A9AD33E6B0} EndGlobalSection EndGlobal diff --git a/openrct2.vcxproj b/openrct2.vcxproj index 2e3bfde9eb..202974fbd1 100644 --- a/openrct2.vcxproj +++ b/openrct2.vcxproj @@ -563,6 +563,9 @@ true MultiByte + + StaticLibrary + @@ -600,9 +603,10 @@ $(SolutionDir)obj\$(ProjectName)\$(Configuration)_$(Platform)\ $(ProjectName) - + - USE_BREAKPAD;%(PreprocessorDefinitions) + USE_BREAKPAD;%(PreprocessorDefinitions) + __NOENTRYPOINT__;%(PreprocessorDefinitions) diff --git a/src/platform/windows.c b/src/platform/windows.c index bdeb7abd57..8fda6936cd 100644 --- a/src/platform/windows.c +++ b/src/platform/windows.c @@ -52,7 +52,7 @@ utf8 **windows_get_command_line_args(int *outNumArgs); static HMODULE _dllModule = NULL; -#ifdef NO_RCT2 +#if defined(NO_RCT2) && !defined(__NOENTRYPOINT__) /** * Windows entry point to OpenRCT2 without a console window. diff --git a/test/tests/sawyercoding_test.cpp b/test/tests/sawyercoding_test.cpp index 2dce17f261..c7105416c5 100644 --- a/test/tests/sawyercoding_test.cpp +++ b/test/tests/sawyercoding_test.cpp @@ -1,3 +1,6 @@ +// Make MSVC shut up about M_PI +#include + extern "C" { #include "util/sawyercoding.h" } diff --git a/test/tests/tests.cpp b/test/tests/tests.cpp new file mode 100644 index 0000000000..bba7cb7be3 --- /dev/null +++ b/test/tests/tests.cpp @@ -0,0 +1,13 @@ +// This serves as the entry point when building for MSVC which compiles gtest +// directly into the test binary. +#ifdef _MSC_VER + +#include + +int main(int argc, char * * argv) +{ + testing::InitGoogleTest(&argc, argv); + RUN_ALL_TESTS(); +} + +#endif diff --git a/test/tests/tests.vcxproj b/test/tests/tests.vcxproj new file mode 100644 index 0000000000..01c1504b55 --- /dev/null +++ b/test/tests/tests.vcxproj @@ -0,0 +1,101 @@ + + + + ..\..\ + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + {62B020FA-E4FB-4C6E-B32A-DC999470F155} + tests + + + + + Application + true + MultiByte + + + Application + false + true + MultiByte + + + + + + + + + + + $(SolutionDir)bin\tests\ + $(SolutionDir)obj\$(ProjectName)\$(Configuration)\ + tests + $(GTestDir)\googletest;$(GTestDir)\googletest\include;$(SolutionDir)src;$(SolutionDir)lib\include;$(SolutionDir)lib\include\breakpad;$(SolutionDir)lib\include\libspeex;$(SolutionDir)lib\include\sdl;$(SolutionDir)lib\include\jansson;$(SolutionDir)lib\include\sdl_ttf;$(SolutionDir)lib\include\libpng;$(SolutionDir)lib\include\zlib;$(IncludePath) + $(SolutionDir)bin;$(SolutionDir)lib;$(LibraryPath) + + + + Level3 + Disabled + true + DEBUG;OPENGL_NO_LINK;_CRT_SECURE_NO_WARNINGS;_USE_MATH_DEFINES;CURL_STATICLIB;SDL_MAIN_HANDLED;_WINSOCK_DEPRECATED_NO_WARNINGS;%(PreprocessorDefinitions) + MultiThreaded + true + true + 4200 + true + false + + + openrct2.lib;openrct2-libs-vs2015-x64.lib;imm32.lib;version.lib;winmm.lib;crypt32.lib;%(AdditionalDependencies) + /OPT:NOLBR /ignore:4099 %(AdditionalOptions) + + + + + Level3 + MaxSpeed + true + true + true + DEBUG;OPENGL_NO_LINK;_CRT_SECURE_NO_WARNINGS;_USE_MATH_DEFINES;CURL_STATICLIB;SDL_MAIN_HANDLED;_WINSOCK_DEPRECATED_NO_WARNINGS;%(PreprocessorDefinitions) + true + 4200 + true + + + true + true + openrct2.lib;%(AdditionalDependencies) + + + + + + + + + + + + \ No newline at end of file From 91e19c7d48cc1e2596e43f217a1a62a634fd43a7 Mon Sep 17 00:00:00 2001 From: Ted John Date: Fri, 2 Dec 2016 00:59:52 +0000 Subject: [PATCH 02/11] Move a lot of the common properties to a shared props file --- openrct2.common.props | 87 ++++++++++++++++++++ openrct2.vcxproj | 171 +++------------------------------------ test/tests/tests.vcxproj | 66 +++------------ 3 files changed, 106 insertions(+), 218 deletions(-) diff --git a/openrct2.common.props b/openrct2.common.props index 10103679d6..eaa0b37966 100644 --- a/openrct2.common.props +++ b/openrct2.common.props @@ -1,8 +1,95 @@ + + ..\..\ + + + + $(DefaultPlatformToolset) $(UCRTVersion) + + MultiByte + + $(SolutionDir)bin\ + $(SolutionDir)obj\$(ProjectName)\$(Configuration)_$(Platform)\ + $(ProjectName) + + + true + + + + false + true + + + + $(SolutionDir)bin\ + $(SolutionDir)obj\$(ProjectName)\$(Configuration)_$(Platform)\ + + $(ProjectName) + + + $(SolutionDir)bin\ + $(SolutionDir)obj\$(ProjectName)\$(Configuration)_$(Platform)\ + $(ProjectName) + + + + + 4091;%(DisableSpecificWarnings) + Level3 + OPENGL_NO_LINK;_CRT_SECURE_NO_WARNINGS;_USE_MATH_DEFINES;CURL_STATICLIB;SDL_MAIN_HANDLED;_WINSOCK_DEPRECATED_NO_WARNINGS;%(PreprocessorDefinitions) + MultiThreaded + true + 4013 + true + + + openrct2-libs-vs2015-x64.lib;imm32.lib;version.lib;winmm.lib;crypt32.lib;%(AdditionalDependencies) + /OPT:NOLBR /ignore:4099 %(AdditionalOptions) + + + PerMonitorHighDPIAware + + + + + Disabled + true + DEBUG;%(PreprocessorDefinitions) + false + + + true + UseFastLinkTimeCodeGeneration + + + + + Full + true + true + + + false + %(PreprocessorDefinitions) + Speed + + + true + true + true + + + + + + + $(SolutionDir)lib\include;$(SolutionDir)lib\include\breakpad;$(SolutionDir)lib\include\libspeex;$(SolutionDir)lib\include\sdl;$(SolutionDir)lib\include\jansson;$(SolutionDir)lib\include\sdl_ttf;$(SolutionDir)lib\include\libpng;$(SolutionDir)lib\include\zlib;$(IncludePath) + $(SolutionDir)lib;$(LibraryPath) diff --git a/openrct2.vcxproj b/openrct2.vcxproj index 202974fbd1..c1bf2508e9 100644 --- a/openrct2.vcxproj +++ b/openrct2.vcxproj @@ -18,6 +18,7 @@ x64 + @@ -540,185 +541,31 @@ openrct2 openrct2 - - - + + Application + + + DynamicLibrary - true - MultiByte - - - Application - false - true - MultiByte - - - Application - true - MultiByte - - - false - true - MultiByte StaticLibrary - - - - - - - - - - - $(SolutionDir)lib\include;$(SolutionDir)lib\include\breakpad;$(SolutionDir)lib\include\libspeex;$(SolutionDir)lib\include\sdl;$(SolutionDir)lib\include\jansson;$(SolutionDir)lib\include\sdl_ttf;$(SolutionDir)lib\include\libpng;$(SolutionDir)lib\include\zlib;$(IncludePath) - $(SolutionDir)lib;$(LibraryPath) - $(SolutionDir)bin\ - $(SolutionDir)obj\$(ProjectName)\$(Configuration)_$(Platform)\ - - - - $(SolutionDir)lib\include;$(SolutionDir)lib\include\breakpad;$(SolutionDir)lib\include\libspeex;$(SolutionDir)lib\include\sdl;$(SolutionDir)lib\include\jansson;$(SolutionDir)lib\include\sdl_ttf;$(SolutionDir)lib\include\libpng;$(SolutionDir)lib\include\zlib;$(IncludePath) - $(SolutionDir)lib;$(LibraryPath) - $(SolutionDir)bin\ - $(SolutionDir)obj\$(ProjectName)\$(Configuration)_$(Platform)\ - - - $(SolutionDir)lib\include;$(SolutionDir)lib\include\breakpad;$(SolutionDir)lib\include\libspeex;$(SolutionDir)lib\include\sdl;$(SolutionDir)lib\include\jansson;$(SolutionDir)lib\include\sdl_ttf;$(SolutionDir)lib\include\libpng;$(SolutionDir)lib\include\zlib;$(IncludePath) - $(SolutionDir)lib;$(LibraryPath) - $(SolutionDir)bin\ - $(SolutionDir)obj\$(ProjectName)\$(Configuration)_$(Platform)\ - - $(ProjectName) - - - $(SolutionDir)lib\include;$(SolutionDir)lib\include\breakpad;$(SolutionDir)lib\include\libspeex;$(SolutionDir)lib\include\sdl;$(SolutionDir)lib\include\jansson;$(SolutionDir)lib\include\sdl_ttf;$(SolutionDir)lib\include\libpng;$(SolutionDir)lib\include\zlib;$(IncludePath) - $(SolutionDir)lib;$(LibraryPath) - $(SolutionDir)bin\ - $(SolutionDir)obj\$(ProjectName)\$(Configuration)_$(Platform)\ - $(ProjectName) - + USE_BREAKPAD;%(PreprocessorDefinitions) __NOENTRYPOINT__;%(PreprocessorDefinitions) - + - 4091;%(DisableSpecificWarnings) - Level3 - Disabled - true - DEBUG;OPENGL_NO_LINK;_CRT_SECURE_NO_WARNINGS;_USE_MATH_DEFINES;CURL_STATICLIB;SDL_MAIN_HANDLED;_WINSOCK_DEPRECATED_NO_WARNINGS;%(PreprocessorDefinitions) - MultiThreaded - true $(IntDir)\%(RelativeDir) - 4013 - false - true $(OPENRCT2_CL_ADDITIONALOPTIONS) - true - openrct2-libs-vs2015-x86.lib;imm32.lib;version.lib;winmm.lib;crypt32.lib;%(AdditionalDependencies) - UseFastLinkTimeCodeGeneration - /OPT:NOLBR /ignore:4099 %(AdditionalOptions) + Console - - - 4091;%(DisableSpecificWarnings) - Level3 - Full - true - true - - MultiThreaded - 4013 - - false - NO_RCT2;OPENGL_NO_LINK;_CRT_SECURE_NO_WARNINGS;_USE_MATH_DEFINES;CURL_STATICLIB;SDL_MAIN_HANDLED;%(PreprocessorDefinitions) - $(IntDir)\%(RelativeDir) - true - Speed - true - $(OPENRCT2_CL_ADDITIONALOPTIONS) - - - true - true - true - openrct2-libs-vs2015-x86.lib;imm32.lib;version.lib;winmm.lib;crypt32.lib;%(AdditionalDependencies) - /ignore:4099 %(AdditionalOptions) - Windows - - - PerMonitorHighDPIAware - - - - - 4091;%(DisableSpecificWarnings) - Level3 - Disabled - true - DEBUG;OPENGL_NO_LINK;_CRT_SECURE_NO_WARNINGS;_USE_MATH_DEFINES;CURL_STATICLIB;SDL_MAIN_HANDLED;_WINSOCK_DEPRECATED_NO_WARNINGS;%(PreprocessorDefinitions) - MultiThreaded - true - $(IntDir)\%(RelativeDir) - 4013 - false - true - $(OPENRCT2_CL_ADDITIONALOPTIONS) - - - true - openrct2-libs-vs2015-x64.lib;imm32.lib;version.lib;winmm.lib;crypt32.lib;%(AdditionalDependencies) - UseFastLinkTimeCodeGeneration - /OPT:NOLBR /ignore:4099 %(AdditionalOptions) - Console - - - PerMonitorHighDPIAware - - - - - 4091;%(DisableSpecificWarnings) - Level3 - Full - true - true - - MultiThreaded - 4013 - - false - OPENGL_NO_LINK;_CRT_SECURE_NO_WARNINGS;_USE_MATH_DEFINES;CURL_STATICLIB;SDL_MAIN_HANDLED;%(PreprocessorDefinitions) - $(IntDir)\%(RelativeDir) - true - Speed - true - $(OPENRCT2_CL_ADDITIONALOPTIONS) - - - true - true - true - openrct2-libs-vs2015-x64.lib;imm32.lib;version.lib;winmm.lib;crypt32.lib;%(AdditionalDependencies) - /ignore:4099 %(AdditionalOptions) - Windows - - - PerMonitorHighDPIAware - - - \ No newline at end of file diff --git a/test/tests/tests.vcxproj b/test/tests/tests.vcxproj index 01c1504b55..bfc423ffc0 100644 --- a/test/tests/tests.vcxproj +++ b/test/tests/tests.vcxproj @@ -24,71 +24,24 @@ {62B020FA-E4FB-4C6E-B32A-DC999470F155} tests + tests + + + Application - - - Application - true - MultiByte - - - Application - false - true - MultiByte - - - - - - - - - $(SolutionDir)bin\tests\ - $(SolutionDir)obj\$(ProjectName)\$(Configuration)\ - tests - $(GTestDir)\googletest;$(GTestDir)\googletest\include;$(SolutionDir)src;$(SolutionDir)lib\include;$(SolutionDir)lib\include\breakpad;$(SolutionDir)lib\include\libspeex;$(SolutionDir)lib\include\sdl;$(SolutionDir)lib\include\jansson;$(SolutionDir)lib\include\sdl_ttf;$(SolutionDir)lib\include\libpng;$(SolutionDir)lib\include\zlib;$(IncludePath) - $(SolutionDir)bin;$(SolutionDir)lib;$(LibraryPath) + $(GTestDir)\googletest;$(GTestDir)\googletest\include;$(SolutionDir)src;$(IncludePath) + $(SolutionDir)bin;$(LibraryPath) - - - Level3 - Disabled - true - DEBUG;OPENGL_NO_LINK;_CRT_SECURE_NO_WARNINGS;_USE_MATH_DEFINES;CURL_STATICLIB;SDL_MAIN_HANDLED;_WINSOCK_DEPRECATED_NO_WARNINGS;%(PreprocessorDefinitions) - MultiThreaded - true - true - 4200 - true - false - + - openrct2.lib;openrct2-libs-vs2015-x64.lib;imm32.lib;version.lib;winmm.lib;crypt32.lib;%(AdditionalDependencies) - /OPT:NOLBR /ignore:4099 %(AdditionalOptions) - - - - - Level3 - MaxSpeed - true - true - true - DEBUG;OPENGL_NO_LINK;_CRT_SECURE_NO_WARNINGS;_USE_MATH_DEFINES;CURL_STATICLIB;SDL_MAIN_HANDLED;_WINSOCK_DEPRECATED_NO_WARNINGS;%(PreprocessorDefinitions) - true - 4200 - true - - - true - true openrct2.lib;%(AdditionalDependencies) + + @@ -97,5 +50,6 @@ + \ No newline at end of file From fab8dce9ccaf0c136137f62e7949dfc84d93e344 Mon Sep 17 00:00:00 2001 From: Ted John Date: Fri, 2 Dec 2016 01:00:57 +0000 Subject: [PATCH 03/11] Move file listing to the bottom of openrct2.vcxproj --- openrct2.vcxproj | 64 +++++++++++++++++++++++++----------------------- 1 file changed, 33 insertions(+), 31 deletions(-) diff --git a/openrct2.vcxproj b/openrct2.vcxproj index c1bf2508e9..dcd7a97007 100644 --- a/openrct2.vcxproj +++ b/openrct2.vcxproj @@ -18,6 +18,38 @@ x64 + + {D24D94F6-2A74-480C-B512-629C306CE92F} + openrct2 + openrct2 + + + Application + + + + DynamicLibrary + + + StaticLibrary + + + + + USE_BREAKPAD;%(PreprocessorDefinitions) + __NOENTRYPOINT__;%(PreprocessorDefinitions) + + + + + $(IntDir)\%(RelativeDir) + $(OPENRCT2_CL_ADDITIONALOPTIONS) + + + Console + + + @@ -536,36 +568,6 @@ - - {D24D94F6-2A74-480C-B512-629C306CE92F} - openrct2 - openrct2 - - - Application - - - - DynamicLibrary - - - StaticLibrary - - - - - USE_BREAKPAD;%(PreprocessorDefinitions) - __NOENTRYPOINT__;%(PreprocessorDefinitions) - - - - - $(IntDir)\%(RelativeDir) - $(OPENRCT2_CL_ADDITIONALOPTIONS) - - - Console - - + \ No newline at end of file From 4ccb50409b37a56cfd0c04dfaa74bba1676c957f Mon Sep 17 00:00:00 2001 From: Ted John Date: Fri, 2 Dec 2016 02:49:50 +0000 Subject: [PATCH 04/11] Add test configurations --- openrct2.common.props | 37 ++++++++++++++++++------------------- openrct2.sln | 37 ++++++++++++++++++++++++++++--------- openrct2.vcxproj | 25 ++++++++++++++++++++++--- test/tests/tests.vcxproj | 19 ++++++++++--------- 4 files changed, 78 insertions(+), 40 deletions(-) diff --git a/openrct2.common.props b/openrct2.common.props index eaa0b37966..9f6b6b38de 100644 --- a/openrct2.common.props +++ b/openrct2.common.props @@ -2,6 +2,8 @@ ..\..\ + Debug + Release @@ -14,30 +16,17 @@ MultiByte $(SolutionDir)bin\ - $(SolutionDir)obj\$(ProjectName)\$(Configuration)_$(Platform)\ + $(SolutionDir)obj\$(ProjectName)\$(Config)_$(Platform)\ $(ProjectName) - + true - - + false true - - $(SolutionDir)bin\ - $(SolutionDir)obj\$(ProjectName)\$(Configuration)_$(Platform)\ - - $(ProjectName) - - - $(SolutionDir)bin\ - $(SolutionDir)obj\$(ProjectName)\$(Configuration)_$(Platform)\ - $(ProjectName) - - 4091;%(DisableSpecificWarnings) @@ -49,14 +38,16 @@ true - openrct2-libs-vs2015-x64.lib;imm32.lib;version.lib;winmm.lib;crypt32.lib;%(AdditionalDependencies) + imm32.lib;version.lib;winmm.lib;crypt32.lib;%(AdditionalDependencies) + openrct2-libs-vs2015-x86.lib;%(AdditionalDependencies) + openrct2-libs-vs2015-x64.lib;%(AdditionalDependencies) /OPT:NOLBR /ignore:4099 %(AdditionalOptions) PerMonitorHighDPIAware - + Disabled true @@ -68,7 +59,7 @@ UseFastLinkTimeCodeGeneration - + Full true @@ -86,10 +77,18 @@ + + + + NO_RCT2;%(PreprocessorDefinitions) + + + $(SolutionDir)lib\include;$(SolutionDir)lib\include\breakpad;$(SolutionDir)lib\include\libspeex;$(SolutionDir)lib\include\sdl;$(SolutionDir)lib\include\jansson;$(SolutionDir)lib\include\sdl_ttf;$(SolutionDir)lib\include\libpng;$(SolutionDir)lib\include\zlib;$(IncludePath) $(SolutionDir)lib;$(LibraryPath) + diff --git a/openrct2.sln b/openrct2.sln index 37c5ec1170..df162fe6a2 100644 --- a/openrct2.sln +++ b/openrct2.sln @@ -20,32 +20,51 @@ Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Win32 = Debug|Win32 Debug|x64 = Debug|x64 + DebugTests|Win32 = DebugTests|Win32 + DebugTests|x64 = DebugTests|x64 Release|Win32 = Release|Win32 Release|x64 = Release|x64 + ReleaseTests|Win32 = ReleaseTests|Win32 + ReleaseTests|x64 = ReleaseTests|x64 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {D24D94F6-2A74-480C-B512-629C306CE92F}.Debug|Win32.ActiveCfg = Debug|Win32 {D24D94F6-2A74-480C-B512-629C306CE92F}.Debug|Win32.Build.0 = Debug|Win32 {D24D94F6-2A74-480C-B512-629C306CE92F}.Debug|x64.ActiveCfg = Debug|x64 {D24D94F6-2A74-480C-B512-629C306CE92F}.Debug|x64.Build.0 = Debug|x64 + {D24D94F6-2A74-480C-B512-629C306CE92F}.DebugTests|Win32.ActiveCfg = DebugTests|Win32 + {D24D94F6-2A74-480C-B512-629C306CE92F}.DebugTests|Win32.Build.0 = DebugTests|Win32 + {D24D94F6-2A74-480C-B512-629C306CE92F}.DebugTests|x64.ActiveCfg = DebugTests|x64 + {D24D94F6-2A74-480C-B512-629C306CE92F}.DebugTests|x64.Build.0 = DebugTests|x64 {D24D94F6-2A74-480C-B512-629C306CE92F}.Release|Win32.ActiveCfg = Release|Win32 {D24D94F6-2A74-480C-B512-629C306CE92F}.Release|Win32.Build.0 = Release|Win32 {D24D94F6-2A74-480C-B512-629C306CE92F}.Release|x64.ActiveCfg = Release|x64 {D24D94F6-2A74-480C-B512-629C306CE92F}.Release|x64.Build.0 = Release|x64 + {D24D94F6-2A74-480C-B512-629C306CE92F}.ReleaseTests|Win32.ActiveCfg = ReleaseTests|Win32 + {D24D94F6-2A74-480C-B512-629C306CE92F}.ReleaseTests|Win32.Build.0 = ReleaseTests|Win32 + {D24D94F6-2A74-480C-B512-629C306CE92F}.ReleaseTests|x64.ActiveCfg = ReleaseTests|x64 + {D24D94F6-2A74-480C-B512-629C306CE92F}.ReleaseTests|x64.Build.0 = ReleaseTests|x64 {57E60BA1-FB76-4316-909E-C1449C142327}.Debug|Win32.ActiveCfg = Debug|Win32 {57E60BA1-FB76-4316-909E-C1449C142327}.Debug|Win32.Build.0 = Debug|Win32 {57E60BA1-FB76-4316-909E-C1449C142327}.Debug|x64.ActiveCfg = Debug|Win32 + {57E60BA1-FB76-4316-909E-C1449C142327}.DebugTests|Win32.ActiveCfg = Debug|Win32 + {57E60BA1-FB76-4316-909E-C1449C142327}.DebugTests|x64.ActiveCfg = Debug|Win32 {57E60BA1-FB76-4316-909E-C1449C142327}.Release|Win32.ActiveCfg = Release|Win32 - {57E60BA1-FB76-4316-909E-C1449C142327}.Release|Win32.Build.0 = Release|Win32 {57E60BA1-FB76-4316-909E-C1449C142327}.Release|x64.ActiveCfg = Release|Win32 - {62B020FA-E4FB-4C6E-B32A-DC999470F155}.Debug|Win32.ActiveCfg = Debug|Win32 - {62B020FA-E4FB-4C6E-B32A-DC999470F155}.Debug|Win32.Build.0 = Debug|Win32 - {62B020FA-E4FB-4C6E-B32A-DC999470F155}.Debug|x64.ActiveCfg = Debug|x64 - {62B020FA-E4FB-4C6E-B32A-DC999470F155}.Debug|x64.Build.0 = Debug|x64 - {62B020FA-E4FB-4C6E-B32A-DC999470F155}.Release|Win32.ActiveCfg = Release|Win32 - {62B020FA-E4FB-4C6E-B32A-DC999470F155}.Release|Win32.Build.0 = Release|Win32 - {62B020FA-E4FB-4C6E-B32A-DC999470F155}.Release|x64.ActiveCfg = Release|x64 - {62B020FA-E4FB-4C6E-B32A-DC999470F155}.Release|x64.Build.0 = Release|x64 + {57E60BA1-FB76-4316-909E-C1449C142327}.ReleaseTests|Win32.ActiveCfg = Release|Win32 + {57E60BA1-FB76-4316-909E-C1449C142327}.ReleaseTests|x64.ActiveCfg = Release|Win32 + {62B020FA-E4FB-4C6E-B32A-DC999470F155}.Debug|Win32.ActiveCfg = DebugTests|Win32 + {62B020FA-E4FB-4C6E-B32A-DC999470F155}.Debug|x64.ActiveCfg = DebugTests|x64 + {62B020FA-E4FB-4C6E-B32A-DC999470F155}.DebugTests|Win32.ActiveCfg = DebugTests|Win32 + {62B020FA-E4FB-4C6E-B32A-DC999470F155}.DebugTests|Win32.Build.0 = DebugTests|Win32 + {62B020FA-E4FB-4C6E-B32A-DC999470F155}.DebugTests|x64.ActiveCfg = DebugTests|x64 + {62B020FA-E4FB-4C6E-B32A-DC999470F155}.DebugTests|x64.Build.0 = DebugTests|x64 + {62B020FA-E4FB-4C6E-B32A-DC999470F155}.Release|Win32.ActiveCfg = ReleaseTests|Win32 + {62B020FA-E4FB-4C6E-B32A-DC999470F155}.Release|x64.ActiveCfg = ReleaseTests|x64 + {62B020FA-E4FB-4C6E-B32A-DC999470F155}.ReleaseTests|Win32.ActiveCfg = ReleaseTests|Win32 + {62B020FA-E4FB-4C6E-B32A-DC999470F155}.ReleaseTests|Win32.Build.0 = ReleaseTests|Win32 + {62B020FA-E4FB-4C6E-B32A-DC999470F155}.ReleaseTests|x64.ActiveCfg = ReleaseTests|x64 + {62B020FA-E4FB-4C6E-B32A-DC999470F155}.ReleaseTests|x64.Build.0 = ReleaseTests|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/openrct2.vcxproj b/openrct2.vcxproj index dcd7a97007..9384c8ff90 100644 --- a/openrct2.vcxproj +++ b/openrct2.vcxproj @@ -1,5 +1,8 @@  + + .\ + Debug @@ -9,6 +12,14 @@ Debug x64 + + DebugTests + Win32 + + + DebugTests + x64 + Release Win32 @@ -17,6 +28,14 @@ Release x64 + + ReleaseTests + Win32 + + + ReleaseTests + x64 + {D24D94F6-2A74-480C-B512-629C306CE92F} @@ -30,14 +49,14 @@ DynamicLibrary - + StaticLibrary - + USE_BREAKPAD;%(PreprocessorDefinitions) - __NOENTRYPOINT__;%(PreprocessorDefinitions) + __NOENTRYPOINT__;%(PreprocessorDefinitions) diff --git a/test/tests/tests.vcxproj b/test/tests/tests.vcxproj index bfc423ffc0..683615e359 100644 --- a/test/tests/tests.vcxproj +++ b/test/tests/tests.vcxproj @@ -4,20 +4,20 @@ ..\..\ - - Debug + + DebugTests Win32 - - Release + + ReleaseTests Win32 - - Debug + + DebugTests x64 - - Release + + ReleaseTests x64 @@ -29,7 +29,7 @@ Application - + $(SolutionDir)bin\tests\ $(GTestDir)\googletest;$(GTestDir)\googletest\include;$(SolutionDir)src;$(IncludePath) @@ -38,6 +38,7 @@ openrct2.lib;%(AdditionalDependencies) + Console From 872976bff4e5851e816f222c217b34a950993da2 Mon Sep 17 00:00:00 2001 From: Ted John Date: Fri, 2 Dec 2016 10:49:58 +0000 Subject: [PATCH 05/11] Force UTF-8 compile and fix manifest DPI --- openrct2.common.props | 10 +++++++--- openrct2.vcxproj | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/openrct2.common.props b/openrct2.common.props index 9f6b6b38de..72eb374c7c 100644 --- a/openrct2.common.props +++ b/openrct2.common.props @@ -36,6 +36,7 @@ true 4013 true + /utf-8 imm32.lib;version.lib;winmm.lib;crypt32.lib;%(AdditionalDependencies) @@ -43,9 +44,6 @@ openrct2-libs-vs2015-x64.lib;%(AdditionalDependencies) /OPT:NOLBR /ignore:4099 %(AdditionalOptions) - - PerMonitorHighDPIAware - @@ -91,4 +89,10 @@ $(SolutionDir)lib;$(LibraryPath) + + + + PerMonitorHighDPIAware + + diff --git a/openrct2.vcxproj b/openrct2.vcxproj index 9384c8ff90..098d5abc10 100644 --- a/openrct2.vcxproj +++ b/openrct2.vcxproj @@ -62,7 +62,7 @@ $(IntDir)\%(RelativeDir) - $(OPENRCT2_CL_ADDITIONALOPTIONS) + $(OPENRCT2_CL_ADDITIONALOPTIONS) %(AdditionalOptions) Console From d26e1df21e75becdd7a3d9c51bfd7f563c154512 Mon Sep 17 00:00:00 2001 From: Ted John Date: Fri, 2 Dec 2016 13:36:03 +0000 Subject: [PATCH 06/11] Automatically download googletest --- openrct2.proj | 11 +++++++++++ test/tests/tests.vcxproj | 5 +++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/openrct2.proj b/openrct2.proj index 8917009a18..a10de00194 100644 --- a/openrct2.proj +++ b/openrct2.proj @@ -65,6 +65,8 @@ https://github.com/OpenRCT2/Dependencies/releases/download/v$(TargetLibsVersion)/openrct2-libs-vs2015.zip $(RootDir)lib\ $(LibsPath)libversion + 1.8.0 + https://github.com/google/googletest/archive/release-$(GtestVersion).zip @@ -122,6 +124,7 @@ $(LibsPath)openrct2-libs-vs2015.zip + $(LibsPath)gtest.zip @@ -129,10 +132,18 @@ + + + + + + + + diff --git a/test/tests/tests.vcxproj b/test/tests/tests.vcxproj index 683615e359..3e42ab8e4a 100644 --- a/test/tests/tests.vcxproj +++ b/test/tests/tests.vcxproj @@ -2,6 +2,7 @@ ..\..\ + $(SolutionDir)lib\googletest\googletest @@ -32,7 +33,7 @@ $(SolutionDir)bin\tests\ - $(GTestDir)\googletest;$(GTestDir)\googletest\include;$(SolutionDir)src;$(IncludePath) + $(GtestDir);$(GtestDir)\include;$(SolutionDir)src;$(IncludePath) $(SolutionDir)bin;$(LibraryPath) @@ -48,7 +49,7 @@ - + From 05737fdd74aea2a397288675e93c80ed76e9aa03 Mon Sep 17 00:00:00 2001 From: Ted John Date: Fri, 2 Dec 2016 14:42:40 +0000 Subject: [PATCH 07/11] Add test target --- openrct2.proj | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/openrct2.proj b/openrct2.proj index a10de00194..ee68eea4b4 100644 --- a/openrct2.proj +++ b/openrct2.proj @@ -55,7 +55,6 @@ OpenRCT2-$(Version)$(VersionExtra)-windows-$(Platform.ToLower()) - Configuration=$(Configuration) $(SlnProperties);Platform=$(Platform) $(SlnProperties);OPENRCT2_CL_ADDITIONALOPTIONS=$(OPENRCT2_CL_ADDITIONALOPTIONS) @@ -149,6 +148,9 @@ + + $(SlnProperties);Configuration=$(Configuration) + @@ -180,15 +182,33 @@ + + $(SlnProperties);Configuration=$(Configuration) + + + $(SlnProperties);Configuration=$(Configuration) + + + + DebugTests + ReleaseTests + $(SlnProperties);Configuration=$(Configuration) + + + + - + + + + From 9c973e20cdf45747d53e82981deee70ce7f0dba8 Mon Sep 17 00:00:00 2001 From: Ted John Date: Fri, 2 Dec 2016 14:54:07 +0000 Subject: [PATCH 08/11] Run tests on AppVeyor --- appveyor.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 5e8110ac26..b8ebe79a07 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -19,9 +19,16 @@ install: platform: - Win32 - x64 -configuration: Release +configuration: + - Release + - ReleaseTests build: project: openrct2.proj +test_script: +- ps: >- + if ($env:configuration -eq "ReleaseTests") { + msbuild openrct2.proj /t:test /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" + } artifacts: - path: .\artifacts\openrct2-portable*.zip name: OpenRCT2-portable From 756e26ad452479f9740f1112891cbbba23476c13 Mon Sep 17 00:00:00 2001 From: Ted John Date: Fri, 2 Dec 2016 17:16:12 +0000 Subject: [PATCH 09/11] Fix main function --- test/tests/sawyercoding_test.cpp | 2 +- test/tests/tests.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/test/tests/sawyercoding_test.cpp b/test/tests/sawyercoding_test.cpp index c7105416c5..5e9120a29a 100644 --- a/test/tests/sawyercoding_test.cpp +++ b/test/tests/sawyercoding_test.cpp @@ -1,5 +1,5 @@ // Make MSVC shut up about M_PI -#include +#include extern "C" { #include "util/sawyercoding.h" diff --git a/test/tests/tests.cpp b/test/tests/tests.cpp index bba7cb7be3..4190c4fa39 100644 --- a/test/tests/tests.cpp +++ b/test/tests/tests.cpp @@ -6,8 +6,8 @@ int main(int argc, char * * argv) { - testing::InitGoogleTest(&argc, argv); - RUN_ALL_TESTS(); + testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); } #endif From 433207dc81cd5738d41673b1c3384c1c409276ed Mon Sep 17 00:00:00 2001 From: Ted John Date: Fri, 2 Dec 2016 17:16:26 +0000 Subject: [PATCH 10/11] Do not assert when testing --- openrct2.common.props | 10 ++++++++++ src/core/Guard.cpp | 5 ++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/openrct2.common.props b/openrct2.common.props index 72eb374c7c..64d144e987 100644 --- a/openrct2.common.props +++ b/openrct2.common.props @@ -74,6 +74,16 @@ true + + + __TEST__;%(PreprocessorDefinitions) + + + + + NDEBUG;__TEST__;%(PreprocessorDefinitions) + + diff --git a/src/core/Guard.cpp b/src/core/Guard.cpp index 2b6518aa39..479f976104 100644 --- a/src/core/Guard.cpp +++ b/src/core/Guard.cpp @@ -78,7 +78,9 @@ namespace Guard char *bufend = (char *)strchr(buffer, 0); vsnprintf(bufend, sizeof(buffer) - (bufend - buffer), message, args); } - int result = MessageBox(nullptr, buffer, OPENRCT2_NAME, MB_ABORTRETRYIGNORE | MB_ICONEXCLAMATION); + // Only show message box if we are not building for testing +#ifndef __TEST__ + int result = MessageBoxA(nullptr, buffer, OPENRCT2_NAME, MB_ABORTRETRYIGNORE | MB_ICONEXCLAMATION); if (result == IDABORT) { #ifdef USE_BREAKPAD @@ -88,6 +90,7 @@ namespace Guard assert(false); #endif } +#endif #else assert(false); #endif From 7557d9ca0743627415a8880a0d2a6be93c6db0c6 Mon Sep 17 00:00:00 2001 From: Ted John Date: Fri, 2 Dec 2016 21:49:44 +0000 Subject: [PATCH 11/11] Abort if assert is hit in tests --- src/core/Guard.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/core/Guard.cpp b/src/core/Guard.cpp index 479f976104..031e8841d5 100644 --- a/src/core/Guard.cpp +++ b/src/core/Guard.cpp @@ -78,8 +78,11 @@ namespace Guard char *bufend = (char *)strchr(buffer, 0); vsnprintf(bufend, sizeof(buffer) - (bufend - buffer), message, args); } - // Only show message box if we are not building for testing -#ifndef __TEST__ +#ifdef __TEST__ + // Abort if we are building for testing + abort(); +#else + // Show message box if we are not building for testing int result = MessageBoxA(nullptr, buffer, OPENRCT2_NAME, MB_ABORTRETRYIGNORE | MB_ICONEXCLAMATION); if (result == IDABORT) {