summaryrefslogtreecommitdiff
path: root/PCbuild/build.bat
diff options
context:
space:
mode:
authorSteve Dower <steve.dower@microsoft.com>2017-06-19 10:34:25 -0700
committerGitHub <noreply@github.com>2017-06-19 10:34:25 -0700
commit40a23e88994aca92c83c8e84ab8b8cdc11d7ec54 (patch)
tree5a04457af0c0d4be563bf1c153059564bc19c516 /PCbuild/build.bat
parenteb81795d7d3a8c898fa89a376d63fc3bbfb9a081 (diff)
downloadcpython-git-40a23e88994aca92c83c8e84ab8b8cdc11d7ec54.tar.gz
bpo-30687: Fixes build scripts to find msbuild.exe and stop relying on vcvarsall.bat (#2252)
* Fixes build scripts to find msbuild.exe and stop relying on vcvarsall.bat Also fixes bdist_wininst.vcxproj to use correct version in generated name.
Diffstat (limited to 'PCbuild/build.bat')
-rw-r--r--PCbuild/build.bat32
1 files changed, 11 insertions, 21 deletions
diff --git a/PCbuild/build.bat b/PCbuild/build.bat
index caed481e4f..713810e5b4 100644
--- a/PCbuild/build.bat
+++ b/PCbuild/build.bat
@@ -53,7 +53,6 @@ exit /b 127
:Run
setlocal
set platf=Win32
-set vs_platf=x86
set conf=Release
set target=Build
set dir=%~dp0
@@ -62,10 +61,6 @@ set verbose=/nologo /v:m
set kill=
set do_pgo=
set pgo_job=-m test --pgo
-set on_64_bit=true
-
-rem This may not be 100% accurate, but close enough.
-if "%ProgramFiles(x86)%"=="" (set on_64_bit=false)
:CheckOpts
if "%~1"=="-h" goto Usage
@@ -95,18 +90,12 @@ if "%IncludeTkinter%"=="" set IncludeTkinter=true
if "%IncludeExternals%"=="true" call "%dir%get_externals.bat"
-if "%platf%"=="x64" (
- if "%on_64_bit%"=="true" (
- rem This ought to always be correct these days...
- set vs_platf=amd64
- ) else (
- if "%do_pgo%"=="true" (
- echo.ERROR: Cannot cross-compile with PGO
- echo. 32bit operating system detected, if this is incorrect,
- echo. make sure the ProgramFiles(x86^) environment variable is set
- exit /b 1
- )
- set vs_platf=x86_amd64
+if "%do_pgo%" EQU "true" if "%platf%" EQU "x64" (
+ if "%PROCESSOR_ARCHITEW6432%" NEQ "AMD64" if "%PROCESSOR_ARCHITECTURE%" NEQ "AMD64" (
+ echo.ERROR: Cannot cross-compile with PGO
+ echo. 32bit operating system detected. Ensure your PROCESSOR_ARCHITECTURE
+ echo. and PROCESSOR_ARCHITEW6432 environment variables are correct.
+ exit /b 1
)
)
@@ -115,7 +104,8 @@ if exist "%GIT%" set GITProperty=/p:GIT="%GIT%"
if not exist "%GIT%" echo Cannot find Git on PATH & set GITProperty=
rem Setup the environment
-call "%dir%env.bat" %vs_platf% >nul
+call "%dir%find_msbuild.bat" %MSBUILD%
+if ERRORLEVEL 1 (echo Cannot locate MSBuild.exe on PATH or as MSBUILD variable & exit /b 2)
if "%kill%"=="true" call :Kill
@@ -134,7 +124,7 @@ if "%do_pgo%"=="true" (
goto Build
:Kill
echo on
-msbuild "%dir%\pythoncore.vcxproj" /t:KillPython %verbose%^
+%MSBUILD% "%dir%\pythoncore.vcxproj" /t:KillPython %verbose%^
/p:Configuration=%conf% /p:Platform=%platf%^
/p:KillPython=true
@@ -146,7 +136,7 @@ rem Call on MSBuild to do the work, echo the command.
rem Passing %1-9 is not the preferred option, but argument parsing in
rem batch is, shall we say, "lackluster"
echo on
-msbuild "%dir%pcbuild.proj" /t:%target% %parallel% %verbose%^
+%MSBUILD% "%dir%pcbuild.proj" /t:%target% %parallel% %verbose%^
/p:Configuration=%conf% /p:Platform=%platf%^
/p:IncludeExternals=%IncludeExternals%^
/p:IncludeSSL=%IncludeSSL% /p:IncludeTkinter=%IncludeTkinter%^
@@ -158,4 +148,4 @@ goto :eof
:Version
rem Display the current build version information
-msbuild "%dir%python.props" /t:ShowVersionInfo /v:m /nologo %1 %2 %3 %4 %5 %6 %7 %8 %9
+%MSBUILD% "%dir%python.props" /t:ShowVersionInfo /v:m /nologo %1 %2 %3 %4 %5 %6 %7 %8 %9