From 77a26b6b77794717f6ece6a04a5d47dc023f5dd9 Mon Sep 17 00:00:00 2001 From: Mike Richmond Date: Thu, 7 Jul 2016 11:34:10 -0700 Subject: [PATCH] Additional code changes and link fixes --- build.psm1 | 101 +++-- src/powershell-native/CMakeLists.txt | 382 +++++++++++++++++- .../nativemsh/pwrshcommon/CMakeLists.txt | 9 +- .../nativemsh/pwrshcommon/ClrHostWrapper.h | 26 ++ .../nativemsh/pwrshcommon/SystemCallFacade.h | 3 +- .../pwrshcommon/WinSystemCallFacade.cpp | 5 +- .../pwrshcommon/WinSystemCallFacade.h | 3 +- .../nativemsh/pwrshcommon/pwrshcommon.cpp | 6 +- .../nativemsh/pwrshexe/CMakeLists.txt | 35 +- .../nativemsh/pwrshplugin/CMakeLists.txt | 36 +- .../nativemsh/pwrshplugin/pwrshclrhost.cpp | 9 +- .../nativemsh/pwrshplugin/pwrshclrhost.h | 13 +- .../nativemsh/pwrshplugin/pwrshplugin.h | 2 +- .../windows-compiler-override.txt | 16 + 14 files changed, 563 insertions(+), 83 deletions(-) create mode 100644 src/powershell-native/windows-compiler-override.txt diff --git a/build.psm1 b/build.psm1 index 8d9998cf4..c877ddc8d 100644 --- a/build.psm1 +++ b/build.psm1 @@ -62,7 +62,7 @@ function Start-PSBuild { [ValidateSet('x86', 'x64')] [string]$NativeHostArch = "x64", - [ValidateSet('Linux', 'Debug', 'Release', '')] + [ValidateSet('Linux', 'Debug', 'Release', '')] # We might need "Checked" as well [string]$Configuration ) @@ -156,36 +156,36 @@ function Start-PSBuild { $Arguments += "--runtime", $Options.Runtime # handle Restore - if ($Restore -or -not (Test-Path "$($Options.Top)/project.lock.json")) { - log "Run dotnet restore" +# if ($Restore -or -not (Test-Path "$($Options.Top)/project.lock.json")) { +# log "Run dotnet restore" - $RestoreArguments = @("--verbosity") - if ($PSCmdlet.MyInvocation.BoundParameters["Verbose"].IsPresent) { - $RestoreArguments += "Info" - } else { - $RestoreArguments += "Warning" - } - - $RestoreArguments += "$PSScriptRoot" - - Start-NativeExecution { dotnet restore $RestoreArguments } - } +# $RestoreArguments = @("--verbosity") +# if ($PSCmdlet.MyInvocation.BoundParameters["Verbose"].IsPresent) { +# $RestoreArguments += "Info" +# } else { +# $RestoreArguments += "Warning" +# } +# +# $RestoreArguments += "$PSScriptRoot" +# +# Start-NativeExecution { dotnet restore $RestoreArguments } +# } # handle ResGen # Heuristic to run ResGen on the fresh machine - if ($ResGen -or -not (Test-Path "$PSScriptRoot/src/Microsoft.PowerShell.ConsoleHost/gen")) - { - log "Run ResGen (generating C# bindings for resx files)" - Start-ResGen - } +# if ($ResGen -or -not (Test-Path "$PSScriptRoot/src/Microsoft.PowerShell.ConsoleHost/gen")) +# { +# log "Run ResGen (generating C# bindings for resx files)" +# Start-ResGen +# } # handle xaml files # Heuristic to resolve xaml on the fresh machine - if ($FullCLR -and ($XamlGen -or -not (Test-Path "$PSScriptRoot/src/Microsoft.PowerShell.Activities/gen/*.g.cs"))) - { - log "Run XamlGen (generating .g.cs and .resources for .xaml files)" - Start-XamlGen -MSBuildConfiguration $msbuildConfiguration - } +# if ($FullCLR -and ($XamlGen -or -not (Test-Path "$PSScriptRoot/src/Microsoft.PowerShell.Activities/gen/*.g.cs"))) +# { +# log "Run XamlGen (generating .g.cs and .resources for .xaml files)" +# Start-XamlGen -MSBuildConfiguration $msbuildConfiguration +# } # Build native components if ($IsLinux -or $IsOSX) { @@ -217,6 +217,12 @@ function Start-PSBuild { try { Push-Location "$PSScriptRoot\src\powershell-native" + $vcPath = (Get-Item(Join-Path -Path "$env:VS140COMNTOOLS" -ChildPath '../../vc')).FullName + if ((Test-Path -Path $vcPath\vcvarsall.bat) -eq $false) + { + throw "Could not find Visual Studio vcvarsall.bat at" + $vcPath + } + # Compile native resources @("nativemsh/pwrshplugin") | % { $nativeResourcesFolder = $_ @@ -224,18 +230,46 @@ function Start-PSBuild { & $mcexe -o -d -c -U $_.FullName -h $nativeResourcesFolder -r $nativeResourcesFolder } } - - if ($cmakeGenerator) { - Start-NativeExecution { cmake -G $cmakeGenerator . } - } else { - Start-NativeExecution { cmake . } - } - - Start-NativeExecution { msbuild ALL_BUILD.vcxproj /p:Configuration=$msbuildConfiguration } + + $overrideFlags = "-DCMAKE_USER_MAKE_RULES_OVERRIDE=$PSScriptRoot\src\powershell-native\windows-compiler-override.txt" + $vcArch = "Win64" + $cmakeGenerator = "Visual Studio 14 2015 $vcArch" +# $CMakeArguments = "-G $cmakeGenerator ." + $vcPlatform = "x64" + $location = Get-Location +# $MSBuildArguments = "ALL_BUILD.vcxproj /p:Configuration=$msbuildConfiguration" +# if ($cmakeGenerator) { +# Start-NativeExecution { cmake $overrideFlags -G $cmakeGenerator . } +# } else { +# Start-NativeExecution { cmake $overrideFlags . } +# } +# # +# # BUILD_ONECORE +# # + $command = @" +cmd.exe /C cd /d "$location" "&" "$($vcPath)\vcvarsall.bat" "$vcPlatform" "&" cmake "$overrideFlags" -DBUILD_ONECORE=ON -G "$cmakeGenerator" . "&" msbuild ALL_BUILD.vcxproj "/p:Configuration=$msbuildConfiguration" +"@ +#cmd.exe /C cd /d "$location" "&" "$($vcPath)\vcvarsall.bat" "$vcPlatform" "&" "$cmakeCmd" "&" "msbuild ALL_BUILD.vcxproj /p:Configuration=$msbuildConfiguration" +# "&" exit + log " Executing command: $command" + #Start-NativeExecution { msbuild ALL_BUILD.vcxproj /p:Configuration=$msbuildConfiguration } + Start-NativeExecution { Invoke-Expression -Command:$command } + # + # NOT BUILD_ONECORE + # + $command = @" +cmd.exe /C cd /d "$location" "&" "$($vcPath)\vcvarsall.bat" "$vcPlatform" "&" cmake "$overrideFlags" -DBUILD_ONECORE=OFF -G "$cmakeGenerator" . "&" msbuild ALL_BUILD.vcxproj "/p:Configuration=$msbuildConfiguration" +"@ +#cmd.exe /C cd /d "$location" "&" "$($vcPath)\vcvarsall.bat" "$vcPlatform" "&" "$cmakeCmd" "&" "msbuild ALL_BUILD.vcxproj /p:Configuration=$msbuildConfiguration" +# "&" exit + log " Executing command: $command" + #Start-NativeExecution { msbuild ALL_BUILD.vcxproj /p:Configuration=$msbuildConfiguration } + Start-NativeExecution { Invoke-Expression -Command:$command } } finally { Pop-Location } + throw "All done" } # handle TypeGen @@ -254,7 +288,6 @@ function Start-PSBuild { } finally { Pop-Location } - } @@ -1312,7 +1345,7 @@ function script:Start-NativeExecution([scriptblock]$sb) try { & $sb - # note, if $sb doens't have a native invokation, $LASTEXITCODE will + # note, if $sb doens't have a native invocation, $LASTEXITCODE will # point to the obsolete value if ($LASTEXITCODE -ne 0) { diff --git a/src/powershell-native/CMakeLists.txt b/src/powershell-native/CMakeLists.txt index 171ed8fe7..07fc79ef8 100644 --- a/src/powershell-native/CMakeLists.txt +++ b/src/powershell-native/CMakeLists.txt @@ -1,27 +1,385 @@ cmake_minimum_required(VERSION 2.8.4) -project(PowerShell) +project(PowerShellNative) -add_compile_options() +# +# Verify prerequisites +# +if (NOT $ENV{${WindowsSDKVersion}}) + message (FATAL_ERROR "WindowsSDKVersion environment variable not found") +endif () -# set the output path for `powershell.exe` -set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_SOURCE_DIR}/../Microsoft.PowerShell.ConsoleHost") +if (NOT $ENV{${Platform}}) + message(FATAL_ERROR "Platform environment variable not found") +else () + SET(WindowsSDKPlatform "$ENV{Platform}") +endif () + +# +# Get the path to the Windows SDK build tools. +# +if (WindowsSDKPlatform STREQUAL "x64" OR WindowsSDKPlatform STREQUAL "X64" OR WindowsSDKPlatform STREQUAL "amd64" OR WindowsSDKPlatform STREQUAL "AMD64") + # Normalize the platform name + SET(WindowsSDKPlatform "x64") +elseif (WindowsSDKPlatform STREQUAL "x86" OR WindowsSDKPlatform STREQUAL "X86") + # Normalize the platform name + SET(WindowsSDKPlatform "x86") +else() + message(FATAL_ERROR "Unsupported WindowsSDKPlatform ${WindowsSDKPlatform}") +endif () + +# +# set the output path for all binaries +# +if (BUILD_ONECORE) + set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_SOURCE_DIR}/Bin/CoreClr") +else () + set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_SOURCE_DIR}/Bin/FullClr") +endif (BUILD_ONECORE) foreach(OUTPUTCONFIG ${CMAKE_CONFIGURATION_TYPES}) string(TOUPPER ${OUTPUTCONFIG} OUTPUTCONFIG) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_${OUTPUTCONFIG} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}) + message(" Setting output directory for ${OUTPUTCONFIG} to ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}") endforeach( OUTPUTCONFIG CMAKE_CONFIGURATION_TYPES ) +# +# Definitions for ease of reading +# +SET (WIN_VERSION_WIN10_RS1 0x0A000002) +SET (WIN_VERSION_WIN10_TH2 0x0A000001) +SET (WIN_VERSION_WIN10 0x0A00) +SET (WIN_VERSION_WINTHRESHOLD 0x0A00) +SET (WIN_VERSION_WINBLUE 0x0603) +SET (WIN_VERSION_WIN8 0x0602) +SET (WIN_VERSION_WIN7 0x0601) +SET (NTDDI_VERSION_WIN7 0x06010000) +SET (WIN_VERSION_VISTA 0x0600) +SET (WIN_VERSION_LONGHORN 0x0600) +SET (WIN_VERSION_WS03 0x0502) +SET (WIN_VERSION_WINXP 0x0501) + +# *** +# *** Original flags: BEGIN +# *** # # TODO: Will this interfere with OneCore compilations? # # set these flags, so build does static linking for msvcr120.dll # otherwise this dll need to be present on the system -set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MT") -set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MTd") +#set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MT") +#set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MTd") # Compiler flags that are universal to all powershell native binaries -SET(common_pwrsh_definitions - UNICODE - _UNICODE) +#SET(common_pwrsh_definitions +# UNICODE +# _UNICODE) + +#set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /VERBOSE") + +# *** +# *** Original flags: END +# *** + +# *** +# *** CoreCLR flags: BEGIN +# *** + +set(CMAKE_CXX_STANDARD_LIBRARIES "") # do not link against standard win32 libs i.e. kernel32, uuid, user32, etc. + +#if(NOT CLR_CMAKE_PLATFORM_ARCH_ARM64) + set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /guard:cf") + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /guard:cf") +#endif (NOT CLR_CMAKE_PLATFORM_ARCH_ARM64) + +# Incremental linking with CFG is broken until next VS release. +# This needs to be appended to the last for each build type to override the default flag. +set(NO_INCREMENTAL_LINKER_FLAGS "/INCREMENTAL:NO") + +# Linker flags +# +# Disable the following line for UNIX altjit on Windows +set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /MANIFEST:NO") #Do not create Side-by-Side Assembly Manifest +set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /SUBSYSTEM:WINDOWS,6.00") #windows subsystem +set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /LARGEADDRESSAWARE") # can handle addresses larger than 2 gigabytes +set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /RELEASE") #sets the checksum in the header +set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /NXCOMPAT") #Compatible with Data Execution Prevention +set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /DYNAMICBASE") #Use address space layout randomization +#set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /DEBUGTYPE:cv,fixup") #debugging format +set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /PDBCOMPRESS") #shrink pdb size +set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /DEBUG") + +# +# TODO: Should these be ignored???? +# +#set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /IGNORE:4197,4013,4254,4070,4221") +#set(CMAKE_STATIC_LINKER_FLAGS "${CMAKE_STATIC_LINKER_FLAGS} /IGNORE:4221") + +set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /DEBUG /PDBCOMPRESS") +#set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /STACK:1572864") + +# Debug build specific flags +#set(CMAKE_SHARED_LINKER_FLAGS_DEBUG "/NOVCFEATURE ${NO_INCREMENTAL_LINKER_FLAGS}") +set(CMAKE_SHARED_LINKER_FLAGS_DEBUG "${NO_INCREMENTAL_LINKER_FLAGS}") +set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${NO_INCREMENTAL_LINKER_FLAGS}") + +# Checked build specific flags +#set(CMAKE_SHARED_LINKER_FLAGS_CHECKED "${CMAKE_SHARED_LINKER_FLAGS_CHECKED} /OPT:REF /OPT:NOICF /NOVCFEATURE ${NO_INCREMENTAL_LINKER_FLAGS}") +#set(CMAKE_STATIC_LINKER_FLAGS_CHECKED "${CMAKE_STATIC_LINKER_FLAGS_CHECKED}") +#set(CMAKE_EXE_LINKER_FLAGS_CHECKED "${CMAKE_EXE_LINKER_FLAGS_CHECKED} /OPT:REF /OPT:NOICF ${NO_INCREMENTAL_LINKER_FLAGS}") + +# Release build specific flags +#set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} /LTCG /OPT:REF /OPT:ICF ${NO_INCREMENTAL_LINKER_FLAGS}") +#set(CMAKE_STATIC_LINKER_FLAGS_RELEASE "${CMAKE_STATIC_LINKER_FLAGS_RELEASE} /LTCG") +#set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /LTCG /OPT:REF /OPT:ICF ${NO_INCREMENTAL_LINKER_FLAGS}") + +# ReleaseWithDebugInfo build specific flags +#set(CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO} /LTCG /OPT:REF /OPT:ICF ${NO_INCREMENTAL_LINKER_FLAGS}") +#set(CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO} /LTCG") +#set(CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO} /LTCG /OPT:REF /OPT:ICF ${NO_INCREMENTAL_LINKER_FLAGS}") + +# Temporary until cmake has VS generators for arm64 +#if(CLR_CMAKE_PLATFORM_ARCH_ARM64) +# set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /machine:arm64") +# set(CMAKE_STATIC_LINKER_FLAGS "${CMAKE_STATIC_LINKER_FLAGS} /machine:arm64") +# set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /machine:arm64") +#endif(CLR_CMAKE_PLATFORM_ARCH_ARM64) + +# Force uCRT to be dynamically linked for Release build +#set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} /NODEFAULTLIB:libucrt.lib /DEFAULTLIB:ucrt.lib") +#set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /NODEFAULTLIB:libucrt.lib /DEFAULTLIB:ucrt.lib") +#set(CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO} /NODEFAULTLIB:libucrt.lib /DEFAULTLIB:ucrt.lib") +#set(CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO} /NODEFAULTLIB:libucrt.lib /DEFAULTLIB:ucrt.lib") + +#------------------------------------ +# Definitions (for platform) +#----------------------------------- +#if (CLR_CMAKE_PLATFORM_ARCH_AMD64) + add_definitions(-D_AMD64_) + add_definitions(-D_WIN64) + add_definitions(-DAMD64) + add_definitions(-DBIT64=1) +#elseif (CLR_CMAKE_PLATFORM_ARCH_I386) +# add_definitions(-D_X86_) +#elseif (CLR_CMAKE_PLATFORM_ARCH_ARM) +# add_definitions(-D_ARM_) +# add_definitions(-DARM) +#elseif (CLR_CMAKE_PLATFORM_ARCH_ARM64) +# add_definitions(-D_ARM64_) +# add_definitions(-DARM64) +# add_definitions(-D_WIN64) +# add_definitions(-DBIT64=1) +#else () +# clr_unknown_arch() +#endif () + +# Define the CRT lib references that link into Desktop imports +set(STATIC_MT_CRT_LIB "libcmt$<$,$>:d>.lib") +set(STATIC_MT_VCRT_LIB "libvcruntime$<$,$>:d>.lib") +set(STATIC_MT_CPP_LIB "libcpmt$<$,$>:d>.lib") + +# Define the uCRT lib reference +set(STATIC_UCRT_LIB "libucrt$<$,$>:d>.lib") +set(DYNAMIC_UCRT_LIB "ucrt$<$,$>:d>.lib") + +#------------------------------------ +# Definitions for compile +#----------------------------------- + +add_compile_options(/Zl) # omit default library name in .OBJ + +# The following options are set by the razzle build +add_compile_options(/TP) # compile all files as C++ +add_compile_options(/d2Zi+) # make optimized builds debugging easier +add_compile_options(/nologo) # Suppress Startup Banner +add_compile_options(/W3) # set warning level to 3 +#add_compile_options(/WX) # treat warnings as errors +add_compile_options(/Oi) # enable intrinsics +add_compile_options(/Oy-) # disable suppressing of the creation of frame pointers on the call stack for quicker function calls +#add_compile_options(/U_MT) # undefine the predefined _MT macro +add_compile_options(/GF) # enable read-only string pooling +add_compile_options(/Gm-) # disable minimal rebuild +add_compile_options(/EHa) # enable C++ EH (w/ SEH exceptions) +add_compile_options(/Zp8) # pack structs on 8-byte boundary +add_compile_options(/Gy) # separate functions for linker +add_compile_options(/Zc:wchar_t-) # C++ language conformance: wchar_t is NOT the native type, but a typedef +add_compile_options(/Zc:forScope) # C++ language conformance: enforce Standard C++ for scoping rules +add_compile_options(/GR-) # disable C++ RTTI +add_compile_options(/FC) # use full pathnames in diagnostics +#add_compile_options(/MP) # Build with Multiple Processes (number of processes equal to the number of processors) +add_compile_options(/GS) # Buffer Security Check +add_compile_options(/Zm200) # Specify Precompiled Header Memory Allocation Limit of 150MB +add_compile_options(/wd4960 /wd4961 /wd4603 /wd4627 /wd4838 /wd4456 /wd4457 /wd4458 /wd4459 /wd4091 /we4640) +add_compile_options(/Zi) # enable debugging information +add_compile_options(/ZH:SHA_256) # use SHA256 for generating hashes of compiler processed source files. + +#if (CLR_CMAKE_PLATFORM_ARCH_I386) +# add_compile_options(/Gz) +#endif (CLR_CMAKE_PLATFORM_ARCH_I386) + +add_compile_options($<$,$>:/GL>) +add_compile_options($<$,$>,$>:/O1>) + +#if (CLR_CMAKE_PLATFORM_ARCH_AMD64) +# The generator expression in the following command means that the /homeparams option is added only for debug builds + add_compile_options($<$:/homeparams>) # Force parameters passed in registers to be written to the stack +#endif (CLR_CMAKE_PLATFORM_ARCH_AMD64) + +# enable control-flow-guard support for native components for non-Arm64 builds +add_compile_options(/guard:cf) + +# Statically linked CRT (libcmt[d].lib, libvcruntime[d].lib and libucrt[d].lib) by default. This is done to avoid +# linking in VCRUNTIME140.DLL for a simplified xcopy experience by reducing the dependency on VC REDIST. +# +# For Release builds, we shall dynamically link into uCRT [ucrtbase.dll] (which is pushed down as a Windows Update on downlevel OS) but +# wont do the same for debug/checked builds since ucrtbased.dll is not redistributable and Debug/Checked builds are not +# production-time scenarios. +add_compile_options($<$,$>:/MT>) +add_compile_options($<$,$>:/MTd>) + +set(CMAKE_ASM_MASM_FLAGS "${CMAKE_ASM_MASM_FLAGS} /ZH:SHA_256") + +#if (CLR_CMAKE_TARGET_ARCH_AMD64) + add_definitions(-D_TARGET_AMD64_=1) + add_definitions(-DDBG_TARGET_64BIT=1) + add_definitions(-DDBG_TARGET_AMD64=1) + add_definitions(-DDBG_TARGET_WIN64=1) +#elseif (CLR_CMAKE_TARGET_ARCH_ARM) +# add_definitions(-D_TARGET_ARM_=1) +# add_definitions(-DDBG_TARGET_32BIT=1) +# add_definitions(-DDBG_TARGET_ARM=1) +#elseif (CLR_CMAKE_TARGET_ARCH_I386) +# add_definitions(-D_TARGET_X86_=1) +# add_definitions(-DDBG_TARGET_32BIT=1) +# add_definitions(-DDBG_TARGET_X86=1) +#else () +# clr_unknown_arch() +#endif (CLR_CMAKE_TARGET_ARCH_AMD64) + +# +# TODO: Are these needed??????????? +# +#add_definitions(-D_BLD_CLR) +#add_definitions(-DDEBUGGING_SUPPORTED) +#add_definitions(-DPROFILING_SUPPORTED) + +add_definitions(-DWIN32) +add_definitions(-D_WIN32) +add_definitions(-DWINVER=${WIN_VERSION_WIN7})# 0x0601 for Win7, was 0x0602 +add_definitions(-D_WIN32_WINNT=${WIN_VERSION_WIN7}) # 0x0601 for Win7 +add_definitions(-DWIN32_LEAN_AND_MEAN=1) +add_definitions(-D_CRT_SECURE_NO_WARNINGS) +#if(CLR_CMAKE_TARGET_ARCH_AMD64 OR CLR_CMAKE_TARGET_ARCH_I386) + # Only enable edit and continue on windows x86 and x64 + # exclude Linux, arm & arm64 + add_definitions(-DEnC_SUPPORTED) +#endif(CLR_CMAKE_TARGET_ARCH_AMD64 OR CLR_CMAKE_TARGET_ARCH_I386) + +add_definitions(-DUNICODE) +add_definitions(-D_UNICODE) + +# *** +# *** CoreCLR flags: END +# *** + +# *** +# *** DSC flags: BEGIN +# *** + + +SET (WindowsSdkDir $ENV{WindowsSdkDir}) +SET (WindowsSDKVersion $ENV{WindowsSDKVersion}) +SET (NETFXSdkDir $ENV{NETFXSDKDir}) +#SET (FrameWorkLibPath $ENV{FrameworkDir}/$ENV{FrameworkVersion}) + +# +# Configure include directories +# +SET (WindowsSDKIncludeBase "${WindowsSdkDir}/Include/${WindowsSDKVersion}") + +SET (IncludePath) +#list (APPEND IncludePath "${INTERNAL_HEADER_DIR}") +#list (APPEND IncludePath "${PUBLIC_HEADER_DIR}") +list (APPEND IncludePath "${WindowsSDKIncludeBase}winrt") +# Don't include due to incompatible instance.h +# list (APPEND IncludePath "${WindowsSDKIncludeBase}um") +list (APPEND IncludePath "${WindowsSDKIncludeBase}shared") +list (APPEND IncludePath "${NETFXSdkDir}/Include/um") +list (APPEND IncludePath "${WindowsSDKIncludeBase}ucrt") +include_directories(BEFORE ${IncludePath}) + +# +# Configure lib directories +# +SET (WindowsSDKLibBase "${WindowsSdkDir}/Lib/${WindowsSDKVersion}") + +SET (LibraryPath) +list (APPEND LibraryPath "${WindowsSDKLibBase}ucrt/${WindowsSDKPlatform}") +list (APPEND LibraryPath "${NETFXSdkDir}lib/um/${WindowsSDKPlatform}") +list (APPEND LibraryPath "${WindowsSDKLibBase}um/${WindowsSDKPlatform}" ) +list (APPEND LibraryPath "${INTERNAL_LIBRARY_DIR}") +list (APPEND LibraryPath "${PUBLIC_LIBRARY_DIR}") +#list (APPEND LibraryPath ${FrameWorkLibPath}) +SET (WindowsSDKLibBase "${WindowsSdkDir}/Lib/${WindowsSDKVersion}") +link_directories(${LibraryPath}) + +#if (${WindowsSDKPlatform} STREQUAL "x64") +# add_definitions ( +# -D_WIN64 +# -D_AMD64_ +# -DAMD64 +# -DBUILD_WOW64_ENABLED=1 +# -DBUILD_UMS_ENABLED=1 +# ) +#else() +# add_definitions ( +# -DBUILD_WOW64_ENABLED=1 +# -DBUILD_UMS_ENABLED=0 +# ) +#endif() + +# +# Common defines. +# +#add_definitions ( +# -D_CRT_SECURE_NO_WARNINGS +# -DCONDITION_HANDLING=1 +# -DNT_UP=1 +# -DNT_INST=0 +# -D_NT1X_=100 +# -DWINNT=1 +# -DWIN32_LEAN_AND_MEAN=1 +# -DDEVL=1 +# -D_MT=1 +# -D_STL70_ +# -DMI_INTERNAL +# -DWINBUILD +# -DHOOK_BUILD # TODO: should be target specific +# -DCONFIG_ENABLE_WCHAR +# -D_INTLSTR_NOTAPPEND_NULL +# -DMSC_NOOPT +# -DBUILD_WINDOWS +# -D_USE_DECLSPECS_FOR_SAL=1 +# -DUNICODE +# -D_UNICODE +# -D_USE_DEV11_CRT +#) + +# +# platform specific defines +# +#add_definitions( +# -DNTDDI_VERSION=${NTDDI_VERSION_WIN7} +# -DWINBLUE_KBSPRING14 +# -D_APISET_WINDOWS_VERSION=${WIN_VERSION_WIN7} +# -D_APISET_MINWIN_VERSION=0x0100 +# -D_APISET_MINCORE_VERSION=0x0100 +# -D_WIN32_IE=0x0800 +# -D_WIN32_WINNT=${WIN_VERSION_WIN7} +# -DWINVER=${WIN_VERSION_WIN7} +# ) + +# *** +# *** DSC flags: END +# *** # Default of BUILD_ONECORE should be ON once it is supported option(BUILD_ONECORE "Compile the OneCore version of the binaries" OFF) @@ -34,5 +392,7 @@ add_subdirectory(nativemsh/pwrshcommon) add_subdirectory(nativemsh/pwrshplugin) # Build powershell.exe -add_subdirectory(nativemsh/pwrshexe) - +if (NOT BUILD_ONECORE) + # Conditionally build powershell.exe until CssMainEntry.cpp appears. + add_subdirectory(nativemsh/pwrshexe) +endif () diff --git a/src/powershell-native/nativemsh/pwrshcommon/CMakeLists.txt b/src/powershell-native/nativemsh/pwrshcommon/CMakeLists.txt index 947ab92c5..0330f7f48 100644 --- a/src/powershell-native/nativemsh/pwrshcommon/CMakeLists.txt +++ b/src/powershell-native/nativemsh/pwrshcommon/CMakeLists.txt @@ -9,14 +9,21 @@ add_library(pwrshcommon target_include_directories(pwrshcommon PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) if (BUILD_ONECORE) + message("Building OneCore version of pwrshcommon.lib") # Libraries to use when creating this binary for Windows on OneCore-based SKUs set(PWRSHCOMMON_WINDOWS_LIBS onecore.lib) set(pwrshcommon_definitions ${common_pwrsh_definitions} CORECLR) -else () # !BUILD_ONECORE +else () # NOT BUILD_ONECORE + message("Building Full version of pwrshcommon.lib") # Libraries to use when creating this binary for Windows on full SKUs # Note: The appropriate libs get added automatically by VS set(PWRSHCOMMON_WINDOWS_LIBS + # CoreCLR libs + ${STATIC_MT_CRT_LIB} + ${STATIC_MT_VCRT_LIB} + ${STATIC_UCRT_LIB} + # # ole32.lib # oleaut32.lib # uuid.lib diff --git a/src/powershell-native/nativemsh/pwrshcommon/ClrHostWrapper.h b/src/powershell-native/nativemsh/pwrshcommon/ClrHostWrapper.h index 861581cc5..54082ca9c 100644 --- a/src/powershell-native/nativemsh/pwrshcommon/ClrHostWrapper.h +++ b/src/powershell-native/nativemsh/pwrshcommon/ClrHostWrapper.h @@ -245,6 +245,7 @@ namespace NativeMsh // The path to the directory that CoreCLR is in char m_coreCLRDirectoryPath[MAX_PATH]; + wchar_t m_coreCLRDirectoryPathW[MAX_PATH]; public: @@ -333,6 +334,25 @@ namespace NativeMsh if (hostClrPath) { ::ExpandEnvironmentStringsA(hostClrPath, m_coreCLRDirectoryPath, MAX_PATH); + + // Generate the wide version of the string and save its value; + // + // This is a two call function. The first call is to get the necessary length. + // The second call is to perform the actual operation. + int length = MultiByteToWideChar(CP_UTF8, 0, m_coreCLRDirectoryPath, -1, NULL, 0); + if (0 < length) + { + LPWSTR result = new wchar_t[length]; + if (NULL != result) + { + length = ::MultiByteToWideChar(CP_UTF8, 0, m_coreCLRDirectoryPath, -1, result, length); + if (0 < length) + { + wcscpy_s(m_coreCLRDirectoryPathW, MAX_PATH, result); + } + delete[] result; // Free the allocated string to avoid a memory leak + } + } } } @@ -341,5 +361,11 @@ namespace NativeMsh { return m_coreCLRDirectoryPath; } + + // Returns the directory path of the host module + PCWSTR GetCoreCLRDirectoryPathW() + { + return m_coreCLRDirectoryPathW; + } }; } // namespace NativeMsh diff --git a/src/powershell-native/nativemsh/pwrshcommon/SystemCallFacade.h b/src/powershell-native/nativemsh/pwrshcommon/SystemCallFacade.h index 97dcfa194..c44d6a314 100644 --- a/src/powershell-native/nativemsh/pwrshcommon/SystemCallFacade.h +++ b/src/powershell-native/nativemsh/pwrshcommon/SystemCallFacade.h @@ -48,7 +48,8 @@ namespace NativeMsh _In_ HMODULE hModule) = 0; // File Manipulation Wrappers - virtual FILE* fopen( + virtual errno_t fopen_s( + FILE** file, const char *filename, const char *mode) = 0; diff --git a/src/powershell-native/nativemsh/pwrshcommon/WinSystemCallFacade.cpp b/src/powershell-native/nativemsh/pwrshcommon/WinSystemCallFacade.cpp index 9f49a43d5..0c61d5bf6 100644 --- a/src/powershell-native/nativemsh/pwrshcommon/WinSystemCallFacade.cpp +++ b/src/powershell-native/nativemsh/pwrshcommon/WinSystemCallFacade.cpp @@ -53,11 +53,12 @@ namespace NativeMsh return ::FreeLibrary(hModule); } - FILE* WinSystemCallFacade::fopen( + errno_t WinSystemCallFacade::fopen_s( + FILE** file, const char *filename, const char *mode) { - return ::fopen(filename, mode); + return ::fopen_s(file, filename, mode); } int WinSystemCallFacade::fclose( diff --git a/src/powershell-native/nativemsh/pwrshcommon/WinSystemCallFacade.h b/src/powershell-native/nativemsh/pwrshcommon/WinSystemCallFacade.h index 1ec4379e8..76ecf01f3 100644 --- a/src/powershell-native/nativemsh/pwrshcommon/WinSystemCallFacade.h +++ b/src/powershell-native/nativemsh/pwrshcommon/WinSystemCallFacade.h @@ -46,7 +46,8 @@ namespace NativeMsh _In_ HMODULE hModule); // File Manipulation Wrappers - virtual FILE* fopen( + virtual errno_t fopen_s( + FILE** file, const char *filename, const char *mode); diff --git a/src/powershell-native/nativemsh/pwrshcommon/pwrshcommon.cpp b/src/powershell-native/nativemsh/pwrshcommon/pwrshcommon.cpp index 5d1229e32..daf3661e8 100644 --- a/src/powershell-native/nativemsh/pwrshcommon/pwrshcommon.cpp +++ b/src/powershell-native/nativemsh/pwrshcommon/pwrshcommon.cpp @@ -868,11 +868,13 @@ namespace NativeMsh bool PwrshCommon::DoesAssemblyExist( std::string& fileToTest) { - FILE *file = sysCalls->fopen(fileToTest.c_str(), "r"); // TODO: Use fopen_s? + //FILE *file = sysCalls->fopen(fileToTest.c_str(), "r"); // TODO: Use fopen_s? + FILE *file = NULL; + errno_t status = sysCalls->fopen_s(&file, fileToTest.c_str(), "r"); if (file != NULL) { sysCalls->fclose(file); - return true; + return (status == 0); } return false; } diff --git a/src/powershell-native/nativemsh/pwrshexe/CMakeLists.txt b/src/powershell-native/nativemsh/pwrshexe/CMakeLists.txt index dc339562e..43aed8b47 100644 --- a/src/powershell-native/nativemsh/pwrshexe/CMakeLists.txt +++ b/src/powershell-native/nativemsh/pwrshexe/CMakeLists.txt @@ -1,24 +1,38 @@ # # Builds PowerShell.exe, the native host for PowerShell. # + +# Only build powershell.exe for "full" windows. Open PowerShell uses the managed executable. if (BUILD_ONECORE) + message("*") + message("*********** Building PowerShell.exe for 'full' CLR instead of OneCore. Add CssMainEntry.cpp") + message("*") + #set(BUILD_ONECORE OFF) +endif () + +#if (BUILD_ONECORE) # Settings to use when creating PowerShell.exe for Windows on OneCore-based SKUs - set(PWRSHEXE_WINDOWS_SOURCES +# set(PWRSHEXE_WINDOWS_SOURCES # TODO: Fix this once the file is migrated from SD # CssMainEntry.cpp) - MainEntry.cpp) - set(PWRSHEXE_WINDOWS_LIBS - onecore.lib) - set(powershell_definitions - _CONSOLE - CORECLR - ${common_pwrsh_definitions}) -else (BUILD_ONECORE) +# MainEntry.cpp) +# set(PWRSHEXE_WINDOWS_LIBS +# onecore.lib) +# set(powershell_definitions +# _CONSOLE +# CORECLR +# ${common_pwrsh_definitions}) +#else (BUILD_ONECORE) # Settings to use when creating PowerShell.exe for Windows on full SKUs or downlevel platforms set(PWRSHEXE_WINDOWS_SOURCES MainEntry.cpp) # Most libs are automatically added by VS set(PWRSHEXE_WINDOWS_LIBS + # CoreCLR libs + ${STATIC_MT_CRT_LIB} + ${STATIC_MT_VCRT_LIB} + ${STATIC_UCRT_LIB} + # # ole32.lib # oleaut32.lib # uuid.lib @@ -26,11 +40,12 @@ else (BUILD_ONECORE) MUILoad.lib msxml6.lib mscoree.lib + legacy_stdio_definitions.lib # Resolves: LNK2019: unresolved external symbol _vsnwprintf ) set(powershell_definitions _CONSOLE ${common_pwrsh_definitions}) -endif (BUILD_ONECORE) +#endif (BUILD_ONECORE) add_executable(powershell ${PWRSHEXE_WINDOWS_SOURCES}) diff --git a/src/powershell-native/nativemsh/pwrshplugin/CMakeLists.txt b/src/powershell-native/nativemsh/pwrshplugin/CMakeLists.txt index 817dceac2..03449bc2b 100644 --- a/src/powershell-native/nativemsh/pwrshplugin/CMakeLists.txt +++ b/src/powershell-native/nativemsh/pwrshplugin/CMakeLists.txt @@ -1,7 +1,7 @@ # # Builds pwrshplugin.dll, the WinRM plugin for PowerShell remote hosting. # -add_library(pwrshplugin +add_library(pwrshplugin SHARED entrypoints.cpp pwrshclrhost.cpp pwrshpluginerrorcodes.mc @@ -9,26 +9,42 @@ add_library(pwrshplugin pwrshplugin.def) if (BUILD_ONECORE) + message("*") + message("* Setting up BUILD_ONECORE version of pwrshplugin.dll") + message("*") # Libraries to use when creating this binary for Windows on OneCore-based SKUs set(PWRSHPLUGIN_WINDOWS_LIBS - onecore.lib) + ${STATIC_MT_CRT_LIB} + ${STATIC_MT_VCRT_LIB} + ${STATIC_UCRT_LIB} + wsmsvc.lib) set(pwrshplugin_definitions ${common_pwrsh_definitions} CORECLR) -else (BUILD_ONECORE) +else () + message("*") + message("* Setting up NOT BUILD_ONECORE version of pwrshplugin.dll") + message("*") # Libraries to use when creating this binary for Windows on full SKUs set(PWRSHPLUGIN_WINDOWS_LIBS - ntdll.lib - kernel32.lib - advapi32.lib - ole32.lib +# ntdll.lib +# kernel32.lib +# advapi32.lib +# ole32.lib MUILoad.lib mscoree.lib - oleaut32.lib - uuid.lib - wsmsvc.lib) +# oleaut32.lib +# uuid.lib + wsmsvc.lib + # CoreCLR libs + ${STATIC_MT_CRT_LIB} + ${STATIC_MT_VCRT_LIB} + ${STATIC_UCRT_LIB} + legacy_stdio_definitions.lib # Resolves: LNK2019: unresolved external symbol _vsnwprintf + ) set(pwrshplugin_definitions ${common_pwrsh_definitions}) endif (BUILD_ONECORE) set_target_properties(pwrshplugin PROPERTIES COMPILE_DEFINITIONS "${pwrshplugin_definitions}") +#set_target_properties(pwrshplugin PROPERTIES COMPILE_DEFINITIONS "_DLL") target_link_libraries(pwrshplugin ${PWRSHPLUGIN_WINDOWS_LIBS}) diff --git a/src/powershell-native/nativemsh/pwrshplugin/pwrshclrhost.cpp b/src/powershell-native/nativemsh/pwrshplugin/pwrshclrhost.cpp index 533b0efe4..8c0d5890e 100644 --- a/src/powershell-native/nativemsh/pwrshplugin/pwrshclrhost.cpp +++ b/src/powershell-native/nativemsh/pwrshplugin/pwrshclrhost.cpp @@ -60,7 +60,8 @@ unsigned int PowerShellCoreClrWorker::LoadWorkerCallbackPtrs( "Microsoft.PowerShell.CoreCLR.AssemblyLoadContext, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35", "System.Management.Automation.PowerShellAssemblyLoadContextInitializer", "SetPowerShellAssemblyLoadContext", - (INT_PTR*)&initDelegate); + //(INT_PTR*)&initDelegate); + (void**)&initDelegate); if (FAILED(hr)) { @@ -80,7 +81,7 @@ unsigned int PowerShellCoreClrWorker::LoadWorkerCallbackPtrs( "System.Management.Automation, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35", "System.Management.Automation.Remoting.WSManPluginManagedEntryWrapper", "InitPlugin", - (INT_PTR*)&entryPointDelegate); + (void**)&entryPointDelegate); if (FAILED(hr)) { output->DisplayMessage(false, g_CREATING_MSH_ENTRANCE_FAILED, hr); @@ -232,7 +233,7 @@ PowerShellClrWorker::~PowerShellClrWorker() unsigned int PowerShellClrWorker::LaunchClr( _In_ LPCWSTR wszMonadVersion, _In_ LPCWSTR wszRuntimeVersion, - _In_ LPCWSTR friendlyName) + _In_ LPCSTR friendlyName) { return commonLib.LaunchCLR(wszMonadVersion, wszRuntimeVersion, &pHost); } @@ -303,7 +304,7 @@ unsigned int PowerShellClrWorker::LoadWorkerCallbackPtrs( unsigned int PowerShellClrManagedWorker::LaunchClr( _In_ LPCWSTR wszMonadVersion, _In_ LPCWSTR wszRuntimeVersion, - _In_ LPCWSTR friendlyName) + _In_ LPCSTR friendlyName) { return commonLib.LaunchCLR(wszMonadVersion, wszRuntimeVersion, &pHost); } diff --git a/src/powershell-native/nativemsh/pwrshplugin/pwrshclrhost.h b/src/powershell-native/nativemsh/pwrshplugin/pwrshclrhost.h index 82852c4e4..cef2d1c1c 100644 --- a/src/powershell-native/nativemsh/pwrshplugin/pwrshclrhost.h +++ b/src/powershell-native/nativemsh/pwrshplugin/pwrshclrhost.h @@ -47,7 +47,7 @@ public: virtual unsigned int LaunchClr( _In_ LPCWSTR wszMonadVersion, _In_ LPCWSTR wszRuntimeVersion, - _In_ LPCWSTR friendlyName) = 0; + _In_ LPCSTR friendlyName) = 0; virtual unsigned int LoadWorkerCallbackPtrs( _In_ PwrshPluginWkr_Ptrs* workerCallbackPtrs, @@ -90,7 +90,7 @@ public: virtual unsigned int LaunchClr( _In_ LPCWSTR wszMonadVersion, _In_ LPCWSTR wszRuntimeVersion, - _In_ LPCWSTR friendlyName); + _In_ LPCSTR friendlyName); virtual unsigned int LoadWorkerCallbackPtrs( _In_ PwrshPluginWkr_Ptrs* workerCallbackPtrs, @@ -117,7 +117,7 @@ public: virtual unsigned int LaunchClr( _In_ LPCWSTR wszMonadVersion, _In_ LPCWSTR wszRuntimeVersion, - _In_ LPCWSTR friendlyName); + _In_ LPCSTR friendlyName); virtual unsigned int LoadWorkerCallbackPtrs( _In_ PwrshPluginWkr_Ptrs* workerCallbackPtrs, @@ -146,15 +146,16 @@ public: virtual ~PowerShellCoreClrWorker(); - std::wstring GetHostDirectory() { return std::wstring(hostEnvironment.GetHostDirectoryPath()); } - std::wstring GetClrDirectory() { return std::wstring(hostEnvironment.GetCoreCLRDirectoryPath()); } + std::wstring GetHostDirectory() { return std::wstring(hostEnvironment.GetHostDirectoryPathW()); } + std::wstring GetClrDirectory() { return std::wstring(hostEnvironment.GetCoreCLRDirectoryPathW()); } // // IPowerShellClrHost Methods // virtual unsigned int LaunchClr( _In_ LPCWSTR wszMonadVersion, - _In_ LPCWSTR wszRuntimeVersion); + _In_ LPCWSTR wszRuntimeVersion, + _In_ LPCSTR friendlyName); virtual unsigned int LoadWorkerCallbackPtrs( _In_ PwrshPluginWkr_Ptrs* workerCallbackPtrs, diff --git a/src/powershell-native/nativemsh/pwrshplugin/pwrshplugin.h b/src/powershell-native/nativemsh/pwrshplugin/pwrshplugin.h index 6a45f248b..16efa0f3d 100644 --- a/src/powershell-native/nativemsh/pwrshplugin/pwrshplugin.h +++ b/src/powershell-native/nativemsh/pwrshplugin/pwrshplugin.h @@ -714,7 +714,7 @@ private: break; } - exitCode = powerShellClrHost->LaunchClr(wszMonadVersion, wszTempCLRVersion, L"PwrshPlugin"); + exitCode = powerShellClrHost->LaunchClr(wszMonadVersion, wszTempCLRVersion, "PwrshPlugin"); if (EXIT_CODE_SUCCESS != exitCode) { PWSTR msg = NULL; diff --git a/src/powershell-native/windows-compiler-override.txt b/src/powershell-native/windows-compiler-override.txt new file mode 100644 index 000000000..f6cb16856 --- /dev/null +++ b/src/powershell-native/windows-compiler-override.txt @@ -0,0 +1,16 @@ +SET (CMAKE_C_FLAGS_INIT "/Wall /FC") +SET (CMAKE_C_FLAGS_DEBUG_INIT "/Od /Zi") +SET (CLR_C_FLAGS_CHECKED_INIT "/O1 /Zi") +SET (CMAKE_C_FLAGS_RELEASE_INIT "/Ox /Zi") +SET (CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "/O2 /Zi") + +SET (CMAKE_CXX_FLAGS_INIT "/Wall /FC") +SET (CMAKE_CXX_FLAGS_DEBUG_INIT "/Od /Zi") +SET (CLR_CXX_FLAGS_CHECKED_INIT "/O1 /Zi") +SET (CMAKE_CXX_FLAGS_RELEASE_INIT "/Ox /Zi") +SET (CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "/O2 /Zi") + +SET (CLR_DEFINES_DEBUG_INIT DEBUG _DEBUG _DBG URTBLDENV_FRIENDLY=Checked BUILDENV_CHECKED=1) +SET (CLR_DEFINES_CHECKED_INIT DEBUG _DEBUG _DBG URTBLDENV_FRIENDLY=Checked BUILDENV_CHECKED=1) +SET (CLR_DEFINES_RELEASE_INIT NDEBUG URTBLDENV_FRIENDLY=Retail) +SET (CLR_DEFINES_RELWITHDEBINFO_INIT NDEBUG URTBLDENV_FRIENDLY=Retail) \ No newline at end of file