-
Notifications
You must be signed in to change notification settings - Fork 165
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
137 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
setlocal | ||
set BUILD_BASE_DIR=%~dp1 | ||
set SOURCE_DIR=%~dp0compiletests | ||
|
||
:: find generic tools | ||
if not defined CMD_VSWHERE call %~dp0..\tools\find-tools.bat | ||
|
||
set /a NUM_VSVERSION_NEXT=NUM_VSVERSION + 1 | ||
|
||
if not exist "%CMD_CMAKE%" ( | ||
echo "no cmake found." | ||
exit /b 1 | ||
) | ||
|
||
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 | ||
pushd %BUILD_DIR% | ||
|
||
call :run_cmake_configure || endlocal && exit /b 1 | ||
|
||
endlocal && exit /b 0 | ||
|
||
:run_cmake_configure | ||
call :find_cl_compiler | ||
|
||
:: replace back-slash to slash in the path. | ||
set CL_COMPILER=%CMD_CL:\=/% | ||
|
||
:: run cmake configuration. | ||
"%CMD_CMAKE%" -G %GENERATOR% ^ | ||
"-DCMAKE_MAKE_PROGRAM=%MAKE_PROGRAM%" ^ | ||
"-DCMAKE_C_COMPILER=%CL_COMPILER%" ^ | ||
"-DCMAKE_CXX_COMPILER=%CL_COMPILER%" ^ | ||
%GENERATOR_OPTS% ^ | ||
%SOURCE_DIR% ^ | ||
|| endlocal && exit /b 1 | ||
goto :EOF | ||
|
||
:find_cl_compiler | ||
for /f "usebackq delims=" %%a in (`where cl.exe`) do ( | ||
set "CMD_CL=%%a" | ||
goto :EOF | ||
) | ||
goto :EOF |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<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> | ||
<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 "$(GoogleTestBuildDir)"" ConsoleToMSBuild="true" /> | ||
</Target> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
cmake_minimum_required(VERSION 3.12) | ||
|
||
enable_language(CXX) | ||
|
||
message( STATUS "Checking clayoutint_can_not_be_assigned_from_clogicint" ) | ||
|
||
try_compile(FAILED_TO_TEST001 ${CMAKE_CURRENT_BINARY_DIR} | ||
${CMAKE_CURRENT_SOURCE_DIR}/clayoutint_can_not_be_assigned_from_clogicint.cpp | ||
CMAKE_FLAGS "-DINCLUDE_DIRECTORIES=${CMAKE_CURRENT_SOURCE_DIR}/../../sakura_core" | ||
COMPILE_DEFINITIONS -D_DEBUG -D_UNICODE -DUNICODE -D_WIN32_WINNT=_WIN32_WINNT_WIN7 | ||
CXX_STANDARD 17 | ||
CXX_STANDARD_REQUIRED ON | ||
CXX_EXTENSIONS OFF | ||
) | ||
|
||
if (NOT FAILED_TO_TEST001) | ||
message( STATUS "Checking clayoutint_can_not_be_assigned_from_clogicint - done" ) | ||
else() | ||
message( FATAL_ERROR "Checking clayoutint_can_not_be_assigned_from_clogicint - Failed." ) | ||
endif (NOT FAILED_TO_TEST001) |
49 changes: 49 additions & 0 deletions
49
tests/compiletests/clayoutint_can_not_be_assigned_from_clogicint.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/*! @file */ | ||
/* | ||
Copyright (C) 2018-2020 Sakura Editor Organization | ||
This software is provided 'as-is', without any express or implied | ||
warranty. In no event will the authors be held liable for any damages | ||
arising from the use of this software. | ||
Permission is granted to anyone to use this software for any purpose, | ||
including commercial applications, and to alter it and redistribute it | ||
freely, subject to the following restrictions: | ||
1. The origin of this software must not be misrepresented; | ||
you must not claim that you wrote the original software. | ||
If you use this software in a product, an acknowledgment | ||
in the product documentation would be appreciated but is | ||
not required. | ||
2. Altered source versions must be plainly marked as such, | ||
and must not be misrepresented as being the original software. | ||
3. This notice may not be removed or altered from any source | ||
distribution. | ||
*/ | ||
#ifndef NOMINMAX | ||
#define NOMINMAX | ||
#endif /* #ifndef NOMINMAX */ | ||
|
||
#include <tchar.h> | ||
#include <Windows.h> | ||
|
||
#ifndef USE_STRICT_INT | ||
#define USE_STRICT_INT | ||
#endif /* #ifndef USE_STRICT_INT */ | ||
|
||
#include "basis/SakuraBasis.h" | ||
|
||
/*! | ||
* @brief テンプレートのテスト | ||
* このファイルはビルドエラーになる | ||
*/ | ||
void main() | ||
{ | ||
CLayoutInt a( 1 ); | ||
CLogicInt b( 2 ); | ||
|
||
//CLayoutInt に CLogicIntを代入することはできない | ||
a = b; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters