@echo off\r
\r
+:: This is needed so as to avoid static expansion of environment variables\r
+:: inside if (...) conditionals.\r
+:: See http://stackoverflow.com/questions/305605/weird-scope-issue-in-bat-file\r
+:: for more explanation.\r
+:: Precisely needed for configuring Visual Studio Environment.\r
+setlocal enabledelayedexpansion\r
+\r
:: Special case %1 = arm_hosttools %2 = vcvarsall.bat %3 = %CMAKE_GENERATOR%\r
if /I "%1" == "arm_hosttools" (\r
echo Configuring x86 host tools for ARM cross build\r
\r
:: Get the source root directory\r
set REACTOS_SOURCE_DIR=%~dp0\r
-set USE_NMAKE=0\r
+set USE_VSCMD=0\r
\r
:: Detect presence of cmake\r
cmd /c cmake --version 2>&1 | find "cmake version" > NUL || goto cmake_notfound\r
set CMAKE_GENERATOR="CodeBlocks - MinGW Makefiles"\r
) else if /I "%1" == "Eclipse" (\r
set CMAKE_GENERATOR="Eclipse CDT4 - MinGW Makefiles"\r
- ) else if /I "%1" == "Ninja" (\r
- set CMAKE_GENERATOR="Ninja"\r
- ) else (\r
+ ) else if /I "%1" == "Makefiles" (\r
set CMAKE_GENERATOR="MinGW Makefiles"\r
+ ) else (\r
+ set CMAKE_GENERATOR="Ninja"\r
)\r
\r
) else if defined DDK_TARGET_OS (\r
) else if "%_BUILDARCH%" == "AMD64" (\r
set ARCH=amd64\r
)\r
- set USE_NMAKE=1\r
+ set USE_VSCMD=1\r
set USE_WDK_HEADERS=0\r
\r
) else if defined VCINSTALLDIR (\r
- :: VS command prompt does not put this in enviroment vars\r
+ :: VS command prompt does not put this in environment vars\r
cl 2>&1 | find "x86" > NUL && set ARCH=i386\r
cl 2>&1 | find "x64" > NUL && set ARCH=amd64\r
cl 2>&1 | find "ARM" > NUL && set ARCH=arm\r
- cl 2>&1 | find "14." > NUL && set BUILD_ENVIRONMENT=VS8\r
- cl 2>&1 | find "15." > NUL && set BUILD_ENVIRONMENT=VS9\r
- cl 2>&1 | find "16." > NUL && set BUILD_ENVIRONMENT=VS10\r
- cl 2>&1 | find "17." > NUL && set BUILD_ENVIRONMENT=VS11\r
+ cl 2>&1 | find "14.00." > NUL && set BUILD_ENVIRONMENT=VS8\r
+ cl 2>&1 | find "15.00." > NUL && set BUILD_ENVIRONMENT=VS9\r
+ cl 2>&1 | find "16.00." > NUL && set BUILD_ENVIRONMENT=VS10\r
+ cl 2>&1 | find "17.00." > NUL && set BUILD_ENVIRONMENT=VS11\r
+ ::cl 2>&1 | find "18.00." > NUL && set BUILD_ENVIRONMENT=VS12\r
if not defined BUILD_ENVIRONMENT (\r
echo Error: Visual Studio version too old or version detection failed.\r
exit /b\r
)\r
\r
- echo Detected Visual Studio Environment %BUILD_ENVIRONMENT%-%ARCH%\r
+ echo Detected Visual Studio Environment !BUILD_ENVIRONMENT!-!ARCH!\r
if /I "%1" == "VSSolution" (\r
- if "%BUILD_ENVIRONMENT%" == "VS8" (\r
- if "%ARCH%" == "amd64" (\r
+ if "!BUILD_ENVIRONMENT!" == "VS8" (\r
+ if "!ARCH!" == "amd64" (\r
set CMAKE_GENERATOR="Visual Studio 8 2005 Win64"\r
) else (\r
set CMAKE_GENERATOR="Visual Studio 8 2005"\r
)\r
- ) else if "%BUILD_ENVIRONMENT%" == "VS9" (\r
- if "%ARCH%" == "amd64" (\r
+ ) else if "!BUILD_ENVIRONMENT!" == "VS9" (\r
+ if "!ARCH!" == "amd64" (\r
set CMAKE_GENERATOR="Visual Studio 9 2008 Win64"\r
) else (\r
set CMAKE_GENERATOR="Visual Studio 9 2008"\r
)\r
- ) else if "%BUILD_ENVIRONMENT%" == "VS10" (\r
- if "%ARCH%" == "amd64" (\r
+ ) else if "!BUILD_ENVIRONMENT!" == "VS10" (\r
+ if "!ARCH!" == "amd64" (\r
set CMAKE_GENERATOR="Visual Studio 10 Win64"\r
) else (\r
set CMAKE_GENERATOR="Visual Studio 10"\r
)\r
- ) else if "%BUILD_ENVIRONMENT%" == "VS11" (\r
- if "%ARCH%" == "amd64" (\r
+ ) else if "!BUILD_ENVIRONMENT!" == "VS11" (\r
+ if "!ARCH!" == "amd64" (\r
set CMAKE_GENERATOR="Visual Studio 11 Win64"\r
- ) else if "%ARCH%" == "arm" (\r
+ ) else if "!ARCH!" == "arm" (\r
set CMAKE_GENERATOR="Visual Studio 11 ARM"\r
) else (\r
set CMAKE_GENERATOR="Visual Studio 11"\r
)\r
)\r
) else (\r
- set USE_NMAKE=1\r
- echo This script defaults to nmake. To use Visual Studio GUI specify "VSSolution" as a parameter.\r
+ set USE_VSCMD=1\r
+ echo This script defaults to Ninja. To use Visual Studio GUI specify "VSSolution" as a parameter.\r
)\r
\r
) else if defined sdkdir (\r
)\r
\r
set BUILD_ENVIRONMENT=SDK\r
- set USE_NMAKE=1\r
+ set USE_VSCMD=1\r
\r
) else (\r
echo Error: Unable to detect build environment. Configure script failure.\r
\r
:: Checkpoint\r
if not defined ARCH (\r
- echo unknown build architecture\r
+ echo Unknown build architecture\r
exit /b\r
)\r
\r
-:: Detect nmake generator\r
-if %USE_NMAKE% == 1 (\r
+:: Detect VS command line generator\r
+if %USE_VSCMD% == 1 (\r
if /I "%1" == "CodeBlocks" (\r
set CMAKE_GENERATOR="CodeBlocks - NMake Makefiles"\r
) else if /I "%1" == "Eclipse" (\r
set CMAKE_GENERATOR="Eclipse CDT4 - NMake Makefiles"\r
- ) else if /I "%1" == "JOM" (\r
- set CMAKE_GENERATOR="NMake Makefiles JOM"\r
- ) else if /I "%1" == "Ninja" (\r
- set CMAKE_GENERATOR="Ninja"\r
- ) else (\r
+ ) else if /I "%1" == "Makefiles" (\r
set CMAKE_GENERATOR="NMake Makefiles"\r
+ ) else (\r
+ set CMAKE_GENERATOR="Ninja"\r
)\r
)\r
\r
\r
cd..\r
\r
-echo Configure script complete! Enter directories and execute appropriate build commands(ex: make, nmake, jom, etc...).\r
+echo Configure script complete^^! Enter directories and execute appropriate build commands (ex: ninja, make, nmake, etc...).\r
exit /b\r
\r
:cmake_notfound\r
- echo Unable to find cmake, if it is installed, check your PATH variable.\r
- exit /b\r
+echo Unable to find cmake, if it is installed, check your PATH variable.\r
+exit /b\r