Skip to content

Commit

Permalink
Allow building arm64 using VS2017 tools
Browse files Browse the repository at this point in the history
VS2017 now includes ARM64 compilers. Change the build scripts so
that the normal VC tools path is used for the builds for ARM64.
However, if -toolset_dir is passed, then use the specified tools,
as before.
  • Loading branch information
BruceForstall committed Oct 26, 2017
1 parent ea3f140 commit 52ebf91
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 13 deletions.
16 changes: 9 additions & 7 deletions build-test.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ if /i "%1" == "-help" goto Usage
if /i "%1" == "x64" (set __BuildArch=x64&set __VCBuildArch=x86_amd64&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
if /i "%1" == "x86" (set __BuildArch=x86&set __VCBuildArch=x86&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
if /i "%1" == "arm" (set __BuildArch=arm&set __VCBuildArch=x86_arm&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
if /i "%1" == "arm64" (set __BuildArch=arm64&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
if /i "%1" == "arm64" (set __BuildArch=arm64&set __VCBuildArch=x86_arm64&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)

if /i "%1" == "debug" (set __BuildType=Debug&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
if /i "%1" == "release" (set __BuildType=Release&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
Expand Down Expand Up @@ -126,9 +126,11 @@ call "%__VSToolsRoot%\VsDevCmd.bat"

set __RunArgs=-BuildOS=%__BuildOS% -BuildType=%__BuildType% -BuildArch=%__BuildArch%

rem arm64 builds currently use private toolset which has not been released yet
REM TODO, remove once the toolset is open.
if /i "%__BuildArch%" == "arm64" call :PrivateToolSet
if defined __ToolsetDir (
rem arm64 builds currently use private toolset which has not been released yet
REM TODO, remove once the toolset is open.
call :PrivateToolSet
)

echo %__MsgPrefix%Commencing CoreCLR repo test build

Expand Down Expand Up @@ -185,8 +187,8 @@ REM ============================================================================
echo %__MsgPrefix%Commencing build of native test components for %__BuildArch%/%__BuildType%

if defined __ToolsetDir (
echo %__MsgPrefix%ToolsetDir is defined to be :%__ToolsetDir%
goto GenVSSolution :: Private ToolSet is Defined
echo %__MsgPrefix%ToolsetDir is defined to be %__ToolsetDir%
goto GenVSSolution :: Private ToolSet is Defined
)

:: Set the environment for the native build
Expand Down Expand Up @@ -490,7 +492,7 @@ exit /b 1

:PrivateToolSet

echo %__MsgPrefix% Setting Up the usage of __ToolsetDir:%__ToolsetDir%
echo %__MsgPrefix%Setting up the usage of __ToolsetDir:%__ToolsetDir%

if /i "%__ToolsetDir%" == "" (
echo %__MsgPrefix%Error: A toolset directory is required for the Arm64 Windows build. Use the toolset_dir argument.
Expand Down
18 changes: 12 additions & 6 deletions build.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -368,10 +368,10 @@ if %__BuildNative% EQU 1 (

echo %__MsgPrefix%Commencing build of native components for %__BuildOS%.%__BuildArch%.%__BuildType%

set nativePlatfromArgs=-platform=%__BuildArch%
if /i "%__BuildArch%" == "arm64" ( set nativePlatfromArgs=-useEnv )
set __NativePlatformArgs=-platform=%__BuildArch%
if not "%__ToolsetDir%" == "" ( set __NativePlatformArgs=-useEnv )

if /i "%__BuildArch%" == "arm64" (
if not "%__ToolsetDir%" == "" (
rem arm64 builds currently use private toolset which has not been released yet
REM TODO, remove once the toolset is open.
call :PrivateToolSet
Expand All @@ -387,6 +387,12 @@ if %__BuildNative% EQU 1 (
REM Make CMake pick the highest installed version in the 10.0.* range
set ___SDKVersion="-DCMAKE_SYSTEM_VERSION=10.0"
)
if /i "%__BuildArch%" == "arm64" (
set __VCBuildArch=x86_arm64

REM Make CMake pick the highest installed version in the 10.0.* range
set ___SDKVersion="-DCMAKE_SYSTEM_VERSION=10.0"
)

echo %__MsgPrefix%Using environment: "%__VCToolsRoot%\vcvarsall.bat" !__VCBuildArch!
call "%__VCToolsRoot%\vcvarsall.bat" !__VCBuildArch!
Expand Down Expand Up @@ -425,7 +431,7 @@ if %__BuildNative% EQU 1 (
set __MsbuildWrn=/flp1:WarningsOnly;LogFile=!__BuildWrn!
set __MsbuildErr=/flp2:ErrorsOnly;LogFile=!__BuildErr!

@call %__ProjectDir%\run.cmd build -Project=%__IntermediatesDir%\install.vcxproj -MsBuildLog=!__MsbuildLog! -MsBuildWrn=!__MsbuildWrn! -MsBuildErr=!__MsbuildErr! -configuration=%__BuildType% %nativePlatfromArgs% %__RunArgs% -ExtraParameters="/p:ForceImportBeforeCppTargets=%__ProjectDir%/clr.nativebuild.props /m:2" %__UnprocessedBuildArgs%
@call %__ProjectDir%\run.cmd build -Project=%__IntermediatesDir%\install.vcxproj -MsBuildLog=!__MsbuildLog! -MsBuildWrn=!__MsbuildWrn! -MsBuildErr=!__MsbuildErr! -configuration=%__BuildType% %__NativePlatformArgs% %__RunArgs% -ExtraParameters="/p:ForceImportBeforeCppTargets=%__ProjectDir%/clr.nativebuild.props /m:2" %__UnprocessedBuildArgs%

if not !errorlevel! == 0 (
echo %__MsgPrefix%Error: native component build failed. Refer to the build log files for details:
Expand Down Expand Up @@ -665,7 +671,7 @@ if %__BuildTests% EQU 1 (

rem arm64 builds currently use private toolset which has not been released yet
REM TODO, remove once the toolset is open.
if /i "%__BuildArch%" == "arm64" call :PrivateToolSet
if not "%__ToolsetDir%" == "" call :PrivateToolSet

set NEXTCMD=call %__ProjectDir%\build-test.cmd %__BuildArch% %__BuildType% %__UnprocessedBuildArgs%
echo %__MsgPrefix%!NEXTCMD!
Expand Down Expand Up @@ -839,7 +845,7 @@ exit /b 1

:PrivateToolSet

echo %__MsgPrefix% Setting Up the usage of __ToolsetDir:%__ToolsetDir%
echo %__MsgPrefix%Setting up the usage of __ToolsetDir:%__ToolsetDir%

if /i "%__ToolsetDir%" == "" (
echo %__MsgPrefix%Error: A toolset directory is required for the Arm64 Windows build. Use the toolset_dir argument.
Expand Down

0 comments on commit 52ebf91

Please sign in to comment.