From 084b18928556640b396d8788145539f5cbd2dbff Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 7 Oct 2019 16:53:00 +0200 Subject: Don't assume which mode (-m32/-m64, etc) is required in environment setup --- etc/environments/default | 9 ++++----- etc/environments/default-clang.bat | 26 ++++++++++++++++---------- etc/environments/default-mingw.bat | 16 +++++++++------- etc/environments/default-msvc-14.bat | 8 ++++---- etc/environments/default-msvc.bat | 12 ++++++------ 5 files changed, 39 insertions(+), 32 deletions(-) (limited to 'etc/environments') diff --git a/etc/environments/default b/etc/environments/default index cee5ed2..16e39d1 100755 --- a/etc/environments/default +++ b/etc/environments/default @@ -7,11 +7,9 @@ # # Environment setup script for C/C++ compilation. # -# Note that we assume the compiler's default target is x86_64-* and, if -# requested, i?86-* can be selected with -m32. For other targets you will -# need to adjust the mode selection below. -# +# NOTE: don't forget to adjust the target mode selection below. +# c=gcc cxx=g++ @@ -23,9 +21,10 @@ set -e # Exit on errors. # Based on target determine what we are building. # +mode= case "$1" in x86_64-*) - mode= + #mode="config.cc.coptions+=-m64" ;; i?86-*) mode="config.cc.coptions+=-m32" 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 diff --git a/etc/environments/default-mingw.bat b/etc/environments/default-mingw.bat index 01e46ab..1d5427b 100644 --- a/etc/environments/default-mingw.bat +++ b/etc/environments/default-mingw.bat @@ -7,9 +7,12 @@ rem license : TBC; see accompanying LICENSE file rem rem Environment setup script for C/C++ compilation with MinGW GCC. rem -rem Note that we assume the compiler's default target is x86_64-w64-mingw32 -rem and, if requested, i686-w64-mingw32 can be selected with -m32. + +rem NOTE: don't forget to adjust the target mode selection below. rem +set "C=gcc" +set "CXX=g++" +set "MINGW=C:\build2\bin" rem %1 - target rem %2 - bbot executable @@ -17,24 +20,23 @@ rem %3+ - bbot options setlocal EnableExtensions EnableDelayedExpansion -set "MINGW=C:\build2\bin" - set "PATH=$MINGW;%PATH%" rem Based on target determine what we are building. rem +set "MODE=" if "_%1_" == "_x86_64-w64-mingw32_" ( - set "mode=" + rem set "MODE=config.cc.coptions+=-m64" ) else ( if "_%1_" == "_i686-w64-mingw32_" ( - set "mode=config.cc.coptions+=-m32" + set "MODE=config.cc.coptions+=-m32" ) else ( echo error: unknown target %1 goto error ) ) -%2 %3 %4 %5 %6 %7 %8 %9 cc config.c=gcc config.cxx=g++ %mode% +%2 %3 %4 %5 %6 %7 %8 %9 cc config.c=%C% config.cxx=%CXX% %MODE% if errorlevel 1 goto error goto end diff --git a/etc/environments/default-msvc-14.bat b/etc/environments/default-msvc-14.bat index cd78b04..76e2385 100644 --- a/etc/environments/default-msvc-14.bat +++ b/etc/environments/default-msvc-14.bat @@ -8,15 +8,15 @@ rem rem Environment setup script for C/C++ compilation with Visual Studio 14. rem +set "MSVC=C:\Program Files (x86)\Microsoft Visual Studio 14.0" +set "VCVARS=VC\vcvarsall.bat" + rem %1 - target rem %2 - bbot executable rem %3+ - bbot options setlocal EnableExtensions EnableDelayedExpansion -set "MSVC=C:\Program Files (x86)\Microsoft Visual Studio 14.0" -set "VCVARS=%MSVC%\VC\vcvarsall.bat" - rem Based on target determine what we are building. rem if "_%1_" == "_x86_64-microsoft-win32-msvc14.0_" ( @@ -30,7 +30,7 @@ if "_%1_" == "_x86_64-microsoft-win32-msvc14.0_" ( ) ) -call "%VCVARS%" %VCARCH% +call "%MSVC%\%VCVARS%" %VCARCH% if errorlevel 1 goto error %2 %3 %4 %5 %6 %7 %8 %9 cc config.c=cl config.cxx=cl diff --git a/etc/environments/default-msvc.bat b/etc/environments/default-msvc.bat index a7d4f16..fcb3155 100644 --- a/etc/environments/default-msvc.bat +++ b/etc/environments/default-msvc.bat @@ -8,12 +8,6 @@ rem rem Environment setup script for C/C++ compilation with Visual Studio. rem -rem %1 - target -rem %2 - bbot executable -rem %3+ - bbot options - -setlocal EnableExtensions EnableDelayedExpansion - rem set "MSVC=C:\Program Files (x86)\Microsoft Visual Studio\2017\Community" rem set "MSVC_VER=14.1" @@ -23,6 +17,12 @@ set "MSVC_VER=14.2" set "VCVARS32=VC\Auxiliary\Build\vcvarsamd64_x86.bat" set "VCVARS64=VC\Auxiliary\Build\vcvars64.bat" +rem %1 - target +rem %2 - bbot executable +rem %3+ - bbot options + +setlocal EnableExtensions EnableDelayedExpansion + rem Based on target determine what we are building. rem if "_%1_" == "_x86_64-microsoft-win32-msvc%MSVC_VER%_" ( -- cgit v1.1