Add support to build x86 packages for PowerShell Core

This commit is contained in:
Mike Richmond 2016-11-14 13:04:33 -08:00 committed by Dongbo Wang
parent 285f2bfbe2
commit 81b2339979
3 changed files with 18 additions and 15 deletions

View File

@ -75,6 +75,7 @@ function Start-PSBuild {
"debian.8-x64",
"centos.7-x64",
"win7-x64",
"win7-x86",
"win81-x64",
"win10-x64",
"osx.10.11-x64")]
@ -87,7 +88,6 @@ function Start-PSBuild {
[Parameter(ParameterSetName='FullCLR')]
[switch]$XamlGen,
[Parameter(ParameterSetName='FullCLR')]
[ValidateSet('x86', 'x64')] # TODO: At some point, we need to add ARM support to match CoreCLR
[string]$NativeHostArch = "x64",
@ -320,7 +320,7 @@ cmd.exe /C cd /d "$currentLocation" "&" "$($vcVarsPath)\vcvarsall.bat" "$NativeH
$location = Get-Location
$command = @"
cmd.exe /C cd /d "$location" "&" "$($vcVarsPath)\vcvarsall.bat" "$NativeHostArch" "&" cmake "$overrideFlags" -DBUILD_ONECORE=$OneCoreValue -G "$cmakeGenerator" . "&" msbuild ALL_BUILD.vcxproj "/p:Configuration=$msbuildConfiguration"
cmd.exe /C cd /d "$location" "&" "$($vcVarsPath)\vcvarsall.bat" "$NativeHostArch" "&" cmake "$overrideFlags" -DBUILD_ONECORE=$OneCoreValue -DBUILD_TARGET_ARCH=$NativeHostArch -G "$cmakeGenerator" . "&" msbuild ALL_BUILD.vcxproj "/p:Configuration=$msbuildConfiguration"
"@
log " Executing Build Command: $command"
Start-NativeExecution { Invoke-Expression -Command:$command }

View File

@ -9,12 +9,6 @@ if (NOT $ENV{${WindowsSDKVersion}})
message (FATAL_ERROR "WindowsSDKVersion environment variable not found")
endif ()
if (NOT $ENV{${Platform}})
message(FATAL_ERROR "Platform environment variable not found")
else ()
SET(WindowsSDKPlatform "$ENV{Platform}")
endif ()
#
# Normalize the platform name
#
@ -22,6 +16,15 @@ endif ()
#
SET(BUILD_ARCH_ARM 0)
SET(BUILD_ARCH_ARM64 0)
SET(BUILD_ARCH_X86 0)
SET(BUILD_ARCH_AMD64 0)
if (BUILD_TARGET_ARCH)
SET(WindowsSDKPlatform ${BUILD_TARGET_ARCH})
else ()
message(FATAL_ERROR "Target architecture value should be specified through BUILD_TARGET_ARCH. Supported values are x64 or x86.")
endif (BUILD_TARGET_ARCH)
if (WindowsSDKPlatform STREQUAL "x64" OR WindowsSDKPlatform STREQUAL "X64" OR WindowsSDKPlatform STREQUAL "amd64" OR WindowsSDKPlatform STREQUAL "AMD64")
SET(WindowsSDKPlatform "x64")
SET(BUILD_ARCH_AMD64 1)
@ -29,7 +32,7 @@ elseif (WindowsSDKPlatform STREQUAL "x86" OR WindowsSDKPlatform STREQUAL "X86")
SET(WindowsSDKPlatform "x86")
SET(BUILD_ARCH_X86 1)
else()
message(FATAL_ERROR "Unsupported WindowsSDKPlatform ${WindowsSDKPlatform}")
message(FATAL_ERROR "Unsupported WindowsSDKPlatform: " ${WindowsSDKPlatform})
endif ()
#

View File

@ -61,7 +61,7 @@ if (BUILD_ARCH_AMD64)
add_definitions(-D_WIN64)
add_definitions(-DAMD64)
add_definitions(-DBIT64=1)
elseif (BUILD_ARCH_I386)
elseif (BUILD_ARCH_X86)
add_definitions(-D_X86_)
elseif (BUILD_ARCH_ARM)
add_definitions(-D_ARM_)
@ -116,9 +116,9 @@ add_compile_options(/Zm200) # Specify Precompiled Header Memory Allocation Limit
add_compile_options(/Zi) # enable debugging information
add_compile_options(/ZH:SHA_256) # use SHA256 for generating hashes of compiler processed source files.
if (BUILD_ARCH_I386)
if (BUILD_ARCH_X86)
add_compile_options(/Gz)
endif (BUILD_ARCH_I386)
endif (BUILD_ARCH_X86)
add_compile_options($<$<OR:$<CONFIG:Release>,$<CONFIG:Relwithdebinfo>>:/GL>)
add_compile_options($<$<OR:$<OR:$<CONFIG:Release>,$<CONFIG:Relwithdebinfo>>,$<CONFIG:Checked>>:/O1>)
@ -146,7 +146,7 @@ if (BUILD_ARCH_AMD64)
add_definitions(-D_TARGET_AMD64_=1)
elseif (BUILD_ARCH_ARM)
add_definitions(-D_TARGET_ARM_=1)
elseif (BUILD_ARCH_I386)
elseif (BUILD_ARCH_X86)
add_definitions(-D_TARGET_X86_=1)
endif (BUILD_ARCH_AMD64)
@ -157,11 +157,11 @@ add_definitions(-D_WIN32_WINNT=${WIN_VERSION_WIN8})
add_definitions(-DWIN32_LEAN_AND_MEAN=1)
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
if(BUILD_ARCH_AMD64 OR BUILD_ARCH_I386)
if(BUILD_ARCH_AMD64 OR BUILD_ARCH_X86)
# Only enable edit and continue on windows x86 and x64.
# Exclude arm & arm64
add_definitions(-DEnC_SUPPORTED)
endif(BUILD_ARCH_AMD64 OR BUILD_ARCH_I386)
endif(BUILD_ARCH_AMD64 OR BUILD_ARCH_X86)
add_definitions(-DUNICODE)
add_definitions(-D_UNICODE)