[CONFIGURE] First step towards introducing a way to compile ReactOS without invoking CMake twice. NFC. CORE-10121

svn path=/trunk/; revision=69058
This commit is contained in:
Amine Khaldi 2015-09-06 16:17:26 +00:00
parent 7bc39e5dae
commit c4cd6e2035

View file

@ -15,6 +15,7 @@ if /I "%1" == "/?" (
echo Syntax: path\to\source\configure.cmd [script-options] [Cmake-options] echo Syntax: path\to\source\configure.cmd [script-options] [Cmake-options]
echo Available script-options: Codeblocks, Eclipse, Makefiles, clang, VSSolution, RTC echo Available script-options: Codeblocks, Eclipse, Makefiles, clang, VSSolution, RTC
echo Cmake-options: -DVARIABLE:TYPE=VALUE echo Cmake-options: -DVARIABLE:TYPE=VALUE
endlocal
exit /b exit /b
) )
@ -27,7 +28,8 @@ if /I "%1" == "arm_hosttools" (
:: Configure host tools for x86 :: Configure host tools for x86
cmake -G %3 -DARCH:STRING=i386 %~dp0 cmake -G %3 -DARCH:STRING=i386 %~dp0
exit endlocal
exit /b
) )
:: Get the source root directory :: Get the source root directory
@ -59,6 +61,7 @@ if defined ROS_ARCH (
cl 2>&1 | find "19.00." > NUL && set VS_VERSION=14 cl 2>&1 | find "19.00." > NUL && set VS_VERSION=14
if not defined VS_VERSION ( if not defined VS_VERSION (
echo Error: Visual Studio version too old or version detection failed. echo Error: Visual Studio version too old or version detection failed.
endlocal
exit /b exit /b
) )
set BUILD_ENVIRONMENT=VS set BUILD_ENVIRONMENT=VS
@ -67,18 +70,24 @@ if defined ROS_ARCH (
echo Detected Visual Studio Environment !BUILD_ENVIRONMENT!!VS_VERSION!-!ARCH! echo Detected Visual Studio Environment !BUILD_ENVIRONMENT!!VS_VERSION!-!ARCH!
) else ( ) else (
echo Error: Unable to detect build environment. Configure script failure. echo Error: Unable to detect build environment. Configure script failure.
endlocal
exit /b exit /b
) )
:: Checkpoint :: Checkpoint
if not defined ARCH ( if not defined ARCH (
echo Unknown build architecture echo Unknown build architecture
endlocal
exit /b exit /b
) )
set NEW_STYLE_BUILD=0
:: Parse command line parameters :: Parse command line parameters
:repeat :repeat
if "%BUILD_ENVIRONMENT%" == "MinGW" ( if /I "%1%" == "-DNEW_STYLE_BUILD" (
set NEW_STYLE_BUILD=%2
) else if "%BUILD_ENVIRONMENT%" == "MinGW" (
if /I "%1" == "Codeblocks" ( if /I "%1" == "Codeblocks" (
set CMAKE_GENERATOR="CodeBlocks - MinGW Makefiles" set CMAKE_GENERATOR="CodeBlocks - MinGW Makefiles"
) else if /I "%1" == "Eclipse" ( ) else if /I "%1" == "Eclipse" (
@ -168,9 +177,12 @@ if "%REACTOS_SOURCE_DIR%" == "%CD%\" (
cd %REACTOS_OUTPUT_PATH% cd %REACTOS_OUTPUT_PATH%
) )
if "%NEW_STYLE_BUILD%"=="0" (
if not exist host-tools ( if not exist host-tools (
mkdir host-tools mkdir host-tools
) )
if not exist reactos ( if not exist reactos (
mkdir reactos mkdir reactos
) )
@ -180,7 +192,8 @@ cd host-tools
if EXIST CMakeCache.txt ( if EXIST CMakeCache.txt (
del CMakeCache.txt /q del CMakeCache.txt /q
) )
set REACTOS_BUILD_TOOLS_DIR=%CD%
set REACTOS_BUILD_TOOLS_DIR=!CD!
:: Use x86 for ARM host tools :: Use x86 for ARM host tools
if "%ARCH%" == "arm" ( if "%ARCH%" == "arm" (
@ -192,23 +205,37 @@ if "%ARCH%" == "arm" (
cd.. cd..
)
echo Preparing reactos... echo Preparing reactos...
if "%NEW_STYLE_BUILD%"=="0" (
cd reactos cd reactos
)
if EXIST CMakeCache.txt ( if EXIST CMakeCache.txt (
del CMakeCache.txt /q del CMakeCache.txt /q
) )
if "%BUILD_ENVIRONMENT%" == "MinGW" ( if "%NEW_STYLE_BUILD%"=="0" (
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%" set BUILD_TOOLS_FLAG=-DREACTOS_BUILD_TOOLS_DIR:PATH="%REACTOS_BUILD_TOOLS_DIR%"
) else (
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%"
) )
cd.. if "%BUILD_ENVIRONMENT%" == "MinGW" (
cmake -G %CMAKE_GENERATOR% -DENABLE_CCACHE:BOOL=0 -DCMAKE_TOOLCHAIN_FILE:FILEPATH=%MINGW_TOOCHAIN_FILE% -DARCH:STRING=%ARCH% %BUILD_TOOLS_FLAG% %* "%REACTOS_SOURCE_DIR%"
) else (
cmake -G %CMAKE_GENERATOR% -DCMAKE_TOOLCHAIN_FILE:FILEPATH=toolchain-msvc.cmake -DARCH:STRING=%ARCH% %BUILD_TOOLS_FLAG% -DRUNTIME_CHECKS:BOOL=%VS_RUNTIME_CHECKS% %* "%REACTOS_SOURCE_DIR%"
)
echo Configure script complete^^! Enter directories and execute appropriate build commands (ex: ninja, make, nmake, etc...). if "%NEW_STYLE_BUILD%"=="0" (
cd..
)
echo Configure script complete^^! Execute appropriate build commands (ex: ninja, make, nmake, etc...).
endlocal
exit /b exit /b
:cmake_notfound :cmake_notfound
echo Unable to find cmake, if it is installed, check your PATH variable. echo Unable to find cmake, if it is installed, check your PATH variable.
endlocal
exit /b exit /b