@@ -53,7 +53,6 @@ exit /b 127
5353:Run
5454setlocal
5555set platf = Win32
56- set vs_platf = x86
5756set conf = Release
5857set target = Build
5958set dir = %~dp0
@@ -62,10 +61,6 @@ set verbose=/nologo /v:m
6261set kill =
6362set do_pgo =
6463set pgo_job = -m test --pgo
65- set on_64_bit = true
66-
67- rem This may not be 100% accurate, but close enough.
68- if " %ProgramFiles(x86)% " == " " (set on_64_bit=false)
6964
7065:CheckOpts
7166if " %~1 " == " -h" goto Usage
@@ -95,18 +90,12 @@ if "%IncludeTkinter%"=="" set IncludeTkinter=true
9590
9691if " %IncludeExternals% " == " true" call " %dir% get_externals.bat"
9792
98- if " %platf% " == " x64" (
99- if " %on_64_bit% " == " true" (
100- rem This ought to always be correct these days...
101- set vs_platf = amd64
102- ) else (
103- if " %do_pgo% " == " true" (
104- echo .ERROR: Cannot cross-compile with PGO
105- echo . 32bit operating system detected, if this is incorrect,
106- echo . make sure the ProgramFiles(x86^ ) environment variable is set
107- exit /b 1
108- )
109- set vs_platf = x86_amd64
93+ if " %do_pgo% " EQU " true" if " %platf% " EQU " x64" (
94+ if " %PROCESSOR_ARCHITEW6432% " NEQ " AMD64" if " %PROCESSOR_ARCHITECTURE% " NEQ " AMD64" (
95+ echo .ERROR: Cannot cross-compile with PGO
96+ echo . 32bit operating system detected. Ensure your PROCESSOR_ARCHITECTURE
97+ echo . and PROCESSOR_ARCHITEW6432 environment variables are correct.
98+ exit /b 1
11099 )
111100)
112101
@@ -115,7 +104,8 @@ if exist "%GIT%" set GITProperty=/p:GIT="%GIT%"
115104if not exist " %GIT% " echo Cannot find Git on PATH & set GITProperty =
116105
117106rem Setup the environment
118- call " %dir% env.bat" %vs_platf% > nul
107+ call " %dir% find_msbuild.bat" %MSBUILD%
108+ if ERRORLEVEL 1 (echo Cannot locate MSBuild.exe on PATH or as MSBUILD variable & exit /b 2)
119109
120110if " %kill% " == " true" call :Kill
121111
@@ -134,7 +124,7 @@ if "%do_pgo%"=="true" (
134124goto Build
135125:Kill
136126echo on
137- msbuild " %dir% \pythoncore.vcxproj" /t:KillPython %verbose% ^
127+ %MSBUILD% " %dir% \pythoncore.vcxproj" /t:KillPython %verbose% ^
138128 /p:Configuration=%conf% /p:Platform=%platf% ^
139129 /p:KillPython=true
140130
@@ -146,7 +136,7 @@ rem Call on MSBuild to do the work, echo the command.
146136rem Passing %1-9 is not the preferred option, but argument parsing in
147137rem batch is, shall we say, "lackluster"
148138echo on
149- msbuild " %dir% pcbuild.proj" /t:%target% %parallel% %verbose% ^
139+ %MSBUILD% " %dir% pcbuild.proj" /t:%target% %parallel% %verbose% ^
150140 /p:Configuration=%conf% /p:Platform=%platf% ^
151141 /p:IncludeExternals=%IncludeExternals% ^
152142 /p:IncludeSSL=%IncludeSSL% /p:IncludeTkinter=%IncludeTkinter% ^
@@ -158,4 +148,4 @@ goto :eof
158148
159149:Version
160150rem Display the current build version information
161- msbuild " %dir% python.props" /t:ShowVersionInfo /v:m /nologo %1 %2 %3 %4 %5 %6 %7 %8 %9
151+ %MSBUILD% " %dir% python.props" /t:ShowVersionInfo /v:m /nologo %1 %2 %3 %4 %5 %6 %7 %8 %9
0 commit comments