Skip to content

Commit f90c228

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: nodejs#20109 Conflicts: vcbuild.bat
1 parent e10892c commit f90c228

File tree

1 file changed

+20
-21
lines changed

1 file changed

+20
-21
lines changed

vcbuild.bat

+20-21
Original file line numberDiff line numberDiff line change
@@ -83,25 +83,6 @@ if defined nosnapshot set nosnapshot_arg=--without-snapshot
8383
if defined noetw set noetw_arg=--without-etw& set noetw_msi_arg=/p:NoETW=1
8484
if defined noperfctr set noperfctr_arg=--without-perfctr& set noperfctr_msi_arg=/p:NoPerfCtr=1
8585

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

129111
:msbuild-not-found
130-
echo Build skipped. To build, this file needs to run from VS cmd prompt.
131-
goto run
112+
echo Failed to find Visual Studio installation.
113+
goto exit
132114

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

0 commit comments

Comments
 (0)