Author: tkreuzer
Date: Fri Jul 8 10:01:43 2011
New Revision: 52569
URL:
http://svn.reactos.org/svn/reactos?rev=52569&view=rev
Log:
[CMAKE]
Improve configure.cmd
Modified:
trunk/reactos/configure.cmd
Modified: trunk/reactos/configure.cmd
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/configure.cmd?rev=52569&am…
==============================================================================
--- trunk/reactos/configure.cmd [iso-8859-1] (original)
+++ trunk/reactos/configure.cmd [iso-8859-1] Fri Jul 8 10:01:43 2011
@@ -5,26 +5,34 @@
set USE_NMAKE=0
:: Detect presence of cmake
- cmd /c cmake --version 2>&1 | find "cmake version" > NUL || goto
cmake_notfound
+cmd /c cmake --version 2>&1 | find "cmake version" > NUL || goto
cmake_notfound
:: Detect build environment (MinGW, VS, WDK, ...)
if defined ROS_ARCH (
+ echo Detected RosBE for %ROS_ARCH%
set BUILD_ENVIRONMENT=MinGW
set ARCH=%ROS_ARCH%
- echo Detected RosBE for %ROS_ARCH%
+ if /I "%1" == "Codeblocks" (
+ set CMAKE_GENERATOR="CodeBlocks - MinGW Makefiles"
+ ) else if /I "%1" == "Eclipse" (
+ set CMAKE_GENERATOR="Eclipse CDT4 - MinGW Makefiles"
+ ) else (
+ set CMAKE_GENERATOR="MinGW Makefiles"
+ )
+
) else if defined DDK_TARGET_OS (
+ echo Detected DDK/WDK for %DDK_TARGET_OS%-%_BUILDARCH%%
+ set BUILD_ENVIRONMENT=WDK
if "%_BUILDARCH%" == "x86" (
set ARCH=i386
- )
- if "%_BUILDARCH%" == "AMD64" (
+ ) else if "%_BUILDARCH%" == "AMD64" (
set ARCH=amd64
)
- set BUILD_ENVIRONMENT=WDK
set USE_NMAKE=1
set USE_WDK_HEADERS=0
- echo Detected DDK/WDK for %DDK_TARGET_OS%-%ARCH%
-)else if defined VCINSTALLDIR (
-:: VS command prompt does not put this in enviroment vars
+
+) 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
@@ -34,35 +42,66 @@
echo Error: Visual Studio version too old or version detection failed.
exit /b
)
+
echo Detected Visual Studio Environment %BUILD_ENVIRONMENT%-%ARCH%
- if /I not "%1" == "VSSolution" (
+ if /I "%1" == "VSSolution" (
+ if "%BUILD_ENVIRONMENT%" == "VS8" (
+ if "%ARCH%" == "amd64" (
+ set CMAKE_GENERATOR="Visual Studio 8 2005 Win64"
+ ) else (
+ set CMAKE_GENERATOR="Visual Studio 8 2005"
+ )
+ ) else if "%BUILD_ENVIRONMENT%" == "VS9" (
+ if "%ARCH%" == "amd64" (
+ set CMAKE_GENERATOR="Visual Studio 9 2008 Win64"
+ ) else (
+ set CMAKE_GENERATOR="Visual Studio 9 2008"
+ )
+ ) else if "%BUILD_ENVIRONMENT%" == "VS10" (
+ if "%ARCH%" == "amd64" (
+ set CMAKE_GENERATOR="Visual Studio 10 Win64"
+ ) else (
+ set CMAKE_GENERATOR="Visual Studio 10"
+ )
+ )
+ ) else (
set USE_NMAKE=1
echo This script defaults to nmake. To use Visual Studio GUI specify
"VSSolution" as a parameter.
)
+
) else if defined sdkdir (
+ echo Detected Windows SDK %TARGET_PLATFORM%-%TARGET_CPU%
if "%TARGET_CPU%" == "x86" (
set ARCH=i386
- )
- if "%TARGET_CPU%" == "x64" (
+ ) else if "%TARGET_CPU%" == "x64" (
set ARCH=amd64
)
+
set BUILD_ENVIRONMENT=SDK
set USE_NMAKE=1
- echo Detected Windows SDK %TARGET_PLATFORM%-%ARCH%
-)
-:: Detect NMAKE JOM
-if %USE_NMAKE% == 1 (
- cmd /c jom /version 2>&1 | find "jom version" > NUL &&
set USE_NMAKE=2
+) else (
+ echo Error: Unable to detect build environment. Configure script failure.
+ exit /b
)
:: Checkpoint
if not defined ARCH (
- goto fail
+ echo unknown build architecture
+ exit /b
)
-if not defined BUILD_ENVIRONMENT (
- goto fail
+:: Detect nmake generator
+if %USE_NMAKE% == 1 (
+ if /I "%1" == "CodeBlocks" (
+ set CMAKE_GENERATOR="CodeBlocks - NMake Makefiles"
+ ) else if /I "%1" == "Eclipse" (
+ set CMAKE_GENERATOR="Eclipse CDT4 - NMake Makefiles"
+ ) else if /I "%1" == "JOM" (
+ set CMAKE_GENERATOR="NMake Makefiles JOM"
+ ) else (
+ set CMAKE_GENERATOR="NMake Makefiles"
+ )
)
:: Create directories
@@ -90,43 +129,7 @@
)
set REACTOS_BUILD_TOOLS_DIR=%CD%
-if "%BUILD_ENVIRONMENT%" == "MinGW" (
- if /I "%1" == "Codeblocks" (
- cmake -G "CodeBlocks - MinGW Makefiles" -DARCH=%ARCH%
%REACTOS_SOURCE_DIR%
- ) else if /I "%1" == "Eclipse" (
- cmake -G "Eclipse CDT4 - MinGW Makefiles" -DARCH=%ARCH%
%REACTOS_SOURCE_DIR%
- ) else (
- cmake -G "MinGW Makefiles" -DARCH=%ARCH% %REACTOS_SOURCE_DIR%
- )
-) else if defined USE_NMAKE (
- if /I "%1" == "CodeBlocks" (
- cmake -G "CodeBlocks - NMake Makefiles" -DARCH=%ARCH%
%REACTOS_SOURCE_DIR%
- ) else if /I "%1" == "Eclipse" (
- cmake -G "Eclipse CDT4 - NMake Makefiles" -DARCH=%ARCH%
%REACTOS_SOURCE_DIR%
- ) else if %USE_NMAKE% == 2 (
- cmake -G "NMake Makefiles JOM" -DARCH=%ARCH% %REACTOS_SOURCE_DIR%
- ) else (
- 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%
- )
-)
+cmake -G %CMAKE_GENERATOR% -DARCH=%ARCH% %REACTOS_SOURCE_DIR%
cd..
echo Preparing reactos...
@@ -136,41 +139,11 @@
)
if "%BUILD_ENVIRONMENT%" == "MinGW" (
- if /I "%1" == "CodeBlocks" (
- cmake -G "CodeBlocks - MinGW Makefiles" -DENABLE_CCACHE=0
-DCMAKE_TOOLCHAIN_FILE=toolchain-gcc.cmake -DARCH=%ARCH%
-DREACTOS_BUILD_TOOLS_DIR:DIR="%REACTOS_BUILD_TOOLS_DIR%" %REACTOS_SOURCE_DIR%
- ) else if /I "%1" == "Eclipse" (
- cmake -G "Eclipse CDT4 - MinGW Makefiles" -DENABLE_CCACHE=0
-DCMAKE_TOOLCHAIN_FILE=toolchain-gcc.cmake -DARCH=%ARCH%
-DREACTOS_BUILD_TOOLS_DIR:DIR="%REACTOS_BUILD_TOOLS_DIR%" %REACTOS_SOURCE_DIR%
- ) else (
- cmake -G "MinGW Makefiles" -DENABLE_CCACHE=0
-DCMAKE_TOOLCHAIN_FILE=toolchain-gcc.cmake -DARCH=%ARCH%
-DREACTOS_BUILD_TOOLS_DIR:DIR="%REACTOS_BUILD_TOOLS_DIR%" %REACTOS_SOURCE_DIR%
- )
-) else if defined USE_NMAKE (
- if /I "%1" == "CodeBlocks" (
- cmake -G "CodeBlocks - NMake Makefiles"
-DCMAKE_TOOLCHAIN_FILE=toolchain-msvc.cmake -DUSE_WDK_HEADERS=%USE_WDK_HEADERS%
-DARCH=%ARCH% -DREACTOS_BUILD_TOOLS_DIR:DIR="%REACTOS_BUILD_TOOLS_DIR%"
%REACTOS_SOURCE_DIR%
- ) else if /I "%1" == "Eclipse" (
- cmake -G "Eclipse CDT4 - NMake Makefiles"
-DCMAKE_TOOLCHAIN_FILE=toolchain-msvc.cmake -DUSE_WDK_HEADERS=%USE_WDK_HEADERS%
-DARCH=%ARCH% -DREACTOS_BUILD_TOOLS_DIR:DIR="%REACTOS_BUILD_TOOLS_DIR%"
%REACTOS_SOURCE_DIR%
- ) else if %USE_NMAKE% == 2 (
- cmake -G "NMake Makefiles JOM"
-DCMAKE_TOOLCHAIN_FILE=toolchain-msvc.cmake -DUSE_WDK_HEADERS=%USE_WDK_HEADERS%
-DARCH=%ARCH% -DREACTOS_BUILD_TOOLS_DIR:DIR="%REACTOS_BUILD_TOOLS_DIR%"
%REACTOS_SOURCE_DIR%
- ) else (
- cmake -G "NMake Makefiles" -DCMAKE_TOOLCHAIN_FILE=toolchain-msvc.cmake
-DUSE_WDK_HEADERS=%USE_WDK_HEADERS% -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%
- )
+ cmake -G %CMAKE_GENERATOR% -DENABLE_CCACHE=0
-DCMAKE_TOOLCHAIN_FILE=toolchain-gcc.cmake -DARCH=%ARCH%
-DREACTOS_BUILD_TOOLS_DIR:DIR="%REACTOS_BUILD_TOOLS_DIR%" %REACTOS_SOURCE_DIR%
+) else if "%BUILD_ENVIRONMENT%" == "WDK" (
+ cmake -G %CMAKE_GENERATOR% -DCMAKE_TOOLCHAIN_FILE=toolchain-msvc.cmake
-DUSE_WDK_HEADERS=%USE_WDK_HEADERS% -DARCH=%ARCH%
-DREACTOS_BUILD_TOOLS_DIR:DIR="%REACTOS_BUILD_TOOLS_DIR%" %REACTOS_SOURCE_DIR%
+) else (
+ cmake -G %CMAKE_GENERATOR% -DCMAKE_TOOLCHAIN_FILE=toolchain-msvc.cmake -DARCH=%ARCH%
-DREACTOS_BUILD_TOOLS_DIR:DIR="%REACTOS_BUILD_TOOLS_DIR%" %REACTOS_SOURCE_DIR%
)
cd..
@@ -178,10 +151,6 @@
echo Configure script complete! Enter directories and execute appropriate build
commands(ex: make, nmake, jom, etc...).
exit /b
-:fail
-echo Error: Unable to detect build environment. Configure script failure.
-exit /b
-
:cmake_notfound
echo Unable to find cmake, if it is installed, check your PATH variable.
exit /b