summaryrefslogtreecommitdiff
path: root/build.cmd
diff options
context:
space:
mode:
authorJacek Blaszczynski <biosciencenow@outlook.com>2017-10-16 02:27:03 +0200
committerJacek Blaszczynski <biosciencenow@outlook.com>2017-10-16 02:27:03 +0200
commitd4a5e032efe65c6b84cb373a8a18d754ad4cf6aa (patch)
treefd87142cc964a24a3d40b980d794363a3ad1c445 /build.cmd
parent8c7049aabe4bd2d5332a795bfa61a37077ba39bc (diff)
downloadcoreclr-d4a5e032efe65c6b84cb373a8a18d754ad4cf6aa.tar.gz
coreclr-d4a5e032efe65c6b84cb373a8a18d754ad4cf6aa.tar.bz2
coreclr-d4a5e032efe65c6b84cb373a8a18d754ad4cf6aa.zip
Fix Windows arm target cross build: detect prerelease VS2017, stay in repo root
Fixes issue #14514 Arm Windows build was recently changed by adding vswhere based VS installation detection and earlier initialization of environment variables. For details see https://github.com/dotnet/coreclr/pull/14228/files#diff-02389dfac0a172ab80211625efc34318R22 This introduced the following problems: (i) inability to detect and use VS 15 preview releses, (ii) unexpected changes to working directory caused by VsDevCmd.bat script execution. These errors prevented an arm Windows build on my machine with different errors. In particular due to presence of arm tools only in preview version of VS the arm build consistently failed with CMake error "compiler unknown". Fixing of this problem unmasked second bug introduced by uncontrolled changes to build script working directory resulting in error: "Command line too long". Both problems are fixed in this PR. In addition in CrossArchBuild leg a new CMake custom argument is introduced which allows for selection of latest Windows 10 SDK available on machine directly by CMake. So far this define was present only in CoreCLR native build leg.
Diffstat (limited to 'build.cmd')
-rw-r--r--build.cmd9
1 files changed, 6 insertions, 3 deletions
diff --git a/build.cmd b/build.cmd
index 69597eb003..6e3cc3af30 100644
--- a/build.cmd
+++ b/build.cmd
@@ -3,6 +3,7 @@ setlocal EnableDelayedExpansion EnableExtensions
echo Starting Build at %TIME%
set __ThisScriptFull="%~f0"
+set __ThisScriptDir="%~dp0"
:: Default to highest Visual Studio version available
::
@@ -24,7 +25,7 @@ if defined VisualStudioVersion goto :Run
set _VSWHERE="%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe"
if exist %_VSWHERE% (
- for /f "usebackq tokens=*" %%i in (`%_VSWHERE% -latest -property installationPath`) do set _VSCOMNTOOLS=%%i\Common7\Tools
+ for /f "usebackq tokens=*" %%i in (`%_VSWHERE% -latest -prerelease -property installationPath`) do set _VSCOMNTOOLS=%%i\Common7\Tools
)
if not exist "%_VSCOMNTOOLS%" set _VSCOMNTOOLS=%VS140COMNTOOLS%
if not exist "%_VSCOMNTOOLS%" (
@@ -34,6 +35,7 @@ if not exist "%_VSCOMNTOOLS%" (
)
call "%_VSCOMNTOOLS%\VsDevCmd.bat"
+pushd %__ThisScriptDir%
:Run
@@ -314,6 +316,7 @@ REM ============================================================================
echo %__MsgPrefix%Using environment: "%__VSToolsRoot%\VsDevCmd.bat"
call "%__VSToolsRoot%\VsDevCmd.bat"
@if defined _echo @echo on
+pushd %__ThisScriptDir%
@call %__ProjectDir%\run.cmd build -Project=%__ProjectDir%\build.proj -generateHeaderWindows -NativeVersionHeaderFile="%__RootBinDir%\obj\_version.h" %__RunArgs% %__UnprocessedBuildArgs%
@@ -464,7 +467,7 @@ if /i "%__DoCrossArchBuild%"=="1" (
pushd "%__CrossCompIntermediatesDir%"
set __CMakeBinDir=%__CrossComponentBinDir%
set "__CMakeBinDir=!__CMakeBinDir:\=/!"
- set __ExtraCmakeArgs="-DCLR_CROSS_COMPONENTS_BUILD=1" "-DCLR_CMAKE_TARGET_ARCH=%__BuildArch%" "-DCLR_CMAKE_TARGET_OS=%__BuildOs%" "-DCLR_CMAKE_PACKAGES_DIR=%__PackagesDir%" "-DCLR_CMAKE_PGO_INSTRUMENT=%__PgoInstrument%" "-DCLR_CMAKE_OPTDATA_VERSION=%__PgoOptDataVersion%" "-DCLR_CMAKE_PGO_OPTIMIZE=%__PgoOptimize%"
+ set __ExtraCmakeArgs="-DCLR_CROSS_COMPONENTS_BUILD=1" "-DCLR_CMAKE_TARGET_ARCH=%__BuildArch%" "-DCLR_CMAKE_TARGET_OS=%__BuildOs%" "-DCLR_CMAKE_PACKAGES_DIR=%__PackagesDir%" "-DCLR_CMAKE_PGO_INSTRUMENT=%__PgoInstrument%" "-DCLR_CMAKE_OPTDATA_VERSION=%__PgoOptDataVersion%" "-DCLR_CMAKE_PGO_OPTIMIZE=%__PgoOptimize%" "-DCMAKE_SYSTEM_VERSION=10.0"
call "%__SourceDir%\pal\tools\gen-buildsys-win.bat" "%__ProjectDir%" %__VSVersion% %__CrossArch% !__ExtraCmakeArgs!
@if defined _echo @echo on
popd
@@ -484,7 +487,7 @@ if /i "%__DoCrossArchBuild%"=="1" (
set __MsbuildLog=/flp:Verbosity=normal;LogFile=!__BuildLog!
set __MsbuildWrn=/flp1:WarningsOnly;LogFile=!__BuildWrn!
set __MsbuildErr=/flp2:ErrorsOnly;LogFile=!__BuildErr!
-
+
@call %__ProjectDir%\run.cmd build -Project=%__CrossCompIntermediatesDir%\install.vcxproj -configuration=%__BuildType% -platform=%__CrossArch% -MsBuildLog=!__MsbuildLog! -MsBuildWrn=!__MsbuildWrn! -MsBuildErr=!__MsbuildErr! %__RunArgs% %__UnprocessedBuildArgs%
if not !errorlevel! == 0 (