Skip to content

Commit 674e65b

Browse files
Fea #64, 基于msvcr14为MD/MDd提供一致性的体验
1 parent 3ab7387 commit 674e65b

19 files changed

+105
-162
lines changed

.github/workflows/Build&Test.yml

+10-22
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@ jobs:
3737
# Procdump工具,用于单元测试崩溃诊断
3838
Invoke-WebRequest -Uri https://download.sysinternals.com/files/Procdump.zip -OutFile Tools\Procdump.zip
3939
&7z e Tools\Procdump.zip "-o$Env:GITHUB_WORKSPACE\Tools"
40-
40+
41+
Invoke-WebRequest -Uri https://github.com/Chuyu-Team/msvcr14x/releases/latest/download/VC-LTL.Redist.Dlls.zip -OutFile VC-LTL.Redist.Dlls.zip
42+
Invoke-WebRequest -Uri https://github.com/Chuyu-Team/msvcr14x/releases/latest/download/VC-LTL.Redist.PDBs.zip -OutFile VC-LTL.Redist.PDBs.zip
4143
4244
$ProgramFiles = ${env:ProgramFiles(x86)}
4345
@@ -86,6 +88,9 @@ jobs:
8688
$BuildVersion = $env:GITHUB_REF.Remove(0, 11);
8789
echo "BuildVersion=$BuildVersion" >> $env:GITHUB_ENV
8890
91+
$Prerelease = $BuildVersion.contains("-");
92+
echo "Prerelease=$Prerelease" >> $env:GITHUB_ENV
93+
8994
# github的内置版本有Bug,此行必须添加,否则无法获得内容
9095
git fetch --depth=1 origin +refs/tags/*:refs/tags/*
9196
@@ -172,11 +177,6 @@ jobs:
172177
::生成二进制包
173178
msbuild Build.proj -p:TagVersion=${{env.BuildVersion}} -t:Pack
174179
if %ERRORLEVEL% NEQ 0 exit /B %ERRORLEVEL%
175-
176-
:: 打包Redist
177-
if "${{env.BuildVersion}}" NEQ "" (
178-
msbuild Build.proj -p:TagVersion=${{env.BuildVersion}} -t:PackRedist
179-
)
180180
181181
if %ERRORLEVEL% NEQ 0 exit /B %ERRORLEVEL%
182182
@@ -188,26 +188,12 @@ jobs:
188188
189189
if %ERRORLEVEL% NEQ 0 exit /B %ERRORLEVEL%
190190
191-
- name: 匹配Redist缓存
192-
if: contains(github.ref, 'tags/')
193-
id: ltlRedistCache
194-
uses: actions/cache@v4
195-
with:
196-
path: VC-LTL*-Redist.7z
197-
key: ltl_Redist_${{ hashFiles('Redist/**/*.dll') }}
198-
199-
- name: 文件清理
200-
if: steps.ltlRedistCache.outputs.cache-hit == 'true'
201-
working-directory: ${{github.workspace}}
202-
shell: cmd
203-
run: |
204-
del VC-LTL-${{env.BuildVersion}}-Redist.7z /Q /F
205-
206191
- uses: actions/upload-artifact@v4
207192
with:
208193
path: |
209194
*.nupkg
210195
*.7z
196+
VC-LTL.Redist.*.zip
211197
212198
# 失败时我们收集一些信息,用于诊断
213199
- uses: actions/upload-artifact@v4
@@ -222,16 +208,18 @@ jobs:
222208
Static\*.log
223209
UnitTest/SymbolBuildTest/.test/**/Build.log
224210
*.7z
211+
VC-LTL.Redist.*.zip
225212
226213
- uses: xresloader/upload-to-github-release@v1
227214
if: contains(github.ref, 'tags/')
228215
env:
229216
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
230217
with:
231-
file: "VC-LTL-*.7z"
218+
file: "VC-LTL-*.7z;VC-LTL.Redist.*.zip"
232219
overwrite: true
233220
tags: true
234221
draft: false
222+
prerelease: ${{env.Prerelease}}
235223

236224
- uses: actions-rs/toolchain@v1
237225
with:

Build.proj

+5-101
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040

4141
<Import Project="$(VCInstallDir)\Auxiliary\Build\Microsoft.VCToolsVersion.default.props" />
4242

43-
<Target Name="DownloadTools" BeforeTargets="Build;PackRedist">
43+
<Target Name="DownloadTools" BeforeTargets="Build">
4444
<!--下载LibMaker-->
4545
<DownloadFile
4646
Condition="!Exists('$(MSBuildThisFileDirectory)Tools\LibMaker.exe')"
@@ -70,15 +70,15 @@
7070
<MSBuild Projects="@(WindowsTargetPlatformMinVersionItem)" StopOnFirstFailure="True" Targets="Build_libucrt_shared" BuildInParallel="True" Properties="$(GlobalProperties)"/>
7171

7272
<!--启动实际编译-->
73-
<MSBuild Projects="@(ProjectReference)" StopOnFirstFailure="True" BuildInParallel="True" Properties="$(GlobalProperties)"/>
73+
<MSBuild Projects="@(ProjectReference)" StopOnFirstFailure="True" BuildInParallel="True" Properties="$(GlobalProperties)"/>
7474
</Target>
7575

7676
<!-- VC-LTL Rust crate 编译准备 -->
7777
<Target Name="PrepareToCompileRustLanguageSupport">
7878
<ItemGroup>
79-
<RustTargetPlatform_x86 Include="$(SolutionDir)TargetPlatform\6.0.6000.0\lib\Win32\*ucrt.lib;$(SolutionDir)TargetPlatform\6.0.6000.0\lib\Win32\*vcruntime.lib;" />
80-
<RustTargetPlatform_x64 Include="$(SolutionDir)TargetPlatform\6.0.6000.0\lib\x64\*ucrt.lib;$(SolutionDir)TargetPlatform\6.0.6000.0\lib\x64\*vcruntime.lib;" />
81-
<RustTargetPlatform_arm64 Include="$(SolutionDir)TargetPlatform\10.0.10240.0\lib\ARM64\*ucrt.lib;$(SolutionDir)TargetPlatform\10.0.10240.0\lib\ARM64\*vcruntime.lib;" />
79+
<RustTargetPlatform_x86 Include="$(SolutionDir)TargetPlatform\6.0.6000.0\lib\Win32\**\*ucrt.lib;$(SolutionDir)TargetPlatform\6.0.6000.0\lib\Win32\**\*vcruntime.lib;" />
80+
<RustTargetPlatform_x64 Include="$(SolutionDir)TargetPlatform\6.0.6000.0\lib\x64\**\*ucrt.lib;$(SolutionDir)TargetPlatform\6.0.6000.0\lib\x64\**\*vcruntime.lib;" />
81+
<RustTargetPlatform_arm64 Include="$(SolutionDir)TargetPlatform\10.0.10240.0\lib\ARM64\**\*ucrt.lib;$(SolutionDir)TargetPlatform\10.0.10240.0\lib\ARM64\**\*vcruntime.lib;" />
8282
<RustTargetPlatform_Common Include="$(SolutionDir)Readme.md;$(SolutionDir)LICENSE;" />
8383
</ItemGroup>
8484

@@ -96,102 +96,6 @@
9696
<Delete Files="$(MSBuildThisFileDirectory)$(ZipFileName)"/>
9797
<Exec Command="7z.exe a $(ZipFileName) config _msvcrt.h %22VC-LTL helper for *%22 TargetPlatform Readme.md Readme.osc.md Install.cmd -xr!*.objs.lib -xr!*.idb" WorkingDirectory="$(MSBuildThisFileDirectory)"/>
9898
</Target>
99-
100-
<Target Name="PackRedist">
101-
<PropertyGroup>
102-
<ZipFileName Condition="'$(TagVersion)' == ''">VC-LTL-Redist.7z</ZipFileName>
103-
<ZipFileName Condition="'$(TagVersion)' != ''">VC-LTL-$(TagVersion)-Redist.7z</ZipFileName>
104-
</PropertyGroup>
105-
106-
<!--生成Redist相关文件-->
107-
<PropertyGroup>
108-
<ExcludeCRT2>**\vccorlib140.dll;**\vcruntime140.dll</ExcludeCRT2>
109-
</PropertyGroup>
110-
<!--生成移除了API Set的CRT DLL-->
111-
<RemoveDir Directories="$(SolutionDir)Redist" Condition="Exists('$(SolutionDir)Redist')"/>
112-
<MakeDir Directories="$(SolutionDir)Redist" />
113-
114-
<Copy SourceFiles="$(UniversalCRTSdkDir)Redist\$(WindowsTargetPlatformVersion)\ucrt\DLLs\x86\ucrtbase.dll" DestinationFiles="$(SolutionDir)Redist\x86\CRT\ucrtbase.dll" />
115-
<Copy SourceFiles="$(UniversalCRTSdkDir)Redist\$(WindowsTargetPlatformVersion)\ucrt\DLLs\x64\ucrtbase.dll" DestinationFiles="$(SolutionDir)Redist\x64\CRT\ucrtbase.dll" />
116-
<!--<Copy SourceFiles="$(UniversalCRTSdkDir)Redist\$(WindowsTargetPlatformVersion)\ucrt\DLLs\arm\ucrtbase.dll" DestinationFiles="$(SolutionDir)Redist\arm\CRT\ucrtbase.dll" Condition="Exists('$(UniversalCRTSdkDir)Redist\$(WindowsTargetPlatformVersion)\ucrt\DLLs\arm\ucrtbase.dll')"/>-->
117-
<Copy SourceFiles="$(UniversalCRTSdkDir)Redist\$(WindowsTargetPlatformVersion)\ucrt\DLLs\arm64\ucrtbase.dll" DestinationFiles="$(SolutionDir)Redist\arm64\CRT\ucrtbase.dll" Condition="Exists('$(UniversalCRTSdkDir)Redist\$(WindowsTargetPlatformVersion)\ucrt\DLLs\arm64\ucrtbase.dll')"/>
118-
119-
<ItemGroup>
120-
<CRTExcludeList Include="$(VCInstallDir)\Redist\MSVC\$(VCToolsRedistVersion)\*\Microsoft.VC*.CRT\vcruntime*.dll"/>
121-
<CRTExcludeList Include="$(VCInstallDir)\Redist\MSVC\$(VCToolsRedistVersion)\*\Microsoft.VC*.CRT\vccorlib*.dll"/>
122-
123-
<CRTx86 Include="$(VCInstallDir)\Redist\MSVC\$(VCToolsRedistVersion)\x86\Microsoft.VC*.CRT\*.dll" Exclude="@(CRTExcludeList)"/>
124-
<CRTx64 Include="$(VCInstallDir)\Redist\MSVC\$(VCToolsRedistVersion)\x64\Microsoft.VC*.CRT\*.dll" Exclude="@(CRTExcludeList)"/>
125-
<CRTarm Include="$(VCInstallDir)\Redist\MSVC\$(VCToolsRedistVersion)\arm\Microsoft.VC*.CRT\*.dll" Exclude="@(CRTExcludeList)"/>
126-
<CRTarm64 Include="$(VCInstallDir)\Redist\MSVC\$(VCToolsRedistVersion)\arm64\Microsoft.VC*.CRT\*.dll" Exclude="@(CRTExcludeList)"/>
127-
</ItemGroup>
128-
129-
<Copy SourceFiles="@(CRTx86)" DestinationFolder="$(SolutionDir)Redist\x86\CRT"/>
130-
<Copy SourceFiles="@(CRTx64)" DestinationFolder="$(SolutionDir)Redist\x64\CRT"/>
131-
<!--<Copy SourceFiles="@(CRTarm)" DestinationFolder="$(SolutionDir)Redist\arm\CRT"/>-->
132-
<Copy SourceFiles="@(CRTarm64)" DestinationFolder="$(SolutionDir)Redist\arm64\CRT"/>
133-
134-
<ItemGroup>
135-
<CXXAMPx86 Include="$(VCInstallDir)\Redist\MSVC\$(VCToolsRedistVersion)\x86\Microsoft.VC*.CXXAMP\*.dll" />
136-
<CXXAMPx64 Include="$(VCInstallDir)\Redist\MSVC\$(VCToolsRedistVersion)\x64\Microsoft.VC*.CXXAMP\*.dll" />
137-
<CXXAMParm Include="$(VCInstallDir)\Redist\MSVC\$(VCToolsRedistVersion)\arm\Microsoft.VC*.CXXAMP\*.dll" />
138-
<CXXAMParm64 Include="$(VCInstallDir)\Redist\MSVC\$(VCToolsRedistVersion)\arm64\Microsoft.VC*.CXXAMP\*.dll" />
139-
</ItemGroup>
140-
141-
<Copy SourceFiles="@(CXXAMPx86)" DestinationFolder="$(SolutionDir)Redist\x86\CXXAMP" />
142-
<Copy SourceFiles="@(CXXAMPx64)" DestinationFolder="$(SolutionDir)Redist\x64\CXXAMP" />
143-
<!--<Copy SourceFiles="@(CXXAMParm)" DestinationFolder="$(SolutionDir)Redist\arm\CXXAMP" />-->
144-
<Copy SourceFiles="@(CXXAMParm64)" DestinationFolder="$(SolutionDir)Redist\arm64\CXXAMP" />
145-
146-
147-
<ItemGroup>
148-
<OPENMPx86 Include="$(VCInstallDir)\Redist\MSVC\$(VCToolsRedistVersion)\x86\Microsoft.VC*.OPENMP\*.dll" />
149-
<OPENMPx64 Include="$(VCInstallDir)\Redist\MSVC\$(VCToolsRedistVersion)\x64\Microsoft.VC*.OPENMP\*.dll" />
150-
<OPENMParm Include="$(VCInstallDir)\Redist\MSVC\$(VCToolsRedistVersion)\arm\Microsoft.VC*.OPENMP\*.dll" />
151-
<OPENMParm64 Include="$(VCInstallDir)\Redist\MSVC\$(VCToolsRedistVersion)\arm64\Microsoft.VC*.OPENMP\*.dll" />
152-
</ItemGroup>
153-
154-
<Copy SourceFiles="@(OPENMPx86)" DestinationFolder="$(SolutionDir)Redist\x86\OPENMP" />
155-
<Copy SourceFiles="@(OPENMPx64)" DestinationFolder="$(SolutionDir)Redist\x64\OPENMP" />
156-
<!--<Copy SourceFiles="@(OPENMParm)" DestinationFolder="$(SolutionDir)Redist\arm\OPENMP" />-->
157-
<Copy SourceFiles="@(OPENMParm64)" DestinationFolder="$(SolutionDir)Redist\arm64\OPENMP" />
158-
159-
160-
<ItemGroup>
161-
<MFCx86 Include="$(VCInstallDir)\Redist\MSVC\$(VCToolsRedistVersion)\x86\Microsoft.VC*.MFC\*.dll" />
162-
<MFCx64 Include="$(VCInstallDir)\Redist\MSVC\$(VCToolsRedistVersion)\x64\Microsoft.VC*.MFC\*.dll" />
163-
<MFCarm Include="$(VCInstallDir)\Redist\MSVC\$(VCToolsRedistVersion)\arm\Microsoft.VC*.MFC\*.dll" />
164-
<MFCarm64 Include="$(VCInstallDir)\Redist\MSVC\$(VCToolsRedistVersion)\arm64\Microsoft.VC*.MFC\*.dll" />
165-
</ItemGroup>
166-
167-
<Copy SourceFiles="@(MFCx86)" DestinationFolder="$(SolutionDir)Redist\x86\MFC" />
168-
<Copy SourceFiles="@(MFCx64)" DestinationFolder="$(SolutionDir)Redist\x64\MFC" />
169-
<!--<Copy SourceFiles="@(MFCarm)" DestinationFolder="$(SolutionDir)Redist\arm\MFC" />-->
170-
<Copy SourceFiles="@(MFCarm64)" DestinationFolder="$(SolutionDir)Redist\arm64\MFC" />
171-
172-
<ItemGroup>
173-
<MFCLOCx86 Include="$(VCInstallDir)\Redist\MSVC\$(VCToolsRedistVersion)\x86\Microsoft.VC*.MFCLOC\*.dll" />
174-
<MFCLOCx64 Include="$(VCInstallDir)\Redist\MSVC\$(VCToolsRedistVersion)\x64\Microsoft.VC*.MFCLOC\*.dll" />
175-
<MFCLOCarm Include="$(VCInstallDir)\Redist\MSVC\$(VCToolsRedistVersion)\arm\Microsoft.VC*.MFCLOC\*.dll" />
176-
<MFCLOCarm64 Include="$(VCInstallDir)\Redist\MSVC\$(VCToolsRedistVersion)\arm64\Microsoft.VC*.MFCLOC\*.dll" />
177-
</ItemGroup>
178-
179-
<Copy SourceFiles="@(MFCLOCx86)" DestinationFolder="$(SolutionDir)Redist\x86\MFCLOC" />
180-
<Copy SourceFiles="@(MFCLOCx64)" DestinationFolder="$(SolutionDir)Redist\x64\MFCLOC" />
181-
<!--<Copy SourceFiles="@(MFCLOCarm)" DestinationFolder="$(SolutionDir)Redist\arm\MFCLOC" />-->
182-
<Copy SourceFiles="@(MFCLOCarm64)" DestinationFolder="$(SolutionDir)Redist\arm64\MFCLOC" />
183-
184-
185-
<!--移除APISet-->
186-
<ItemGroup>
187-
<RedistFiles Include="$(SolutionDir)Redist\**\*.dll"/>
188-
</ItemGroup>
189-
<Exec Command="%22$(MSBuildThisFileDirectory)Tools\LibMaker.exe%22 RemoveAPISet %22%(RedistFiles.identity)%22 %22$(MSBuildThisFileDirectory)Tools\ApiSetMap.txt%22" WorkingDirectory="$(MSBuildThisFileDirectory)"/>
190-
191-
192-
<Delete Files="$(MSBuildThisFileDirectory)$(ZipFileName)"/>
193-
<Exec Command="7z.exe a $(ZipFileName) Redist" WorkingDirectory="$(MSBuildThisFileDirectory)"/>
194-
</Target>
19599

196100
<Target Name="_GetProjectAllConfiguration" Returns="@(AllProjectReferenceConfigurations)">
197101
<!--故意过滤Debug配置 与 ARM配置,因为ARM的人实在是太少了。-->

Nuget/build/net8.0-windows7.0/VC-LTL.targets

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
<LTLWindowsTargetPlatformMinVersion Condition="'$(LTLWindowsTargetPlatformMinVersion)' == '' and '$(LTLPlatform)'=='Win32'">5.1.2600.0</LTLWindowsTargetPlatformMinVersion>
2323
</PropertyGroup>
2424
<ItemGroup Condition="'$(LTLWindowsTargetPlatformMinVersion)' != '' and '$(LTLPlatform)' != ''">
25-
<AdditionalNativeLibraryDirectories Include="$(MSBuildThisFileDirectory)..\native\TargetPlatform\$(LTLWindowsTargetPlatformMinVersion)\lib\$(LTLPlatform)" />
25+
<AdditionalNativeLibraryDirectories Include="$(MSBuildThisFileDirectory)..\native\TargetPlatform\$(LTLWindowsTargetPlatformMinVersion)\lib\$(LTLPlatform);$(MSBuildThisFileDirectory)..\native\TargetPlatform\$(LTLWindowsTargetPlatformMinVersion)\lib\$(LTLPlatform)\Shared" />
2626
</ItemGroup>
2727
</Target>
2828
</Project>

VC-LTL helper for Visual Studio.props

+3
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ VC-LTL默认搜索顺序
3030
<PropertyGroup>
3131
<!--控制TargetPlatform版本,目前可用版本为 5.1.2600.0 6.0.6000.0(默认) 6.2.9200.0 10.0.10240.0 10.0.19041.0-->
3232
<!--<WindowsTargetPlatformMinVersion>10.0.10240.0</WindowsTargetPlatformMinVersion>-->
33+
34+
<!--实验性功能!开启后,对于使用`/MD`构建项目将依赖ucrtbase.dll,使用后你可能需要下载VC-LTL.Redist.Dlls.zip(感谢msvcr14x项目提供兼容XP系统的ucrtbase.dll)。-->
35+
<!--<VC_LTL_EnableNewStyleRuntimeDlls>true</VC_LTL_EnableNewStyleRuntimeDlls>-->
3336
</PropertyGroup>
3437
<!--####################################################################################################################################################-->
3538

VC-LTL helper for cmake.cmake

+3
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@
2929

3030
#(PR#70 引入),默认关,开启后将使用cmake `INTERFACE`能力,然后单独`target_link_directories(工程名称 VC_LTL)` 即可引用
3131
#option(VC_LTL_EnableCMakeInterface "VC_LTL_EnableCMakeInterface" on)
32+
33+
#(Fea #64 引入),实验性功能!开启后,对于使用`/MD`构建项目将依赖ucrtbase.dll,使用后你可能需要下载VC-LTL.Redist.Dlls.zip(感谢msvcr14x项目提供兼容XP系统的ucrtbase.dll)。
34+
#option(VC_LTL_EnableNewStyleRuntimeDlls "VC_LTL_EnableNewStyleRuntimeDlls" on)
3235
####################################################################################################################################################
3336

3437
if(NOT VC_LTL_Root)

VC-LTL helper for nmake.cmd

+3
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@
2929
::控制TargetPlatform版本,目前可用版本为 5.1.2600.0 6.0.6000.0(默认) 6.2.9200.0 10.0.10240.0 10.0.19041.0
3030
::set WindowsTargetPlatformMinVersion=10.0.10240.0
3131

32+
::(Fea #64 引入),实验性功能!开启后,对于使用`/MD`构建项目将依赖ucrtbase.dll,使用后你可能需要下载VC-LTL.Redist.Dlls.zip(感谢msvcr14x项目提供兼容XP系统的ucrtbase.dll)。
33+
::set VC_LTL_EnableNewStyleRuntimeDlls=true
34+
3235
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
3336

3437

VC-LTL helper for nmake.ps1

+2
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@
2929
# 控制TargetPlatform版本,目前可用版本为 5.1.2600.0 6.0.6000.0(默认) 6.2.9200.0 10.0.10240.0 10.0.19041.0
3030
# $env:WindowsTargetPlatformMinVersion="10.0.10240.0"
3131

32+
# (Fea #64 引入),实验性功能!开启后,对于使用`/MD`构建项目将依赖ucrtbase.dll,使用后你可能需要下载VC-LTL.Redist.Dlls.zip(感谢msvcr14x项目提供兼容XP系统的ucrtbase.dll)。
33+
# $env:VC_LTL_EnableNewStyleRuntimeDlls="true"
3234
################################################################################################################################
3335

3436
do

VC-LTL helper for qmake.pri

+3
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@
3030
# 控制TargetPlatform版本,目前可用版本为 6.0.6000.0(默认) 6.2.9200.0 10.0.10240.0 10.0.19041.0
3131
# WindowsTargetPlatformMinVersion = 10.0.10240.0
3232

33+
# (Fea #64 引入),实验性功能!开启后,对于使用`/MD`构建项目将依赖ucrtbase.dll,使用后你可能需要下载VC-LTL.Redist.Dlls.zip(感谢msvcr14x项目提供兼容XP系统的ucrtbase.dll)。
34+
# VC_LTL_EnableNewStyleRuntimeDlls = true
35+
3336
# -----------------------------------------------------------------------------------------------------------------------------------------------------
3437

3538

config/1033/VC-LTL-Options.xml

+7-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,13 @@
3737
Category="VC_LTL"
3838
DisplayName="Enable VC-LTL"
3939
Description="Allow the current project to enable VC-LTL."/>
40-
40+
41+
<BoolProperty
42+
Name="VC_LTL_EnableNewStyleRuntimeDlls"
43+
Category="VC_LTL"
44+
DisplayName="开启新式Dlls依赖"
45+
Description="实验性功能!开启后,对于使用`/MD`构建项目将依赖ucrtbase.dll,使用后你可能需要下载VC-LTL.Redist.Dlls.zip(感谢msvcr14x项目提供兼容XP系统的ucrtbase.dll)。"/>
46+
4147
<EnumProperty
4248
Name="WindowsTargetPlatformMinVersion"
4349
Category="VC_LTL"

config/2052/VC-LTL-Options.xml

+7-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,13 @@
3737
Category="VC_LTL"
3838
DisplayName="启用VC-LTL"
3939
Description="允许当前项目启用VC-LTL,此选项一般用于验证某些问题时使用,非特殊情况建议始终保持开启。"/>
40-
40+
41+
<BoolProperty
42+
Name="VC_LTL_EnableNewStyleRuntimeDlls"
43+
Category="VC_LTL"
44+
DisplayName="开启新式Dlls依赖"
45+
Description="实验性功能!开启后,对于使用`/MD`构建项目将依赖ucrtbase.dll,使用后你可能需要下载VC-LTL.Redist.Dlls.zip(感谢msvcr14x项目提供兼容XP系统的ucrtbase.dll)。"/>
46+
4147
<EnumProperty
4248
Name="WindowsTargetPlatformMinVersion"
4349
Category="VC_LTL"

config/config.cmake

+8-1
Original file line numberDiff line numberDiff line change
@@ -204,8 +204,15 @@ if(${SupportLTL} STREQUAL "true")
204204
message(" Platform :" ${LTLPlatform})
205205
message("")
206206

207+
set(VC_LTL_MD_SharedVersion ${LTLWindowsTargetPlatformMinVersion})
208+
if(VC_LTL_EnableNewStyleRuntimeDlls)
209+
if(${LTLWindowsTargetPlatformMinVersion} VERSION_LESS 10.0.10240.0)
210+
set(VC_LTL_MD_SharedVersion "10.0.10240.0")
211+
endif()
212+
endif()
213+
207214
set(VC_LTL_Include ${VC_LTL_Root}/TargetPlatform/header;${VC_LTL_Root}/TargetPlatform/${LTLWindowsTargetPlatformMinVersion}/header)
208-
set(VC_LTL_Library ${VC_LTL_Root}/TargetPlatform/${LTLWindowsTargetPlatformMinVersion}/lib/${LTLPlatform})
215+
set(VC_LTL_Library ${VC_LTL_Root}/TargetPlatform/${LTLWindowsTargetPlatformMinVersion}/lib/${LTLPlatform};${VC_LTL_Root}/TargetPlatform/${VC_LTL_MD_SharedVersion}/lib/${LTLPlatform}/Shared)
209216

210217
#message("INCLUDE " $ENV{INCLUDE})
211218
#message("LIB " $ENV{LIB})

config/config.cmd

+3-2
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,12 @@ echo VC Tools Version : %VCToolsVersion%
7878
echo WindowsTargetPlatformMinVersion : %LTLWindowsTargetPlatformMinVersion%
7979
echo Platform : %LTLPlatform%
8080

81-
81+
set VC_LTL_MD_SharedVersion=%LTLWindowsTargetPlatformMinVersion%
82+
if /i "%VC_LTL_EnableNewStyleRuntimeDlls%" == "true" (set VC_LTL_MD_SharedVersion=10.0.10240.0)
8283

8384
::修改Include
8485
set INCLUDE=%VC_LTL_Root%TargetPlatform\header;%VC_LTL_Root%TargetPlatform\%LTLWindowsTargetPlatformMinVersion%\header;%INCLUDE%
85-
set LIB=%VC_LTL_Root%TargetPlatform\%LTLWindowsTargetPlatformMinVersion%\lib\%LTLPlatform%;%LIB%
86+
set LIB=%VC_LTL_Root%TargetPlatform\%LTLWindowsTargetPlatformMinVersion%\lib\%LTLPlatform%;%VC_LTL_Root%TargetPlatform\%VC_LTL_MD_SharedVersion%\lib\%LTLPlatform%\Shared;%LIB%
8687

8788
goto:eof
8889

config/config.pri

+6-1
Original file line numberDiff line numberDiff line change
@@ -113,11 +113,16 @@ $$escape_expand(\\n)############################################################
113113

114114
message($$VC_LTL_Info)
115115

116+
VC_LTL_MD_SharedVersion = $$LTLWindowsTargetPlatformMinVersion
117+
equals(VC_LTL_EnableNewStyleRuntimeDlls, true) {
118+
VC_LTL_MD_SharedVersion = 10.0.10240.0
119+
}
116120

117121
# 修改头文件及库搜索路径
118122
QMAKE_INCDIR += \
119123
$$VC_LTL_Root/TargetPlatform/header \
120124
$$VC_LTL_Root/TargetPlatform/$$LTLWindowsTargetPlatformMinVersion/header
121125

122126
QMAKE_LIBS += \
123-
-L$$VC_LTL_Root/TargetPlatform/$$LTLWindowsTargetPlatformMinVersion/lib/$$LTLPlatform
127+
-L$$VC_LTL_Root/TargetPlatform/$$LTLWindowsTargetPlatformMinVersion/lib/$$LTLPlatform \
128+
-L$$VC_LTL_Root/TargetPlatform/$$VC_LTL_MD_SharedVersion/lib/$$LTLPlatform/Shared

0 commit comments

Comments
 (0)