Author: tthompson
Date: Thu May 11 01:06:40 2017
New Revision: 74520
URL:
http://svn.reactos.org/svn/reactos?rev=74520&view=rev
Log:
[CMAKE] - configure.cmd - Merge latest changes from trunk (support for Visual Studio 15).
Add even more foolproofing:
-Ensure the source path doesn't contain any spaces.
-Issue a warning if passed an invalid switch.
-Don't announce completion if there were errors.
-Make end message specific for VSSolution.
-Replace redundant exit commands with quit label, as suggested by HBelusca.
Modified:
branches/GSoC_2016/NTFS/configure.cmd
Modified: branches/GSoC_2016/NTFS/configure.cmd
URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2016/NTFS/configure.cmd?re…
==============================================================================
--- branches/GSoC_2016/NTFS/configure.cmd [iso-8859-1] (original)
+++ branches/GSoC_2016/NTFS/configure.cmd [iso-8859-1] Thu May 11 01:06:40 2017
@@ -15,8 +15,7 @@
echo Syntax: path\to\source\configure.cmd [script-options] [Cmake-options]
echo Available script-options: Codeblocks, Eclipse, Makefiles, clang, VSSolution,
RTC
echo Cmake-options: -DVARIABLE:TYPE=VALUE
- endlocal
- exit /b
+ goto quit
)
REM Special case %1 = arm_hosttools %2 = vcvarsall.bat %3 = %CMAKE_GENERATOR%
@@ -33,6 +32,16 @@
REM Get the source root directory
set REACTOS_SOURCE_DIR=%~dp0
+
+REM Ensure there's no spaces in the source path
+echo %REACTOS_SOURCE_DIR%| find " " > NUL
+if %ERRORLEVEL% == 0 (
+ echo. && echo Your source path contains at least one space.
+ echo This will cause problems with building.
+ echo Please rename your folders so there are no spaces in the source path,
+ echo or move your source to a different folder.
+ goto quit
+)
REM Set default generator
set CMAKE_GENERATOR="Ninja"
@@ -58,10 +67,10 @@
cl 2>&1 | find "17.00." > NUL && set VS_VERSION=11
cl 2>&1 | find "18.00." > NUL && set VS_VERSION=12
cl 2>&1 | find "19.00." > NUL && set VS_VERSION=14
+ cl 2>&1 | find "19.10." > NUL && set VS_VERSION=15
if not defined VS_VERSION (
echo Error: Visual Studio version too old or version detection failed.
- endlocal
- exit /b
+ goto quit
)
set BUILD_ENVIRONMENT=VS
set VS_SOLUTION=0
@@ -69,15 +78,13 @@
echo Detected Visual Studio Environment !BUILD_ENVIRONMENT!!VS_VERSION!-!ARCH!
) else (
echo Error: Unable to detect build environment. Configure script failure.
- endlocal
- exit /b
+ goto quit
)
REM Checkpoint
if not defined ARCH (
echo Unknown build architecture
- endlocal
- exit /b
+ goto quit
)
set NEW_STYLE_BUILD=1
@@ -98,11 +105,12 @@
) else if /I "%1" == "VSSolution" (
echo. && echo Error: Creation of VS Solution files is not supported
in a MinGW environment.
echo Please run this command in a [Developer] Command Prompt for Visual
Studio.
- endlocal
- exit /b
+ goto quit
) else if /I "%1" == "RTC" (
echo. && echo Warning: RTC switch is ignored outside of a Visual
Studio environment. && echo.
- ) else (
+ ) else if /I "%1" NEQ "" (
+ echo. && echo Warning: Unrecognized switch "%1" &&
echo.
+ ) else (
goto continue
)
) else (
@@ -153,11 +161,22 @@
) else (
set CMAKE_GENERATOR="Visual Studio 14"
)
+ ) else if "!VS_VERSION!" == "15" (
+ if "!ARCH!" == "amd64" (
+ set CMAKE_GENERATOR="Visual Studio 15 Win64"
+ ) else if "!ARCH!" == "arm" (
+ set CMAKE_GENERATOR="Visual Studio 15 ARM"
+ set CMAKE_GENERATOR_HOST="Visual Studio 15"
+ ) else (
+ set CMAKE_GENERATOR="Visual Studio 15"
+ )
)
) else if /I "%1" == "RTC" (
echo Runtime checks enabled
set VS_RUNTIME_CHECKS=1
- ) else (
+ ) else if /I "%1" NEQ "" (
+ echo. && echo Warning: Unrecognized switch "%1" &&
echo.
+ ) else (
goto continue
)
)
@@ -195,15 +214,13 @@
echo. && echo Error: This directory has already been configured for
ninja.
echo An output folder configured for ninja can't be reconfigured for
VSSolution.
echo Use an empty folder or delete the contents of this folder, then try again.
- endlocal
- exit /b
+ goto quit
)
) else if exist REACTOS.sln (
echo. && echo Error: This directory has already been configured for Visual
Studio.
echo An output folder configured for VSSolution can't be reconfigured for ninja.
echo Use an empty folder or delete the contents of this folder, then try again.
&& echo.
- endlocal
- exit /b
+ goto quit
)
if "%NEW_STYLE_BUILD%"=="0" (
@@ -261,15 +278,28 @@
cd..
)
+if %ERRORLEVEL% NEQ 0 (
+ goto quit
+)
+
if "%CD_SAME_AS_SOURCE%" == "1" (
- echo Configure script complete^^! Execute appropriate build commands ^(ex: ninja,
make, nmake, etc...^) from %REACTOS_OUTPUT_PATH%.
+ set ENDV= from %REACTOS_OUTPUT_PATH%
+)
+
+if "%VS_SOLUTION%" == "1" (
+ set ENDV= You can now open REACTOS.sln%ENDV%.
) else (
- echo Configure script complete^^! Execute appropriate build commands ^(ex: ninja,
make, nmake, etc...^).
-)
+ set ENDV= Execute appropriate build commands ^(ex: ninja, make, nmake, etc...^)%ENDV%
+ )
+)
+
+echo. && echo Configure script complete^^!%ENDV%
+
+goto quit
+
+:cmake_notfound
+echo Unable to find cmake, if it is installed, check your PATH variable.
+
+:quit
endlocal
exit /b
-
-:cmake_notfound
-echo Unable to find cmake, if it is installed, check your PATH variable.
-endlocal
-exit /b