Skip to content
This repository was archived by the owner on Apr 22, 2023. It is now read-only.

Commit a74425b

Browse files
orangemochaJulien Gilli
authored and
Julien Gilli
committed
win: backport set env before generating projects
Backport commit a58b174 from branch v0.12. Original commit message: vcbuild.bat calls python configure before setting GYP_MSVS_VERSION, so SelectVisualStudioVersion (tools\gyp\pylib\gyp\MSVSVersion.py) defaults to 'auto' and selects VS 2005. vcbuild sets the environment in the current shell, so this issue would manifest itself only on the first invocation of the script in any given shell windows. Reviewed-By: Julien Gilli <[email protected]> PR-URL: #20109 Conflicts: vcbuild.bat
1 parent 6f8400a commit a74425b

File tree

1 file changed

+20
-21
lines changed

1 file changed

+20
-21
lines changed

vcbuild.bat

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -81,25 +81,6 @@ if defined nosnapshot set nosnapshot_arg=--without-snapshot
8181
if defined noetw set noetw_arg=--without-etw& set noetw_msi_arg=/p:NoETW=1
8282
if defined noperfctr set noperfctr_arg=--without-perfctr& set noperfctr_msi_arg=/p:NoPerfCtr=1
8383

84-
:project-gen
85-
@rem Skip project generation if requested.
86-
if defined noprojgen goto msbuild
87-
88-
if defined NIGHTLY set TAG=nightly-%NIGHTLY%
89-
90-
@rem Generate the VS project.
91-
SETLOCAL
92-
if defined VS100COMNTOOLS call "%VS100COMNTOOLS%\VCVarsQueryRegistry.bat"
93-
python configure %debug_arg% %nosnapshot_arg% %noetw_arg% %noperfctr_arg% --dest-cpu=%target_arch% --tag=%TAG%
94-
if errorlevel 1 goto create-msvs-files-failed
95-
if not exist node.sln goto create-msvs-files-failed
96-
echo Project files generated.
97-
ENDLOCAL
98-
99-
:msbuild
100-
@rem Skip project generation if requested.
101-
if defined nobuild goto sign
102-
10384
@rem Look for Visual Studio 2013
10485
if not defined VS120COMNTOOLS goto vc-set-2012
10586
if not exist "%VS120COMNTOOLS%\..\..\vc\vcvarsall.bat" goto vc-set-2012
@@ -122,13 +103,31 @@ if not defined VS100COMNTOOLS goto msbuild-not-found
122103
if not exist "%VS100COMNTOOLS%\..\..\vc\vcvarsall.bat" goto msbuild-not-found
123104
call "%VS100COMNTOOLS%\..\..\vc\vcvarsall.bat"
124105
if not defined VCINSTALLDIR goto msbuild-not-found
106+
set GYP_MSVS_VERSION=2010
125107
goto msbuild-found
126108

127109
:msbuild-not-found
128-
echo Build skipped. To build, this file needs to run from VS cmd prompt.
129-
goto run
110+
echo Failed to find Visual Studio installation.
111+
goto exit
130112

131113
:msbuild-found
114+
115+
:project-gen
116+
@rem Skip project generation if requested.
117+
if defined noprojgen goto msbuild
118+
119+
if defined NIGHTLY set TAG=nightly-%NIGHTLY%
120+
121+
@rem Generate the VS project.
122+
python configure %debug_arg% %nosnapshot_arg% %noetw_arg% %noperfctr_arg% --dest-cpu=%target_arch% --tag=%TAG%
123+
if errorlevel 1 goto create-msvs-files-failed
124+
if not exist node.sln goto create-msvs-files-failed
125+
echo Project files generated.
126+
127+
:msbuild
128+
@rem Skip project generation if requested.
129+
if defined nobuild goto sign
130+
132131
@rem Build the sln with msbuild.
133132
msbuild node.sln /m /t:%target% /p:Configuration=%config% /clp:NoSummary;NoItemAndPropertyList;Verbosity=minimal /nologo
134133
if errorlevel 1 goto exit

0 commit comments

Comments
 (0)