aboutsummaryrefslogtreecommitdiff
path: root/etc/environments/default-clang.bat
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2019-10-07 16:53:00 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2019-10-08 11:23:52 +0200
commit084b18928556640b396d8788145539f5cbd2dbff (patch)
tree9fdff81898de125b13fd11be29c2e4c474258784 /etc/environments/default-clang.bat
parent3e888ccbc044f1b87140db8c8523d793fc7f6481 (diff)
Don't assume which mode (-m32/-m64, etc) is required in environment setup
Diffstat (limited to 'etc/environments/default-clang.bat')
-rw-r--r--etc/environments/default-clang.bat26
1 files changed, 16 insertions, 10 deletions
diff --git a/etc/environments/default-clang.bat b/etc/environments/default-clang.bat
index 52e0e4a..c5929d5 100644
--- a/etc/environments/default-clang.bat
+++ b/etc/environments/default-clang.bat
@@ -9,11 +9,10 @@ rem Environment setup script for C/C++ compilation with Clang targeting
rem MSVC.
rem
-rem %1 - target
-rem %2 - bbot executable
-rem %3+ - bbot options
-
-setlocal EnableExtensions EnableDelayedExpansion
+rem NOTE: don't forget to adjust the target mode selection below.
+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
@@ -27,24 +26,31 @@ rem set "MSVC_VER=14.1"
set "MSVC=C:\Program Files (x86)\Microsoft Visual Studio\2019\Community"
set "MSVC_VER=14.2"
+rem set "MSVC="
+
set "VCVARS32=VC\Auxiliary\Build\vcvarsamd64_x86.bat"
set "VCVARS64=VC\Auxiliary\Build\vcvars64.bat"
-set "CXX=clang++"
+rem %1 - target
+rem %2 - bbot executable
+rem %3+ - bbot options
+
+setlocal EnableExtensions EnableDelayedExpansion
rem Based on target determine what we are building.
rem
+set "MODE="
if "_%1_" == "_x86_64-microsoft-win32-msvc%MSVC_VER%_" (
set "VCVARS=%VCVARS64%"
- set "mode=config.cc.coptions+=-m64"
+ rem set "MODE=config.cc.coptions+=-m64"
) else (
if "_%1_" == "_i686-microsoft-win32-msvc%MSVC_VER%_" (
set "VCVARS=%VCVARS32%"
- set "mode=config.cc.coptions+=-m32"
+ set "MODE=config.cc.coptions+=-m32"
) else (
if "_%1_" == "_i386-microsoft-win32-msvc%MSVC_VER%_" (
set "VCVARS=%VCVARS32%"
- set "mode=config.cc.coptions+=-m32"
+ set "MODE=config.cc.coptions+=-m32"
) else (
echo error: unknown target %1
goto error
@@ -57,7 +63,7 @@ if not "_%MSVC%_" == "__" (
if errorlevel 1 goto error
)
-%2 %3 %4 %5 %6 %7 %8 %9 cc config.c=cl config.cxx=%CXX% %mode%
+%2 %3 %4 %5 %6 %7 %8 %9 cc config.c=%C% config.cxx=%CXX% %MODE%
if errorlevel 1 goto error
goto end