@@ -48,7 +48,6 @@ exit /b 127
4848:Run
4949setlocal
5050set platf = Win32
51- set vs_platf = x86
5251set conf = Release
5352set target = Build
5453set dir = %~dp0
@@ -57,10 +56,6 @@ set verbose=/nologo /v:m
5756set kill =
5857set do_pgo =
5958set pgo_job = -m test --pgo
60- set on_64_bit = true
61-
62- rem This may not be 100% accurate, but close enough.
63- if " %ProgramFiles(x86)% " == " " (set on_64_bit=false)
6459
6560:CheckOpts
6661if " %~1 " == " -h" goto Usage
@@ -90,18 +85,12 @@ if "%IncludeTkinter%"=="" set IncludeTkinter=true
9085
9186if " %IncludeExternals% " == " true" call " %dir% get_externals.bat"
9287
93- if " %platf% " == " x64" (
94- if " %on_64_bit% " == " true" (
95- rem This ought to always be correct these days...
96- set vs_platf = amd64
97- ) else (
98- if " %do_pgo% " == " true" (
99- echo .ERROR: Cannot cross-compile with PGO
100- echo . 32bit operating system detected, if this is incorrect,
101- echo . make sure the ProgramFiles(x86^ ) environment variable is set
102- exit /b 1
103- )
104- set vs_platf = x86_amd64
88+ if " %do_pgo% " EQU " true" if " %platf% " EQU " x64" (
89+ if " %PROCESSOR_ARCHITEW6432% " NEQ " AMD64" if " %PROCESSOR_ARCHITECTURE% " NEQ " AMD64" (
90+ echo .ERROR: Cannot cross-compile with PGO
91+ echo . 32bit operating system detected. Ensure your PROCESSOR_ARCHITECTURE
92+ echo . and PROCESSOR_ARCHITEW6432 environment variables are correct.
93+ exit /b 1
10594 )
10695)
10796
@@ -110,7 +99,8 @@ if exist "%GIT%" set GITProperty=/p:GIT="%GIT%"
11099if not exist " %GIT% " echo Cannot find Git on PATH & set GITProperty =
111100
112101rem Setup the environment
113- call " %dir% env.bat" %vs_platf% > nul
102+ call " %dir% find_msbuild.bat" %MSBUILD%
103+ if ERRORLEVEL 1 (echo Cannot locate MSBuild.exe on PATH or as MSBUILD variable & exit /b 2)
114104
115105if " %kill% " == " true" call :Kill
116106
@@ -129,7 +119,7 @@ if "%do_pgo%"=="true" (
129119goto Build
130120:Kill
131121echo on
132- msbuild " %dir% \pythoncore.vcxproj" /t:KillPython %verbose% ^
122+ %MSBUILD% " %dir% \pythoncore.vcxproj" /t:KillPython %verbose% ^
133123 /p:Configuration=%conf% /p:Platform=%platf% ^
134124 /p:KillPython=true
135125
@@ -141,7 +131,7 @@ rem Call on MSBuild to do the work, echo the command.
141131rem Passing %1-9 is not the preferred option, but argument parsing in
142132rem batch is, shall we say, "lackluster"
143133echo on
144- msbuild " %dir% pcbuild.proj" /t:%target% %parallel% %verbose% ^
134+ %MSBUILD% " %dir% pcbuild.proj" /t:%target% %parallel% %verbose% ^
145135 /p:Configuration=%conf% /p:Platform=%platf% ^
146136 /p:IncludeExternals=%IncludeExternals% ^
147137 /p:IncludeSSL=%IncludeSSL% /p:IncludeTkinter=%IncludeTkinter% ^
@@ -153,4 +143,4 @@ goto :eof
153143
154144:Version
155145rem Display the current build version information
156- msbuild " %dir% python.props" /t:ShowVersionInfo /v:m /nologo %1 %2 %3 %4 %5 %6 %7 %8 %9
146+ %MSBUILD% " %dir% python.props" /t:ShowVersionInfo /v:m /nologo %1 %2 %3 %4 %5 %6 %7 %8 %9
0 commit comments