:: Precisely needed for configuring Visual Studio Environment.\r
setlocal enabledelayedexpansion\r
\r
+:: Does the user need help?\r
+if /I "%1" == "help" goto help\r
+if /I "%1" == "/?" (\r
+:help\r
+ echo Help for configure script\r
+ echo Syntax: path\to\source\configure.cmd [script-options] [Cmake-options]\r
+ echo Available script-options: Codeblocks, Eclipse, Makefiles, clang, VSSolution, RTC\r
+ echo Cmake-options: -DVARIABLE:TYPE=VALUE\r
+ exit /b\r
+)\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_VSCMD=0\r
+\r
+:: Set default generator\r
+set CMAKE_GENERATOR="Ninja"\r
+set CMAKE_GENERATOR_HOST=!CMAKE_GENERATOR!\r
\r
:: Detect presence of cmake\r
cmd /c cmake --version 2>&1 | find "cmake version" > NUL || goto cmake_notfound\r
echo Detected RosBE for %ROS_ARCH%\r
set BUILD_ENVIRONMENT=MinGW\r
set ARCH=%ROS_ARCH%\r
- if /I "%1" == "Codeblocks" (\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" == "Makefiles" (\r
- set CMAKE_GENERATOR="MinGW Makefiles"\r
- ) else if /I "%1" == "clang" (\r
- set BUILD_ENVIRONMENT=Clang\r
- set CMAKE_GENERATOR="Ninja"\r
- ) else (\r
- set CMAKE_GENERATOR="Ninja"\r
- )\r
+ set MINGW_TOOCHAIN_FILE=toolchain-gcc.cmake\r
\r
) else if defined VCINSTALLDIR (\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 "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
+ cl 2>&1 | find "15.00." > NUL && set VS_VERSION=9\r
+ cl 2>&1 | find "16.00." > NUL && set VS_VERSION=10\r
+ cl 2>&1 | find "17.00." > NUL && set VS_VERSION=11\r
+ cl 2>&1 | find "18.00." > NUL && set VS_VERSION=12\r
+ if not defined VS_VERSION (\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
- if /I "%1" == "VSSolution" (\r
- 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
- 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
- set CMAKE_GENERATOR="Visual Studio 11 Win64"\r
- ) else if "!ARCH!" == "arm" (\r
- set CMAKE_GENERATOR="Visual Studio 11 ARM"\r
- set CMAKE_GENERATOR_HOST="Visual Studio 11"\r
- ) else (\r
- set CMAKE_GENERATOR="Visual Studio 11"\r
- )\r
- ) else if "!BUILD_ENVIRONMENT!" == "VS12" (\r
- if "!ARCH!" == "amd64" (\r
- set CMAKE_GENERATOR="Visual Studio 12 Win64"\r
- ) else if "!ARCH!" == "arm" (\r
- set CMAKE_GENERATOR="Visual Studio 12 ARM"\r
- set CMAKE_GENERATOR_HOST="Visual Studio 12"\r
- ) else (\r
- set CMAKE_GENERATOR="Visual Studio 12"\r
- )\r
- )\r
- ) else (\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
+ set BUILD_ENVIRONMENT=VS\r
+ set VS_SOLUTION=0\r
+ set VS_RUNTIME_CHECKS=0\r
+ echo Detected Visual Studio Environment !BUILD_ENVIRONMENT!!VS_VERSION!-!ARCH!\r
) else (\r
echo Error: Unable to detect build environment. Configure script failure.\r
exit /b\r
exit /b\r
)\r
\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" == "Makefiles" (\r
- set CMAKE_GENERATOR="NMake Makefiles"\r
+:: Parse command line parameters\r
+:repeat\r
+ if "%BUILD_ENVIRONMENT%" == "MinGW" (\r
+ if /I "%1" == "Codeblocks" (\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" == "Makefiles" (\r
+ set CMAKE_GENERATOR="MinGW Makefiles"\r
+ ) else if /I "%1" == "clang" (\r
+ set MINGW_TOOCHAIN_FILE=toolchain-clang.cmake\r
+ ) else (\r
+ goto continue\r
+ )\r
) else (\r
- set CMAKE_GENERATOR="Ninja"\r
- )\r
- if "!ARCH!" == "arm" (\r
- set CMAKE_GENERATOR_HOST=!CMAKE_GENERATOR!\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" == "Makefiles" (\r
+ set CMAKE_GENERATOR="NMake Makefiles"\r
+ ) else if /I "%1" == "VSSolution" (\r
+ set VS_SOLUTION=1\r
+ if "!VS_VERSION!" == "9" (\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 "!VS_VERSION!" == "10" (\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 "!VS_VERSION!" == "11" (\r
+ if "!ARCH!" == "amd64" (\r
+ set CMAKE_GENERATOR="Visual Studio 11 Win64"\r
+ ) else if "!ARCH!" == "arm" (\r
+ set CMAKE_GENERATOR="Visual Studio 11 ARM"\r
+ set CMAKE_GENERATOR_HOST="Visual Studio 11"\r
+ ) else (\r
+ set CMAKE_GENERATOR="Visual Studio 11"\r
+ )\r
+ ) else if "!VS_VERSION!" == "12" (\r
+ if "!ARCH!" == "amd64" (\r
+ set CMAKE_GENERATOR="Visual Studio 12 Win64"\r
+ ) else if "!ARCH!" == "arm" (\r
+ set CMAKE_GENERATOR="Visual Studio 12 ARM"\r
+ set CMAKE_GENERATOR_HOST="Visual Studio 12"\r
+ ) else (\r
+ set CMAKE_GENERATOR="Visual Studio 12"\r
+ )\r
+ )\r
+ ) else if /I "%1" == "RTC" (\r
+ echo Runtime checks enabled\r
+ set VS_RUNTIME_CHECKS=1\r
+ ) else (\r
+ goto continue\r
+ )\r
)\r
+\r
+ :: Go to next parameter\r
+ SHIFT\r
+ goto repeat\r
+:continue\r
+\r
+:: Inform the user about the default build\r
+if "!CMAKE_GENERATOR!" == "Ninja" (\r
+ echo This script defaults to Ninja. Type "configure help" for alternative options.\r
)\r
\r
:: Create directories\r
)\r
\r
if "%BUILD_ENVIRONMENT%" == "MinGW" (\r
- cmake -G %CMAKE_GENERATOR% -DENABLE_CCACHE:BOOL=0 -DCMAKE_TOOLCHAIN_FILE:FILEPATH=toolchain-gcc.cmake -DARCH:STRING=%ARCH% -DREACTOS_BUILD_TOOLS_DIR:PATH="%REACTOS_BUILD_TOOLS_DIR%" "%REACTOS_SOURCE_DIR%"\r
-) else if "%BUILD_ENVIRONMENT%" == "Clang" (\r
- cmake -G %CMAKE_GENERATOR% -DENABLE_CCACHE:BOOL=0 -DCMAKE_TOOLCHAIN_FILE:FILEPATH=toolchain-clang.cmake -DARCH:STRING=%ARCH% -DREACTOS_BUILD_TOOLS_DIR:PATH="%REACTOS_BUILD_TOOLS_DIR%" "%REACTOS_SOURCE_DIR%"\r
+ cmake -G %CMAKE_GENERATOR% -DENABLE_CCACHE:BOOL=0 -DCMAKE_TOOLCHAIN_FILE:FILEPATH=%MINGW_TOOCHAIN_FILE% -DARCH:STRING=%ARCH% -DREACTOS_BUILD_TOOLS_DIR:PATH="%REACTOS_BUILD_TOOLS_DIR%" %* "%REACTOS_SOURCE_DIR%"\r
) else (\r
- cmake -G %CMAKE_GENERATOR% -DCMAKE_TOOLCHAIN_FILE:FILEPATH=toolchain-msvc.cmake -DARCH:STRING=%ARCH% -DREACTOS_BUILD_TOOLS_DIR:PATH="%REACTOS_BUILD_TOOLS_DIR%" "%REACTOS_SOURCE_DIR%"\r
+ cmake -G %CMAKE_GENERATOR% -DCMAKE_TOOLCHAIN_FILE:FILEPATH=toolchain-msvc.cmake -DARCH:STRING=%ARCH% -DREACTOS_BUILD_TOOLS_DIR:PATH="%REACTOS_BUILD_TOOLS_DIR%" -DRUNTIME_CHECKS:BOOL=%VS_RUNTIME_CHECKS% %* "%REACTOS_SOURCE_DIR%"\r
)\r
\r
cd..\r