Author: tkreuzer
Date: Fri Feb 18 17:35:50 2011
New Revision: 50810
URL:
http://svn.reactos.org/svn/reactos?rev=50810&view=rev
Log:
[CMAKE]
Add support for VS 8-10 and SDK to configure script, add error checks. Patch by Samuel
Serapion with small modifications by me.
Modified:
branches/cmake-bringup/configure.cmd
Modified: branches/cmake-bringup/configure.cmd
URL:
http://svn.reactos.org/svn/reactos/branches/cmake-bringup/configure.cmd?rev…
==============================================================================
--- branches/cmake-bringup/configure.cmd [iso-8859-1] (original)
+++ branches/cmake-bringup/configure.cmd [iso-8859-1] Fri Feb 18 17:35:50 2011
@@ -1,16 +1,14 @@
@echo off
-rem Get the source root directory
-set ROS_SOURCE_DIR=%~dp0
+:: Get the source root directory
+set REACTOS_SOURCE_DIR=%~dp0
-rem Detect build environment (Mingw, VS, WDK, ...)
-if not "%ROS_ARCH%" == "" (
+:: Detect build environment (MinGW, VS, WDK, ...)
+if defined ROS_ARCH (
+ set BUILD_ENVIRONMENT=MinGW
+ set ARCH=%ROS_ARCH%
echo Detected RosBE for %ROS_ARCH%
- set BUILD_ENVIRONMENT=MINGW
- set ARCH=%ROS_ARCH%
-)
-if not "%DDK_TARGET_OS%" == "" (
- echo Detected DDK/WDK for %_BUILDARCH%
+) else if defined DDK_TARGET_OS (
if "%_BUILDARCH%" == "x86" (
set ARCH=i386
)
@@ -18,43 +16,131 @@
set ARCH=amd64
)
set BUILD_ENVIRONMENT=WDK
+ echo Detected DDK/WDK for %DDK_TARGET_OS%-%ARCH%
+)else if defined VCINSTALLDIR (
+:: VS command prompt does not put this in enviroment vars
+ cl 2>&1 | find "x86" > NUL && set ARCH=i386
+ cl 2>&1 | find "x64" > NUL && set ARCH=amd64
+ cl 2>&1 | find "14." > NUL && set BUILD_ENVIRONMENT=VS8
+ cl 2>&1 | find "15." > NUL && set BUILD_ENVIRONMENT=VS9
+ cl 2>&1 | find "16." > NUL && set BUILD_ENVIRONMENT=VS10
+ if not defined BUILD_ENVIRONMENT (
+ echo Error: Visual Studio version too old or version detection failed.
+ exit /b
+ )
+ echo Detected Visual Studio Environment %BUILD_ENVIRONMENT%-%ARCH%
+) else if defined sdkdir (
+ if "%TARGET_CPU%" == "x86" (
+ set ARCH=i386
+ )
+ if "%TARGET_CPU%" == "x64" (
+ set ARCH=amd64
+ )
+ set BUILD_ENVIRONMENT=SDK
+ echo Detected Windows SDK %TARGET_PLATFORM%-%ARCH%
)
+if defined ARCH if defined BUILD_ENVIRONMENT (
+ goto createdirs
+)
-rem Create directories
-echo Preparing host tools...
+echo Error: Critical variable missing. Configure script failure.
+exit /b
+
+:: Create directories
+:createdirs
+
+set REACTOS_OUTPUT_PATH=output-%BUILD_ENVIRONMENT%-%ARCH%
+if "%REACTOS_SOURCE_DIR%" == "%CD%" (
+ echo test
+ echo Creating directories in %REACTOS_OUTPUT_PATH%
+
+ if not exist %REACTOS_OUTPUT_PATH% (
+ mkdir %REACTOS_OUTPUT_PATH%
+ )
+ cd %REACTOS_OUTPUT_PATH%
+)
+
if not exist host-tools (
mkdir host-tools
)
+if not exist reactos (
+ mkdir reactos
+)
+
+:hostprep
+echo Preparing host tools...
cd host-tools
if EXIST CMakeCache.txt (
del CMakeCache.txt /q
)
set REACTOS_BUILD_TOOLS_DIR=%CD%
-if "%BUILD_ENVIRONMENT%" == "MINGW" (
- cmake -G "MinGW Makefiles" -DARCH=%ARCH% %ROS_SOURCE_DIR%
-)
-if "%BUILD_ENVIRONMENT%" == "WDK" (
- cmake -G "NMake Makefiles" -DARCH=%ARCH% %ROS_SOURCE_DIR%
+
+if "%BUILD_ENVIRONMENT%" == "MinGW" (
+ cmake -G "MinGW Makefiles" -DARCH=%ARCH% %REACTOS_SOURCE_DIR%
+) else if "%BUILD_ENVIRONMENT%" == "WDK" (
+ cmake -G "NMake Makefiles" -DARCH=%ARCH% %REACTOS_SOURCE_DIR%
+) else if "%BUILD_ENVIRONMENT%" == "SDK" (
+ cmake -G "NMake Makefiles" -DARCH=%ARCH% %REACTOS_SOURCE_DIR%
+) else if "%BUILD_ENVIRONMENT%" == "VS8" (
+ if "%ARCH%" == "amd64" (
+ cmake -G "Visual Studio 8 2005 Win64" -DARCH=%ARCH%
%REACTOS_SOURCE_DIR%
+ ) else (
+ cmake -G "Visual Studio 8 2005" -DARCH=%ARCH% %REACTOS_SOURCE_DIR%
+ )
+) else if "%BUILD_ENVIRONMENT%" == "VS9" (
+ if "%ARCH%" == "amd64" (
+ cmake -G "Visual Studio 9 2008 Win64" -DARCH=%ARCH%
%REACTOS_SOURCE_DIR%
+ ) else (
+ cmake -G "Visual Studio 9 2008" -DARCH=%ARCH% %REACTOS_SOURCE_DIR%
+ )
+) else if "%BUILD_ENVIRONMENT%" == "VS10" (
+ if "%ARCH%" == "amd64" (
+ cmake -G "Visual Studio 10 Win64" -DARCH=%ARCH% %REACTOS_SOURCE_DIR%
+ ) else (
+ cmake -G "Visual Studio 10" -DARCH=%ARCH% %REACTOS_SOURCE_DIR%
+ )
)
cd..
+:reactprep
echo Preparing reactos...
-if not exist reactos (
- mkdir reactos
-)
cd reactos
if EXIST CMakeCache.txt (
del CMakeCache.txt /q
)
-if "%BUILD_ENVIRONMENT%" == "MINGW" (
- cmake -G "MinGW Makefiles" -DCMAKE_TOOLCHAIN_FILE=toolchain-mingw32.cmake
-DARCH=%ARCH% -DREACTOS_BUILD_TOOLS_DIR:DIR="%REACTOS_BUILD_TOOLS_DIR%"
%ROS_SOURCE_DIR%
+
+if "%BUILD_ENVIRONMENT%" == "MinGW" (
+ cmake -G "MinGW Makefiles" -DCMAKE_TOOLCHAIN_FILE=toolchain-mingw32.cmake
-DARCH=%ARCH% -DREACTOS_BUILD_TOOLS_DIR:DIR="%REACTOS_BUILD_TOOLS_DIR%"
%REACTOS_SOURCE_DIR%
+) else if "%BUILD_ENVIRONMENT%" == "WDK" (
+ cmake -G "NMake Makefiles" -DCMAKE_TOOLCHAIN_FILE=toolchain-msvc.cmake
-DARCH=%ARCH% -DREACTOS_BUILD_TOOLS_DIR:DIR="%REACTOS_BUILD_TOOLS_DIR%"
%REACTOS_SOURCE_DIR%
+) else if "%BUILD_ENVIRONMENT%" == "SDK" (
+ cmake -G "NMake Makefiles" -DCMAKE_TOOLCHAIN_FILE=toolchain-msvc.cmake
-DARCH=%ARCH% -DREACTOS_BUILD_TOOLS_DIR:DIR="%REACTOS_BUILD_TOOLS_DIR%"
%REACTOS_SOURCE_DIR%
+) else if "%BUILD_ENVIRONMENT%" == "VS8" (
+ if "%ARCH%" == "amd64" (
+ cmake -G "Visual Studio 8 2005 Win64"
-DCMAKE_TOOLCHAIN_FILE=toolchain-msvc.cmake -DARCH=%ARCH%
-DREACTOS_BUILD_TOOLS_DIR:DIR="%REACTOS_BUILD_TOOLS_DIR%" %REACTOS_SOURCE_DIR%
+ ) else (
+ cmake -G "Visual Studio 8 2005"
-DCMAKE_TOOLCHAIN_FILE=toolchain-msvc.cmake -DARCH=%ARCH%
-DREACTOS_BUILD_TOOLS_DIR:DIR="%REACTOS_BUILD_TOOLS_DIR%" %REACTOS_SOURCE_DIR%
+ )
+) else if "%BUILD_ENVIRONMENT%" == "VS9" (
+ if "%ARCH%" == "amd64" (
+ cmake -G "Visual Studio 9 2008 Win64"
-DCMAKE_TOOLCHAIN_FILE=toolchain-msvc.cmake -DARCH=%ARCH%
-DREACTOS_BUILD_TOOLS_DIR:DIR="%REACTOS_BUILD_TOOLS_DIR%" %REACTOS_SOURCE_DIR%
+ ) else (
+ cmake -G "Visual Studio 9 2008"
-DCMAKE_TOOLCHAIN_FILE=toolchain-msvc.cmake -DARCH=%ARCH%
-DREACTOS_BUILD_TOOLS_DIR:DIR="%REACTOS_BUILD_TOOLS_DIR%" %REACTOS_SOURCE_DIR%
+ )
+) else if "%BUILD_ENVIRONMENT%" == "VS10" (
+ if "%ARCH%" == "amd64" (
+ cmake -G "Visual Studio 10 Win64"
-DCMAKE_TOOLCHAIN_FILE=toolchain-msvc.cmake -DARCH=%ARCH%
-DREACTOS_BUILD_TOOLS_DIR:DIR="%REACTOS_BUILD_TOOLS_DIR%" %REACTOS_SOURCE_DIR%
+ ) else (
+ cmake -G "Visual Studio 10" -DCMAKE_TOOLCHAIN_FILE=toolchain-msvc.cmake
-DARCH=%ARCH% -DREACTOS_BUILD_TOOLS_DIR:DIR="%REACTOS_BUILD_TOOLS_DIR%"
%REACTOS_SOURCE_DIR%
+ )
)
-if "%BUILD_ENVIRONMENT%" == "WDK" (
- cmake -G "NMake Makefiles" -DCMAKE_TOOLCHAIN_FILE=toolchain-msvc.cmake
-DARCH=%ARCH% -DREACTOS_BUILD_TOOLS_DIR:DIR="%REACTOS_BUILD_TOOLS_DIR%"
%ROS_SOURCE_DIR%
+
+cd..
+if not ERRORLEVEL == 0 (
+ echo Warning: errors occured.
)
-cd..
-rem Create a root makefile
-rem echo ... > makefile
+echo Configure script complete! Enter directories and execute appropriate build
commands(ex: make, nmake, etc...).
+