aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--etc/environments/default-clang.bat13
-rw-r--r--etc/environments/default-msvc.bat16
2 files changed, 21 insertions, 8 deletions
diff --git a/etc/environments/default-clang.bat b/etc/environments/default-clang.bat
index c5929d5..5c03fbe 100644
--- a/etc/environments/default-clang.bat
+++ b/etc/environments/default-clang.bat
@@ -14,9 +14,9 @@ rem
set "C=clang"
set "CXX=clang++"
-rem If the MSVC variable is set, then set up the environment via the MSVC
-rem command prompt rather than letting Clang find some default (note that
-rem in the latter case, clang++ should be in PATH).
+rem If the MSVC and VCVARS variables are set, then set up the environment
+rem via the MSVC command prompt rather than letting Clang find some default
+rem (note that in the latter case, clang++ should be in PATH).
rem
rem Note also that MSVC_VER must always be set.
@@ -39,6 +39,7 @@ setlocal EnableExtensions EnableDelayedExpansion
rem Based on target determine what we are building.
rem
+set "VCVARS="
set "MODE="
if "_%1_" == "_x86_64-microsoft-win32-msvc%MSVC_VER%_" (
set "VCVARS=%VCVARS64%"
@@ -59,8 +60,10 @@ if "_%1_" == "_x86_64-microsoft-win32-msvc%MSVC_VER%_" (
)
if not "_%MSVC%_" == "__" (
- call "%MSVC%\%VCVARS%"
- if errorlevel 1 goto error
+ if not "_%VCVARS%_" == "__" (
+ call "%MSVC%\%VCVARS%"
+ if errorlevel 1 goto error
+ )
)
%2 %3 %4 %5 %6 %7 %8 %9 cc config.c=%C% config.cxx=%CXX% %MODE%
diff --git a/etc/environments/default-msvc.bat b/etc/environments/default-msvc.bat
index fcb3155..381dc73 100644
--- a/etc/environments/default-msvc.bat
+++ b/etc/environments/default-msvc.bat
@@ -8,6 +8,11 @@ rem
rem Environment setup script for C/C++ compilation with Visual Studio.
rem
+rem If the MSVC and VCVARS variables are set, then set up the environment via
+rem the MSVC command prompt rather than letting build2 find the default.
+rem
+rem Note also that MSVC_VER must always be set.
+
rem set "MSVC=C:\Program Files (x86)\Microsoft Visual Studio\2017\Community"
rem set "MSVC_VER=14.1"
@@ -25,8 +30,9 @@ setlocal EnableExtensions EnableDelayedExpansion
rem Based on target determine what we are building.
rem
+set "VCVARS="
if "_%1_" == "_x86_64-microsoft-win32-msvc%MSVC_VER%_" (
- set "VCVARS=%VCVARS64%"
+ rem set "VCVARS=%VCVARS64%"
) else (
if "_%1_" == "_i686-microsoft-win32-msvc%MSVC_VER%_" (
set "VCVARS=%VCVARS32%"
@@ -40,8 +46,12 @@ if "_%1_" == "_x86_64-microsoft-win32-msvc%MSVC_VER%_" (
)
)
-call "%MSVC%\%VCVARS%"
-if errorlevel 1 goto error
+if not "_%MSVC%_" == "__" (
+ if not "_%VCVARS%_" == "__" (
+ call "%MSVC%\%VCVARS%"
+ if errorlevel 1 goto error
+ )
+)
%2 %3 %4 %5 %6 %7 %8 %9 cc config.c=cl config.cxx=cl
if errorlevel 1 goto error