diff --git a/.gitignore b/.gitignore index d3147e8290..3a6bd8ad98 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,8 @@ *.iobj *.ipdb *.pyc +**/packages +**/TestResults .sonarqube /*.patch /.vs diff --git a/sakura.sln b/sakura.sln index 30d1388313..a680426fec 100644 --- a/sakura.sln +++ b/sakura.sln @@ -13,6 +13,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sakura_lang_en_US", "sakura {AF03508C-515E-4A0E-87BE-67ED1E254BD0} = {AF03508C-515E-4A0E-87BE-67ED1E254BD0} EndProjectSection EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tests1", "tests\unittests\tests1.vcxproj", "{701E3407-EC27-49F7-ADC7-520CF2B4B438}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Win32 = Debug|Win32 @@ -53,6 +55,14 @@ Global {7A6D0F29-E560-4985-835B-5F92A08EB242}.Release|Win32.Build.0 = Release|Win32 {7A6D0F29-E560-4985-835B-5F92A08EB242}.Release|x64.ActiveCfg = Release|x64 {7A6D0F29-E560-4985-835B-5F92A08EB242}.Release|x64.Build.0 = Release|x64 + {701E3407-EC27-49F7-ADC7-520CF2B4B438}.Debug|Win32.ActiveCfg = Debug|Win32 + {701E3407-EC27-49F7-ADC7-520CF2B4B438}.Debug|Win32.Build.0 = Debug|Win32 + {701E3407-EC27-49F7-ADC7-520CF2B4B438}.Debug|x64.ActiveCfg = Debug|x64 + {701E3407-EC27-49F7-ADC7-520CF2B4B438}.Debug|x64.Build.0 = Debug|x64 + {701E3407-EC27-49F7-ADC7-520CF2B4B438}.Release|Win32.ActiveCfg = Release|Win32 + {701E3407-EC27-49F7-ADC7-520CF2B4B438}.Release|Win32.Build.0 = Release|Win32 + {701E3407-EC27-49F7-ADC7-520CF2B4B438}.Release|x64.ActiveCfg = Release|x64 + {701E3407-EC27-49F7-ADC7-520CF2B4B438}.Release|x64.Build.0 = Release|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/tests/googletest.build.cmd b/tests/googletest.build.cmd new file mode 100644 index 0000000000..433cb5284e --- /dev/null +++ b/tests/googletest.build.cmd @@ -0,0 +1,57 @@ +@rem echo off +setlocal +set SOURCE_DIR=%1 +set CONFIGURATION=%2 +set VCVARSALL_PATH=%3 +set VCVARS_ARCH=%4 + +if not defined CMD_GIT call %~dp0..\tools\find-tools.bat +if not defined CMD_GIT ( + echo git.exe was not found. + endlocal && exit /b 1 +) + +if not exist "%~dp0googletest\CMakeLists.txt" ( + "%CMD_GIT%" submodule init %~dp0googletest || endlocal && exit /b 1 + "%CMD_GIT%" submodule update %~dp0googletest || endlocal && exit /b 1 +) + +set GENERATOR= + +@rem call vcvasall.bat when we run in the Visual Studio IDE. +if defined VCVARSALL_PATH ( + call %VCVARSALL_PATH% %VCVARS_ARCH% || endlocal && exit /b 1 +) + +where ninja.exe > NUL 2>&1 +if not errorlevel 1 ( + set GENERATOR=-G "Ninja" +) + +@rem find cl.exe in the PATH +call :find_cl_exe + +if not defined CMD_CL ( + echo cl.exe was not found. + endlocal && exit /b 1 +) +set CMD_CL=%CMD_CL:\=/% + +cmake %GENERATOR% -DCMAKE_BUILD_TYPE=%CONFIGURATION% ^ + "-DCMAKE_C_COMPILER=%CMD_CL%" ^ + "-DCMAKE_CXX_COMPILER=%CMD_CL%" ^ + -DBUILD_GMOCK=OFF ^ + -Dgtest_build_tests=OFF ^ + -Dgtest_build_samples=OFF ^ + %SOURCE_DIR% ^ + || endlocal && exit /b 1 + +cmake --build . || endlocal && exit /b 1 + +endlocal && exit /b 0 + +:find_cl_exe +for /f "usebackq delims=" %%a in (`where cl.exe`) do ( + set CMD_CL=%%a + goto :EOF +) diff --git a/tests/googletest.targets b/tests/googletest.targets new file mode 100644 index 0000000000..ac0630034d --- /dev/null +++ b/tests/googletest.targets @@ -0,0 +1,53 @@ + + + $(MSBuildThisFileDirectory)googletest\ + $(MSBuildThisFileDirectory)build\$(Platform)\$(Configuration)\googletest\ + $(GoogleTestSourceDir)googletest\include;$(IncludePath) + $(GoogleTestBuildDir)\lib;$(LibraryPath) + + + + _SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING;%(PreprocessorDefinitions) + + + + + gtestd.lib;%(AdditionalDependencies) + gtest_maind.lib;%(AdditionalDependencies) + + + + + gtest.lib;%(AdditionalDependencies) + gtest_main.lib;%(AdditionalDependencies) + + + + + + + + + + + + + x86 + x86_amd64 + amd64_x86 + amd64 + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/tests/unittests/tests1.vcxproj b/tests/unittests/tests1.vcxproj new file mode 100644 index 0000000000..41a3d9a79d --- /dev/null +++ b/tests/unittests/tests1.vcxproj @@ -0,0 +1,124 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + {701e3407-ec27-49f7-adc7-520cf2b4b438} + Win32Proj + 10.0.17763.0 + Application + v141 + Unicode + + + + + + + + + + + (ProjectDir)..\..\..\build\$(Platform)\$(Configuration)\unittests\ + $(Platform)\$(Configuration)\ + + + + + $(SolutionDir)sakura_core;%(AdditionalIncludeDirectories) + _CONSOLE;%(PreprocessorDefinitions) + NotUsing + true + stdcpp17 + /source-charset:utf-8 /execution-charset:shift_jis %(AdditionalOptions) + + + Console + comctl32.lib;Imm32.lib;mpr.lib;imagehlp.lib;Shlwapi.lib;%(AdditionalDependencies) + true + + + + + _DEBUG;%(PreprocessorDefinitions) + MultiThreadedDebug + EnableFastChecks + Disabled + + + false + + + + + NDEBUG;%(PreprocessorDefinitions) + MultiThreaded + ProgramDatabase + + + UseFastLinkTimeCodeGeneration + true + true + + + + + WIN32;%(PreprocessorDefinitions) + + + true + + + + + X64;%(PreprocessorDefinitions) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {af03508c-515e-4a0e-87be-67ed1e254bd0} + + + + \ No newline at end of file diff --git a/tests/unittests/tests1.vcxproj.filters b/tests/unittests/tests1.vcxproj.filters new file mode 100644 index 0000000000..4c889c8032 --- /dev/null +++ b/tests/unittests/tests1.vcxproj.filters @@ -0,0 +1,48 @@ + + + + + {690c7184-b796-460a-8fed-595dfa1930f4} + + + {594146a8-ae7c-401b-a064-af37dac4216e} + + + {0eefa0df-ca7f-489c-9844-9a182e1dba18} + + + + + Other Files + + + + + Test Files + + + Test Files + + + Test Files + + + Test Files + + + Test Files + + + Test Files + + + Test Files + + + Test Files + + + Test Files + + + \ No newline at end of file