Skip to content
This repository has been archived by the owner on Dec 8, 2021. It is now read-only.

Commit

Permalink
新增[Fea 71](#71), MSBuild以及cmd方式添加多国语言支持。
Browse files Browse the repository at this point in the history
  • Loading branch information
mingkuang-Chuyu committed Jun 3, 2021
1 parent b5f7e95 commit 7aa9e05
Show file tree
Hide file tree
Showing 15 changed files with 346 additions and 81 deletions.
55 changes: 55 additions & 0 deletions config/1033/LTL_CL_Checks.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@

/*
实现一些额外的安全检查,多一层安全保障。
*/

#ifdef _DEBUG
#error Debug cannot use VC-LTL, please switch to Release and recompile!
#endif

#ifdef _DLL
_LTL_PushWarning(1004, "Starting from VC-LTL 4.0, MD mode will use the DLL provided by VC-LTL. If you need to compile statically (only dependent on msvcrt.dll), please switch to MT.")
#endif


#ifndef _VC_LTL_Include
#error Cannot find the VC header file (VC\X.XX.XXXXX\include), please make sure that the VC-LTL helper for Visual Studio.props property sheet is added to the project, and check the dependency order!
#endif

#ifndef _UCRT_LTL_Include
#error Cannot find the ucrt header file (ucrt\X.XX.XXXXX.X), please make sure that the VC-LTL helper for Visual Studio.props property sheet is added to the project, and check the dependency order!
#endif // !_UCRT_LTL_Include

#if defined(_LTL_VistaMode)

#if defined _ATL_XP_TARGETING || defined _USING_V110_SDK71_
_LTL_PushWarning(1006, "Enabling XP compatibility in Vista mode will cause the program to become larger. It's recommended to remove the _ATL_XP_TARGETING and _USING_V110_SDK71_ macros.")
#endif

_LTL_PushNote("It's now the Windows Vista mode of VC-LTL. Define _DISABLE_DEPRECATE_LTL_MESSAGE to turn off the information prompt.")

#elif defined(_LTL_XPMode)

#ifdef _DLL
//VC-LTL默认没有编译XP的动态库,如果需要请自行编译。
_LTL_PushWarning(1006, "The /MD option cannot be used normally in Windows XP mode. It's recommended to use the /MT option.")
#endif

_LTL_PushNote("It's now the Windows XP compatibility mode of VC-LTL. Define _DISABLE_DEPRECATE_LTL_MESSAGE to turn off the information prompt.")
#else
#error 未知模式!
#endif

#ifdef __NO_LTL_LIB
_LTL_PushWarning(1003, "Starting from VC-LTL 2.0, the __NO_LTL_LIB macro will be ignored.")
#endif

#ifdef _NO__LTL_Initialization
_LTL_PushWarning(1003, "Starting from VC-LTL 4.0, the _NO__LTL_Initialization macro will be ignored.")
#endif //!_NO__LTL_Initialization

#if defined __cplusplus_winrt && _CRT_NTDDI_MIN <= /*NTDDI_WIN8*/0x06020000
_LTL_PushWarning(1005, "When using the /ZW option, the program will not support Windows 8.")
#endif
53 changes: 53 additions & 0 deletions config/1033/VC-LTL-Options.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
* 项目:VC-LTL
* 文件:VC-LTL.targets
* 用途:适用于 Visual Studio 的 VC-LTL 工具集的属性页配置文件
*
* 许可:MIT
*
* 作者:mingkuang (mingkuang AT live.com)
* 作者:Mouri_Naruto (Mouri_Naruto AT Outlook.com)
-->
<ProjectSchemaDefinitions
xmlns="http://schemas.microsoft.com/build/2009/properties"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" >
<Rule Name="CuyuTeam_3C886396-2D31-4C73-9281-E39A064253D9"
PageTemplate="tool"
DisplayName="NuGet Packages Settings">
<Rule.Categories>
<Category Name="VC_LTL" DisplayName="VC-LTL" Description="The third-party CRT runtime library optimizes the size of C/C++ programs and reduces the use of FLS."/>
</Rule.Categories>

<Rule.DataSource>
<DataSource Persistence="ProjectFile"
ItemType=""
Label="Configuration"
HasConfigurationCondition="true"/>
</Rule.DataSource>

<BoolProperty
Name="DisableAdvancedSupport"
Category="VC_LTL"
DisplayName="Enable VC-LTL Light Mode"
Description="Turn on VC-LTL Light Mode, which is more conducive to reducing the size of the program. If you need to be highly compatible with Microsoft UCRT, please do not turn on this option!!!" />

<BoolProperty
Name="SupportWinXP"
Category="VC_LTL"
DisplayName="Enable Windows XP compatible"
Description="Forced to open Windows XP compatibility mode, by default only when the Windows XP toolset is selected." />

<BoolProperty
Name="msvcp60_static_library"
Category="VC_LTL"
DisplayName="Enable msvcp60 Static Library"
Description="Don't use msvcp60.dll to avoid losing msvcp60.dll and causing the program to fail to start." />

<BoolProperty
Name="SupportLTL"
Category="VC_LTL"
DisplayName="Enable VC-LTL"
Description="Allow the current project to enable VC-LTL."/>
</Rule>
</ProjectSchemaDefinitions>
28 changes: 28 additions & 0 deletions config/1033/config.string.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!--保存错误代码列表-->
<PropertyGroup>
<!--LTL2000-->
<ERROR_VC_LTL_NOT_SUPPORT_DEBUG>VC-LTL is disabled because VC-LTL isn't compatible with Debug configuration, please switch to Release configuration and continue.</ERROR_VC_LTL_NOT_SUPPORT_DEBUG>
<!--LTL2001-->
<ERROR_VC_LTL_NOT_SUPPORT_MFC>VC-LTL is disabled because VC-LTL isn't compatible with MFC projects.</ERROR_VC_LTL_NOT_SUPPORT_MFC>
<!--LTL2002-->
<ERROR_VC_LTL_NOT_SUPPORT_PLATFORM>VC-LTL is disabled because VC-LTL isn't compatible with $(PlatformShortName) platforms.</ERROR_VC_LTL_NOT_SUPPORT_PLATFORM>
<!--LTL2003-->
<ERROR_VC_LTL_NOT_SUPPORT_PLATFORM_TOOLSET>VC-LTL is disabled because VC-LTL isn't compatible with the $(PlatformToolset) toolset. Please switch to Visual Studio 2015/2017/2019 and continue.</ERROR_VC_LTL_NOT_SUPPORT_PLATFORM_TOOLSET>
<!--LTL2004-->
<ERROR_VC_LTL_NOT_SUPPORT_UNIVERSAL_DRIVER>VC-LTL is disabled because VC-LTL isn't compatible with Windows 10 Universal Driver.</ERROR_VC_LTL_NOT_SUPPORT_UNIVERSAL_DRIVER>

<!--LTL3000-->
<ERROR_VC_LTL_NOT_SUPPORT_VC_TOOLS_VERSION>VC-LTL doesn't support VC $(VCToolsVersion) and has been switched to VC $(VCLTLToolsVersion). This may be that your IDE version is too low, it's recommended to upgrade to the latest IDE and continue.</ERROR_VC_LTL_NOT_SUPPORT_VC_TOOLS_VERSION>
<!--LTL3001-->
<ERROR_VC_LTL_NOT_SUPPORT_UCRT_VERSION>VC-LTL doesn't support UCRT $(TargetUniversalCRTVersion) and has been switched to UCRT $(VCLTLTargetUniversalCRTVersion). This may be that your SDK version is too low, it's recommended to switch to the latest SDK and continue.</ERROR_VC_LTL_NOT_SUPPORT_UCRT_VERSION>
<!--LTL3002-->
<ERROR_VC_LTL_NOT_SUPPORT_WINXP_IN_UCRT_MODE>VC-LTL doesn't support the simultaneous use of UCRT mode and Windows XP mode, and Windows XP mode has been ignored.</ERROR_VC_LTL_NOT_SUPPORT_WINXP_IN_UCRT_MODE>
<!--LTL3003-->
<ERROR_VC_LTL_NOT_SUPPORT_MITIGATION>VC-LTL doesn't support the $(SpectreMitigation). It's recommended to upgrade to the latest VC-LTL and continue.</ERROR_VC_LTL_NOT_SUPPORT_MITIGATION>

<!--LTL4000-->
<ERROR_VC_LTL_FILE_MISSING>VC-LTL cannot find the lib files, please reinstall the NuGet package, or download it again from https://github.com/Chuyu-Team/VC-LTL/releases/latest and continue.</ERROR_VC_LTL_FILE_MISSING>
</PropertyGroup>
</Project>
20 changes: 20 additions & 0 deletions config/1033/config.strings.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
::
::
::
:: VC-LTL config.cmd µÄ´íÎóÐÅÏ¢
::
::
::


set ERROR_VC_LTL_DONOT_USE_THIS_FILE=Please don't call this script file directly, you should use 'VC-LTL helper for nmake'.

set ERROR_VC_LTL_CANNOT_FOUND_INCLUDE_ENV=The environment variable INCLUDE cannot be found, please make sure vcvars32.bat/vcvars64.bat is executed.

set ERROR_VC_LTL_CANNOT_FOUND_LIB_ENV=The environment variable LIB cannot be found, please make sure vcvars32.bat/vcvars64.bat is executed.

set ERROR_VC_LTL_NOT_SUPPORT_PLATFORM_TOOLSET=VC-LTL only supports Visual Studio 2015, 2017 and 2019.

set ERROR_VC_LTL_NOT_SUPPORT_PLATFORM=VC-LTL does not support %Platform% platform.

set ERROR_VC_LTL_FILE_MISSING=VC-LTL can't find lib files, please download the binary files from https://github.com/Chuyu-Team/VC-LTL/releases/latest then continue.
55 changes: 55 additions & 0 deletions config/2052/LTL_CL_Checks.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@

/*
实现一些额外的安全检查,多一层安全保障。
*/

#ifdef _DEBUG
#error "调试版无法使用VC LTL,请切换到Release然后重新编译!"
#endif

#ifdef _DLL
_LTL_PushWarning(1004, "从VC-LTL 4.0 开始MD模式将链接到VC-LTL自身的DLL中,如需静态编译(仅依赖msvcrt.dll),请切换到MT。")
#endif


#ifndef _VC_LTL_Include
#error "VC头文件(VC\X.XX.XXXXX\include)没有被加载,请确保 VC-LTL helper for Visual Studio.props 属性表正常加入项目,并检查依赖顺序是否有误!"
#endif

#ifndef _UCRT_LTL_Include
#error "ucrt头文件(ucrt\X.XX.XXXXX.X)没有被加载,请确保 VC-LTL helper for Visual Studio.props 属性表正常加入项目,并检查依赖顺序是否有误!"
#endif // !_UCRT_LTL_Include

#if defined(_LTL_VistaMode)

#if defined _ATL_XP_TARGETING || defined _USING_V110_SDK71_
_LTL_PushWarning(1006, "在Vista模式中启用XP兼容将导致程序体积变大,推荐移除 _ATL_XP_TARGETING 以及 _USING_V110_SDK71_宏。")
#endif

_LTL_PushNote("进入ltl Vista模式,已准备引用到VC-LTL。定义 _DISABLE_DEPRECATE_LTL_MESSAGE 可关闭信息提示。")

#elif defined(_LTL_XPMode)

#ifdef _DLL
//VC-LTL默认没有编译XP的动态库,如果需要请自行编译。
_LTL_PushWarning(1006, "Windows XP模式使用无法正常使用 /MD 编译,建议使用 /MT 编译。")
#endif

_LTL_PushNote("进入ltl WinXP兼容模式,已准备引用到VC-LTL。定义 _DISABLE_DEPRECATE_LTL_MESSAGE 可关闭信息提示。")
#else
#error 未知模式!
#endif

#ifdef __NO_LTL_LIB
_LTL_PushWarning(1003, "VC-LTL 2.0 开始ltl超越模式已经弃用,此选项将被忽略。")
#endif

#ifdef _NO__LTL_Initialization
_LTL_PushWarning(1003, "VC-LTL 4.0 开始不在允许禁用VC-LTL初始化,此选项将被忽略。")
#endif //!_NO__LTL_Initialization

#if defined __cplusplus_winrt && _CRT_NTDDI_MIN <= /*NTDDI_WIN8*/0x06020000
_LTL_PushWarning(1005, "VC-LTL为了简化支持,当使用 /ZW 参数时编译的程序将无法支持 Windows 8。")
#endif
File renamed without changes.
28 changes: 28 additions & 0 deletions config/2052/config.string.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!--保存错误代码列表-->
<PropertyGroup>
<!--LTL2000-->
<ERROR_VC_LTL_NOT_SUPPORT_DEBUG>VC-LTL不兼容 Debug 配置,VC-LTL已经自动禁用,请切换到 Release 配置然后继续。</ERROR_VC_LTL_NOT_SUPPORT_DEBUG>
<!--LTL2001-->
<ERROR_VC_LTL_NOT_SUPPORT_MFC>VC-LTL不兼容 MFC 项目,VC-LTL已经自动禁用。</ERROR_VC_LTL_NOT_SUPPORT_MFC>
<!--LTL2002-->
<ERROR_VC_LTL_NOT_SUPPORT_PLATFORM>VC-LTL不兼容 $(PlatformShortName) 平台,已经自动禁用VC-LTL。</ERROR_VC_LTL_NOT_SUPPORT_PLATFORM>
<!--LTL2003-->
<ERROR_VC_LTL_NOT_SUPPORT_PLATFORM_TOOLSET>VC-LTL不兼容 $(PlatformToolset) 工具集,请切换到 Visual Studio 2015/2017/2019 然后继续。</ERROR_VC_LTL_NOT_SUPPORT_PLATFORM_TOOLSET>
<!--LTL2004-->
<ERROR_VC_LTL_NOT_SUPPORT_UNIVERSAL_DRIVER>VC-LTL不兼容 Windows 10 Universal Driver,VC-LTL已经自动禁用。</ERROR_VC_LTL_NOT_SUPPORT_UNIVERSAL_DRIVER>

<!--LTL3000-->
<ERROR_VC_LTL_NOT_SUPPORT_VC_TOOLS_VERSION>VC-LTL不支持 VC $(VCToolsVersion),已临时切换到 VC $(VCLTLToolsVersion) 来维持基础功能。这可能是你的IDE版本过低,建议升级到最新IDE然后继续!</ERROR_VC_LTL_NOT_SUPPORT_VC_TOOLS_VERSION>
<!--LTL3001-->
<ERROR_VC_LTL_NOT_SUPPORT_UCRT_VERSION>VC-LTL不支持 UCRT $(TargetUniversalCRTVersion),目前已临时切换到 UCRT $(VCLTLTargetUniversalCRTVersion) 来维持基础功能。这可能是你的SDK版本过低,建议切换到最新SDK然后继续!</ERROR_VC_LTL_NOT_SUPPORT_UCRT_VERSION>
<!--LTL3002-->
<ERROR_VC_LTL_NOT_SUPPORT_WINXP_IN_UCRT_MODE>VC-LTL不支持 UCRT模式与Windows XP兼容模式同时使用,已临时禁用Windows XP兼容模式。</ERROR_VC_LTL_NOT_SUPPORT_WINXP_IN_UCRT_MODE>
<!--LTL3003-->
<ERROR_VC_LTL_NOT_SUPPORT_MITIGATION>VC-LTL不完全支持 $(SpectreMitigation) 缓解方案,建议升级到最新VC-LTL然后继续。</ERROR_VC_LTL_NOT_SUPPORT_MITIGATION>

<!--LTL4000-->
<ERROR_VC_LTL_FILE_MISSING>VC-LTL不找不到lib文件,请重新安装 NuGet 包,或者从 https://github.com/Chuyu-Team/VC-LTL/releases/latest 下载完整二进制文件然后继续。</ERROR_VC_LTL_FILE_MISSING>
</PropertyGroup>
</Project>
20 changes: 20 additions & 0 deletions config/2052/config.strings.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
::
::
::
:: VC-LTL config.cmd 的错误信息
::
::
::


set ERROR_VC_LTL_DONOT_USE_THIS_FILE=请不要直接使用此脚本,应该使用VC-LTL helper for nmake。

set ERROR_VC_LTL_CANNOT_FOUND_INCLUDE_ENV=找不到环境变量INCLUDE,请在vcvars32.bat/vcvars64.bat执行后调用此脚本。

set ERROR_VC_LTL_CANNOT_FOUND_LIB_ENV=找不到环境变量LIB,请在vcvars32.bat/vcvars64.bat执行后调用此脚本。

set ERROR_VC_LTL_NOT_SUPPORT_PLATFORM_TOOLSET=VC-LTL仅支持VS 2015、2017以及2019。

set ERROR_VC_LTL_NOT_SUPPORT_PLATFORM=VC-LTL CMD脚本不支持体系 : %Platform%

set ERROR_VC_LTL_FILE_MISSING=VC-LTL不找不到lib文件,请从 https://github.com/Chuyu-Team/VC-LTL/releases/latest 下载完整二进制文件然后继续。
4 changes: 4 additions & 0 deletions config/Vista/LTL_CL_Checks.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

//为了避免某些老脚本无法加载 LTL_CL_Checks.h,我们在这里做一个转发,默认引用为英文(1033)

#include "../1033/LTL_CL_Checks.h"
4 changes: 4 additions & 0 deletions config/Vista/LTL_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,8 @@
#error "模式选择错误!Vista模式不支持此体系。"
#endif

#if defined(__cplusplus) && !defined(_Allow_LTL_Mode)
#pragma detect_mismatch("_LTL_Mode", "VistaMode")
#endif

#include "..\_msvcrt.h"
4 changes: 4 additions & 0 deletions config/WinXP/LTL_CL_Checks.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

//为了避免某些老脚本无法加载 LTL_CL_Checks.h,我们在这里做一个转发,默认引用为英文(1033)

#include "../1033/LTL_CL_Checks.h"
4 changes: 4 additions & 0 deletions config/WinXP/LTL_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,8 @@
#error "模式选择错误!XP模式仅支持x86 以及 AMD64。"
#endif

#if defined(__cplusplus) && !defined(_Allow_LTL_Mode)
#pragma detect_mismatch("_LTL_Mode", "XPMode")
#endif

#include "..\_msvcrt.h"
58 changes: 2 additions & 56 deletions config/_msvcrt.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,6 @@
#define _LTL_PushWarning(Code,Msg) _LTL_PushMassage("warning LTL" _CRT_STRINGIZE(Code) ": " Msg )


#ifdef _DEBUG
#error "调试版无法使用VC LTL,请切换到Release然后重新编译!"
#endif

#ifdef _DLL
_LTL_PushWarning(1004,"从VC-LTL 4.0 开始MD模式将链接到VC-LTL自身的DLL中,如需静态编译(仅依赖msvcrt.dll),请切换到MT。")
#endif

#ifdef _ATL_XP_TARGETING
//Windows XP的msvcrt有BUG,内部32位带符号整形。因此外部最大只允许0x3FFFFFFF
#define _CRT_STDIO_SIZE_MAX 0x3FFFFFFF
Expand All @@ -38,41 +30,8 @@ _LTL_PushWarning(1004,"从VC-LTL 4.0 开始MD模式将链接到VC-LTL自身的DL
#include <corecrt_share.h>
#undef __LTL_Check_UCRT

#ifndef _VC_LTL_Include
#error "VC头文件(VC\X.XX.XXXXX\include)没有被加载,请确保 VC-LTL helper for Visual Studio.props 属性表正常加入项目,并检查依赖顺序是否有误!"
#endif

#ifndef _UCRT_LTL_Include
#error "ucrt头文件(ucrt\X.XX.XXXXX.X)没有被加载,请确保 VC-LTL helper for Visual Studio.props 属性表正常加入项目,并检查依赖顺序是否有误!"
#endif // !_UCRT_LTL_Include

#if defined(_LTL_VistaMode)

#if defined _ATL_XP_TARGETING || defined _USING_V110_SDK71_
_LTL_PushWarning(1006, "在Vista模式中启用XP兼容将导致程序体积变大,推荐移除 _ATL_XP_TARGETING 以及 _USING_V110_SDK71_宏。")
#endif

#if defined(__cplusplus) && !defined(_Allow_LTL_Mode)
#pragma detect_mismatch("_LTL_Mode", "VistaMode")
#endif

_LTL_PushNote("进入ltl Vista模式,已准备引用到VC-LTL。定义 _DISABLE_DEPRECATE_LTL_MESSAGE 可关闭信息提示。")

#elif defined(_LTL_XPMode)

#ifdef _DLL
//VC-LTL默认没有编译XP的动态库,如果需要请自行编译。
_LTL_PushWarning(1006, "Windows XP模式使用无法正常使用 /MD 编译,建议使用 /MT 编译。")
#endif

#if defined(__cplusplus) && !defined(_Allow_LTL_Mode)
#pragma detect_mismatch("_LTL_Mode", "XPMode")
#endif

_LTL_PushNote("进入ltl WinXP兼容模式,已准备引用到VC-LTL。定义 _DISABLE_DEPRECATE_LTL_MESSAGE 可关闭信息提示。")
#else
#error 未知模式!
#endif
//进一步的安全检查
#include <LTL_CL_Checks.h>


//为了兼容 iso_stdio_wide_specifiers,我们还是关闭内联操作吧。
Expand All @@ -86,19 +45,6 @@ _LTL_PushWarning(1004,"从VC-LTL 4.0 开始MD模式将链接到VC-LTL自身的DL
#define _Build_By_LTL 1
#endif


#ifdef __NO_LTL_LIB
_LTL_PushWarning(1003, "VC-LTL 2.0 开始ltl超越模式已经弃用,此选项将被忽略。")
#endif

#ifdef _NO__LTL_Initialization
_LTL_PushWarning(1003, "VC-LTL 4.0 开始不在允许禁用VC-LTL初始化,此选项将被忽略。")
#endif //!_NO__LTL_Initialization

#if defined __cplusplus_winrt && _CRT_NTDDI_MIN <= /*NTDDI_WIN8*/0x06020000
_LTL_PushWarning(1005, "VC-LTL为了简化支持,当使用 /ZW 参数时编译的程序将无法支持 Windows 8。")
#endif

#ifdef __cplusplus
extern "C" {
#endif
Expand Down
Loading

0 comments on commit 7aa9e05

Please sign in to comment.