Skip to content

Commit

Permalink
Opt, 默认开启干净导入表模式模式(功能转正)
Browse files Browse the repository at this point in the history
  • Loading branch information
mingkuang-Chuyu committed May 25, 2024
1 parent 6dfe24b commit ef272d1
Show file tree
Hide file tree
Showing 12 changed files with 11 additions and 60 deletions.
3 changes: 3 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,6 @@ indent_size = 4
[*.{vcxproj,xml,nuspec,props,targets}]
indent_style = space
indent_size = 2

[*.cmd]
charset = unset
5 changes: 1 addition & 4 deletions VC-LTL helper for Visual Studio.props
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,6 @@ VC-LTL默认搜索顺序
<PropertyGroup>
<!--控制TargetPlatform版本,目前可用版本为 5.1.2600.0 6.0.6000.0(默认) 6.2.9200.0 10.0.10240.0 10.0.19041.0-->
<!--<WindowsTargetPlatformMinVersion>10.0.10240.0</WindowsTargetPlatformMinVersion>-->

<!--启用干净的导入表,消除 ucrt apiset(如:api-ms-win-crt-time-l1-1-0.dll),满足强迫症患者。-->
<!--<CleanImport>true</CleanImport>-->
</PropertyGroup>
<!--####################################################################################################################################################-->

Expand Down Expand Up @@ -66,4 +63,4 @@ VC-LTL默认搜索顺序
<!--兼容模式,尝试加载老版本-->
<Import Project="$(VC_LTL_Root)\ltlvcrt.props" Condition="(!Exists('$(VC_LTL_Root)\Config\config.props')) And (Exists('$(VC_LTL_Root)\ltlvcrt.props'))"/>
</ImportGroup>
</Project>
</Project>
3 changes: 0 additions & 3 deletions VC-LTL helper for cmake.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@
#控制TargetPlatform版本,目前可用版本为5.1.2600.0 6.0.6000.0(默认) 6.2.9200.0 10.0.10240.0 10.0.19041.0
#set(WindowsTargetPlatformMinVersion "10.0.10240.0")

#启用干净的导入表,消除 ucrt apiset(如:api-ms-win-crt-time-l1-1-0.dll),满足强迫症患者。
#set(CleanImport "true")

####################################################################################################################################################

if(NOT VC_LTL_Root)
Expand Down
3 changes: 0 additions & 3 deletions VC-LTL helper for nmake.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,6 @@
::控制TargetPlatform版本,目前可用版本为 5.1.2600.0 6.0.6000.0(默认) 6.2.9200.0 10.0.10240.0 10.0.19041.0
::set WindowsTargetPlatformMinVersion=10.0.10240.0

::启用干净的导入表,消除 ucrt apiset(如:api-ms-win-crt-time-l1-1-0.dll),满足强迫症患者。
::set CleanImport=true

:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::


Expand Down
3 changes: 0 additions & 3 deletions VC-LTL helper for nmake.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,6 @@
# 控制TargetPlatform版本,目前可用版本为 5.1.2600.0 6.0.6000.0(默认) 6.2.9200.0 10.0.10240.0 10.0.19041.0
# $env:WindowsTargetPlatformMinVersion="10.0.10240.0"

# 启用干净的导入表,消除 ucrt apiset(如:api-ms-win-crt-time-l1-1-0.dll),满足强迫症患者。
# $env:CleanImport="true"

################################################################################################################################

do
Expand Down
5 changes: 1 addition & 4 deletions VC-LTL helper for qmake.pri
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Release {
Release {

# 作者:GPBeta(https://github.com/GPBeta),mingkuang(https://github.com/mingkuang-Chuyu)
# 修改日期:2021-08-20
Expand Down Expand Up @@ -30,9 +30,6 @@ Release {
# 控制TargetPlatform版本,目前可用版本为 6.0.6000.0(默认) 6.2.9200.0 10.0.10240.0 10.0.19041.0
# WindowsTargetPlatformMinVersion = 10.0.10240.0

# 启用干净的导入表,消除 ucrt apiset(如:api-ms-win-crt-time-l1-1-0.dll),满足强迫症患者。
# CleanImport=true

# -----------------------------------------------------------------------------------------------------------------------------------------------------


Expand Down
10 changes: 0 additions & 10 deletions config/config.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,6 @@ if(NOT SupportLTL)
set(SupportLTL "true")
endif()

if(NOT CleanImport)
set(CleanImport "false")
endif()

if(${SupportLTL} STREQUAL "true")
if(NOT CMAKE_SYSTEM_NAME)
message(WARNING "VC-LTL not load, because CMAKE_SYSTEM_NAME is not defined!!!")
Expand Down Expand Up @@ -207,12 +203,6 @@ if(${SupportLTL} STREQUAL "true")
set(VC_LTL_Include ${VC_LTL_Root}/TargetPlatform/header;${VC_LTL_Root}/TargetPlatform/${LTLWindowsTargetPlatformMinVersion}/header)
set(VC_LTL_Library ${VC_LTL_Root}/TargetPlatform/${LTLWindowsTargetPlatformMinVersion}/lib/${LTLPlatform})

# 如果开启了 CleanImport 那么优先使用 CleanImport
if(${CleanImport} STREQUAL "true")
if(EXISTS ${VC_LTL_Root}/TargetPlatform/${LTLWindowsTargetPlatformMinVersion}/lib/${LTLPlatform}/CleanImport)
set(VC_LTL_Library ${VC_LTL_Root}/TargetPlatform/${LTLWindowsTargetPlatformMinVersion}/lib/${LTLPlatform}/CleanImport;${VC_LTL_Library})
endif()
endif()
#message("INCLUDE " $ENV{INCLUDE})
#message("LIB " $ENV{LIB})

Expand Down
2 changes: 0 additions & 2 deletions config/config.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,6 @@ echo Platform : %LTLPlatform%
set INCLUDE=%VC_LTL_Root%TargetPlatform\header;%VC_LTL_Root%TargetPlatform\%LTLWindowsTargetPlatformMinVersion%\header;%INCLUDE%
set LIB=%VC_LTL_Root%TargetPlatform\%LTLWindowsTargetPlatformMinVersion%\lib\%LTLPlatform%;%LIB%

if /i "%CleanImport%" == "true" if exist "%VC_LTL_Root%TargetPlatform\%LTLWindowsTargetPlatformMinVersion%\lib\%LTLPlatform%\CleanImport"(set "LIB=%VC_LTL_Root%TargetPlatform\%LTLWindowsTargetPlatformMinVersion%\lib\%LTLPlatform%\CleanImport;%LIB%")

goto:eof


Expand Down
15 changes: 1 addition & 14 deletions config/config.pri
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#
#
# 请不要直接使用此配置,应该使用VC-LTL helper for qmake.pri
#

Expand Down Expand Up @@ -33,12 +33,6 @@ equals(LTLPlatform, x86) {
LTLPlatform = Win32
}

# 环境变量选项
CleanImport = $$CleanImport
isEmpty(CleanImport){
CleanImport=false
}

# 环境变量选项
SupportWinXP_t = $$SupportWinXP
isEmpty(SupportWinXP_t){
Expand Down Expand Up @@ -125,12 +119,5 @@ QMAKE_INCDIR += \
$$VC_LTL_Root/TargetPlatform/header \
$$VC_LTL_Root/TargetPlatform/$$LTLWindowsTargetPlatformMinVersion/header

equals(CleanImport, true) {
exists($$VC_LTL_Root/TargetPlatform/$$LTLWindowsTargetPlatformMinVersion/lib/$$LTLPlatform/CleanImport) {
QMAKE_LIBS += \
-L$$VC_LTL_Root/TargetPlatform/$$LTLWindowsTargetPlatformMinVersion/lib/$$LTLPlatform/CleanImport
}
}

QMAKE_LIBS += \
-L$$VC_LTL_Root/TargetPlatform/$$LTLWindowsTargetPlatformMinVersion/lib/$$LTLPlatform
3 changes: 0 additions & 3 deletions config/config.props
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,6 @@

<VC_LTL_Include>$(VC_LTL_Root)TargetPlatform\header;$(VC_LTL_Root)TargetPlatform\$(LTLWindowsTargetPlatformMinVersion)\header</VC_LTL_Include>
<VC_LTL_Library>$(VC_LTL_Root)TargetPlatform\$(LTLWindowsTargetPlatformMinVersion)\lib\$(Platform);$(IntDir)VC-LTL5.tmp\$(LTLWindowsTargetPlatformMinVersion)\$(Platform)</VC_LTL_Library>

<!--如果启用了干净导入表模式,那么额外附加CleanImport的路径-->
<VC_LTL_Library Condition="'$(CleanImport)' == 'true' and Exists('$(VC_LTL_Root)TargetPlatform\$(LTLWindowsTargetPlatformMinVersion)\lib\$(Platform)\CleanImport')">$(VC_LTL_Root)TargetPlatform\$(LTLWindowsTargetPlatformMinVersion)\lib\$(Platform)\CleanImport;$(VC_LTL_Library)</VC_LTL_Library>
</PropertyGroup>

<PropertyGroup Condition=" '$(SupportLTL)'=='true' or '$(SupportLTL)'=='ucrt'">
Expand Down
7 changes: 0 additions & 7 deletions config/config.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -212,10 +212,3 @@ Write-Host "$LTLPlatform" -ForegroundColor Green
$env:INCLUDE="$env:VC_LTL_Root\TargetPlatform\header;$env:VC_LTL_Root\TargetPlatform\$LTLWindowsTargetPlatformMinVersion\header;$env:INCLUDE"
$env:LIB="$env:VC_LTL_Root\TargetPlatform\$LTLWindowsTargetPlatformMinVersion\lib\$LTLPlatform;$env:LIB"

if($CleanImport -ieq "true")
{
if(Test-Path "$env:VC_LTL_Root\TargetPlatform\$LTLWindowsTargetPlatformMinVersion\lib\$LTLPlatform\CleanImport")
{
$env:LIB="$env:VC_LTL_Root\TargetPlatform\$LTLWindowsTargetPlatformMinVersion\lib\$LTLPlatform\CleanImport;$env:LIB"
}
}
12 changes: 5 additions & 7 deletions ucrtbase.ucrtbase/ucrtbase.ucrtbase.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -833,11 +833,9 @@
<Exec Command="%22$(SolutionDir)Tools\LibMaker.exe%22 CreateWeaks /MACHINE:$(PlatformShortName) /def:%22$(SolutionDir)Tools\Shared\ucrtbase.debug.weak.def%22 /out:%22$(IntDir)objs\weak%22" Condition="'$(UseDebugLibraries)' == 'true'" />
<Exec Command="lib %22$(IntDir)ucrt_CleanImport.lib%22 %22$(IntDir)objs\weak\*%22" Condition="'$(UseDebugLibraries)' == 'true'" />
</Target>
<Target Name="CopyFiles" AfterTargets="_Lib" Inputs="$(UniversalCRTSdkDir)Lib\$(WindowsTargetPlatformVersion)\ucrt\$(PlatformShortName)\ucrt.lib" Outputs="$(OutDir)libucrt.lib;$(OutDir)CleanImport\ucrt.lib;$(OutDir)CleanImport\libucrt.lib" Condition="'$(Configuration)' == 'Static'">
<Copy SourceFiles="$(UniversalCRTSdkDir)Lib\$(WindowsTargetPlatformVersion)\ucrt\$(PlatformShortName)\ucrt.lib" DestinationFiles="$(OutDir)libucrt.lib" />
<!--顺道再产生干净导入表模式-->
<MakeDir Directories="$(OutDir)CleanImport" />
<Copy SourceFiles="$(IntDir)ucrt_CleanImport.lib" DestinationFiles="$(OutDir)CleanImport\ucrt.lib" />
<Copy SourceFiles="$(IntDir)ucrt_CleanImport.lib" DestinationFiles="$(OutDir)CleanImport\libucrt.lib" />
<Target Name="CopyFiles" AfterTargets="_Lib" Inputs="$(IntDir)ucrt_CleanImport.lib" Outputs="$(OutDir)ucrt.lib;$(OutDir)libucrt.lib" Condition="'$(Configuration)' == 'Static'">
<!--复制干净导入表的UCRT库-->
<Copy SourceFiles="$(IntDir)ucrt_CleanImport.lib" DestinationFiles="$(OutDir)ucrt.lib" />
<Copy SourceFiles="$(IntDir)ucrt_CleanImport.lib" DestinationFiles="$(OutDir)libucrt.lib" />
</Target>
</Project>
</Project>

0 comments on commit ef272d1

Please sign in to comment.