Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions build.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,31 @@ set PATH=%PATH%;%WinDir%\Microsoft.Net\Framework64\V4.0.30319;%WinDir%\Microsoft
if %__BuildNativeCoreLib% EQU 1 (
echo %__MsgPrefix%Generating native image of System.Private.CoreLib for %__BuildOS%.%__BuildArch%.%__BuildType%

REM Need VS native tools environment for the **target** arch when running instrumented binaries
if %__PgoInstrument% EQU 1 (
set __VCExecArch=%__BuildArch%
if /i [%__BuildArch%] == [x64] set __VCExecArch=amd64
echo %__MsgPrefix%Using environment: "%__VCToolsRoot%\vcvarsall.bat" !__VCExecArch!
call "%__VCToolsRoot%\vcvarsall.bat" !__VCExecArch!
@if defined _echo @echo on
if NOT !errorlevel! == 0 (
echo %__MsgPrefix%Error: Failed to load native tools environment for !__VCExecArch!
goto CrossgenFailure
)

REM HACK: Workaround for [dotnet/coreclr#13970](https://github.com/dotnet/coreclr/issues/13970)
set __PgoRtPath=
for /f "tokens=*" %%f in ('where pgort*.dll') do (
if not defined __PgoRtPath set "__PgoRtPath=%%~f"
)
echo %__MsgPrefix%Copying "!__PgoRtPath!" into "%__BinDir%"
copy /y "!__PgoRtPath!" "%__BinDir%" || (
echo %__MsgPrefix%Error: copy failed
goto CrossgenFailure
)
REM End HACK
)

echo "%__CrossgenExe%" %__IbcTuning% /Platform_Assemblies_Paths "%__BinDir%"\IL /out "%__BinDir%\System.Private.CoreLib.dll" "%__BinDir%\IL\System.Private.CoreLib.dll"
"%__CrossgenExe%" %__IbcTuning% /Platform_Assemblies_Paths "%__BinDir%"\IL /out "%__BinDir%\System.Private.CoreLib.dll" "%__BinDir%\IL\System.Private.CoreLib.dll" > "%__CrossGenCoreLibLog%" 2>&1
if NOT !errorlevel! == 0 (
Expand Down
30 changes: 0 additions & 30 deletions pgosupport.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -57,33 +57,3 @@ function(add_pgo TargetName)
endif(EXISTS ${ProfilePath})
endif(CLR_CMAKE_PGO_INSTRUMENT)
endfunction(add_pgo)

if(WIN32)
if(CLR_CMAKE_PGO_INSTRUMENT)
# Instrumented PGO binaries on Windows introduce an additional runtime dependency, pgort<ver>.dll.
# Make sure we copy it next to the installed product to make it easier to redistribute the package.

string(SUBSTRING ${CMAKE_VS_PLATFORM_TOOLSET} 1 -1 VS_PLATFORM_VERSION_NUMBER)
set(PGORT_FILENAME "pgort${VS_PLATFORM_VERSION_NUMBER}.dll")

get_filename_component(PATH_CXX_ROOTDIR ${CMAKE_CXX_COMPILER} DIRECTORY)

if(CLR_CMAKE_PLATFORM_ARCH_I386)
set(PATH_VS_PGORT_DLL "${PATH_CXX_ROOTDIR}/${PGORT_FILENAME}")
elseif(CLR_CMAKE_PLATFORM_ARCH_AMD64)
set(PATH_VS_PGORT_DLL "${PATH_CXX_ROOTDIR}/../amd64/${PGORT_FILENAME}")
elseif(CLR_CMAKE_PLATFORM_ARCH_ARM)
set(PATH_VS_PGORT_DLL "${PATH_CXX_ROOTDIR}/../arm/${PGORT_FILENAME}")
else()
clr_pgo_unknown_arch()
endif()

if (EXISTS ${PATH_VS_PGORT_DLL})
message(STATUS "Found PGO runtime: ${PATH_VS_PGORT_DLL}")
install(PROGRAMS ${PATH_VS_PGORT_DLL} DESTINATION .)
else()
message(FATAL_ERROR "file not found: ${PATH_VS_PGORT_DLL}")
endif()

endif(CLR_CMAKE_PGO_INSTRUMENT)
endif(WIN32)