mirror of
https://github.com/reactos/reactos.git
synced 2024-06-29 17:31:31 +00:00
[CMAKE]
Improve configure script to allow passing multiple arguments, like "configure VSSolution RTC". Add a small help command ("help" or "/?"), allow passing CMake parameters like -DFOO:BOOL=TRUE after our custom parameters. svn path=/trunk/; revision=64971
This commit is contained in:
parent
33e318ed91
commit
40369c24e3
|
@ -7,6 +7,17 @@
|
|||
:: Precisely needed for configuring Visual Studio Environment.
|
||||
setlocal enabledelayedexpansion
|
||||
|
||||
:: Does the user need help?
|
||||
if /I "%1" == "help" goto help
|
||||
if /I "%1" == "/?" (
|
||||
:help
|
||||
echo Help for configure script
|
||||
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
|
||||
exit /b
|
||||
)
|
||||
|
||||
:: Special case %1 = arm_hosttools %2 = vcvarsall.bat %3 = %CMAKE_GENERATOR%
|
||||
if /I "%1" == "arm_hosttools" (
|
||||
echo Configuring x86 host tools for ARM cross build
|
||||
|
@ -21,7 +32,10 @@ if /I "%1" == "arm_hosttools" (
|
|||
|
||||
:: Get the source root directory
|
||||
set REACTOS_SOURCE_DIR=%~dp0
|
||||
set USE_VSCMD=0
|
||||
|
||||
:: Set default generator
|
||||
set CMAKE_GENERATOR="Ninja"
|
||||
set CMAKE_GENERATOR_HOST=!CMAKE_GENERATOR!
|
||||
|
||||
:: Detect presence of cmake
|
||||
cmd /c cmake --version 2>&1 | find "cmake version" > NUL || goto cmake_notfound
|
||||
|
@ -31,71 +45,25 @@ if defined ROS_ARCH (
|
|||
echo Detected RosBE for %ROS_ARCH%
|
||||
set BUILD_ENVIRONMENT=MinGW
|
||||
set ARCH=%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 if /I "%1" == "Makefiles" (
|
||||
set CMAKE_GENERATOR="MinGW Makefiles"
|
||||
) else if /I "%1" == "clang" (
|
||||
set BUILD_ENVIRONMENT=Clang
|
||||
set CMAKE_GENERATOR="Ninja"
|
||||
) else (
|
||||
set CMAKE_GENERATOR="Ninja"
|
||||
)
|
||||
set MINGW_TOOCHAIN_FILE=toolchain-gcc.cmake
|
||||
|
||||
) else if defined VCINSTALLDIR (
|
||||
:: VS command prompt does not put this in environment vars
|
||||
cl 2>&1 | find "x86" > NUL && set ARCH=i386
|
||||
cl 2>&1 | find "x64" > NUL && set ARCH=amd64
|
||||
cl 2>&1 | find "ARM" > NUL && set ARCH=arm
|
||||
cl 2>&1 | find "15.00." > NUL && set BUILD_ENVIRONMENT=VS9
|
||||
cl 2>&1 | find "16.00." > NUL && set BUILD_ENVIRONMENT=VS10
|
||||
cl 2>&1 | find "17.00." > NUL && set BUILD_ENVIRONMENT=VS11
|
||||
cl 2>&1 | find "18.00." > NUL && set BUILD_ENVIRONMENT=VS12
|
||||
if not defined BUILD_ENVIRONMENT (
|
||||
cl 2>&1 | find "15.00." > NUL && set VS_VERSION=9
|
||||
cl 2>&1 | find "16.00." > NUL && set VS_VERSION=10
|
||||
cl 2>&1 | find "17.00." > NUL && set VS_VERSION=11
|
||||
cl 2>&1 | find "18.00." > NUL && set VS_VERSION=12
|
||||
if not defined VS_VERSION (
|
||||
echo Error: Visual Studio version too old or version detection failed.
|
||||
exit /b
|
||||
)
|
||||
|
||||
echo Detected Visual Studio Environment !BUILD_ENVIRONMENT!-!ARCH!
|
||||
if /I "%1" == "VSSolution" (
|
||||
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 if "!BUILD_ENVIRONMENT!" == "VS11" (
|
||||
if "!ARCH!" == "amd64" (
|
||||
set CMAKE_GENERATOR="Visual Studio 11 Win64"
|
||||
) else if "!ARCH!" == "arm" (
|
||||
set CMAKE_GENERATOR="Visual Studio 11 ARM"
|
||||
set CMAKE_GENERATOR_HOST="Visual Studio 11"
|
||||
) else (
|
||||
set CMAKE_GENERATOR="Visual Studio 11"
|
||||
)
|
||||
) else if "!BUILD_ENVIRONMENT!" == "VS12" (
|
||||
if "!ARCH!" == "amd64" (
|
||||
set CMAKE_GENERATOR="Visual Studio 12 Win64"
|
||||
) else if "!ARCH!" == "arm" (
|
||||
set CMAKE_GENERATOR="Visual Studio 12 ARM"
|
||||
set CMAKE_GENERATOR_HOST="Visual Studio 12"
|
||||
) else (
|
||||
set CMAKE_GENERATOR="Visual Studio 12"
|
||||
)
|
||||
)
|
||||
) else (
|
||||
set USE_VSCMD=1
|
||||
echo This script defaults to Ninja. To use Visual Studio GUI specify "VSSolution" as a parameter.
|
||||
)
|
||||
|
||||
set BUILD_ENVIRONMENT=VS
|
||||
set VS_SOLUTION=0
|
||||
set VS_RUNTIME_CHECKS=0
|
||||
echo Detected Visual Studio Environment !BUILD_ENVIRONMENT!!VS_VERSION!-!ARCH!
|
||||
) else (
|
||||
echo Error: Unable to detect build environment. Configure script failure.
|
||||
exit /b
|
||||
|
@ -107,20 +75,76 @@ if not defined ARCH (
|
|||
exit /b
|
||||
)
|
||||
|
||||
:: Detect VS command line generator
|
||||
if %USE_VSCMD% == 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" == "Makefiles" (
|
||||
set CMAKE_GENERATOR="NMake Makefiles"
|
||||
:: Parse command line parameters
|
||||
:repeat
|
||||
if "%BUILD_ENVIRONMENT%" == "MinGW" (
|
||||
if /I "%1" == "Codeblocks" (
|
||||
set CMAKE_GENERATOR="CodeBlocks - MinGW Makefiles"
|
||||
) else if /I "%1" == "Eclipse" (
|
||||
set CMAKE_GENERATOR="Eclipse CDT4 - MinGW Makefiles"
|
||||
) else if /I "%1" == "Makefiles" (
|
||||
set CMAKE_GENERATOR="MinGW Makefiles"
|
||||
) else if /I "%1" == "clang" (
|
||||
set MINGW_TOOCHAIN_FILE=toolchain-clang.cmake
|
||||
) else (
|
||||
goto continue
|
||||
)
|
||||
) else (
|
||||
set CMAKE_GENERATOR="Ninja"
|
||||
)
|
||||
if "!ARCH!" == "arm" (
|
||||
set CMAKE_GENERATOR_HOST=!CMAKE_GENERATOR!
|
||||
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" == "Makefiles" (
|
||||
set CMAKE_GENERATOR="NMake Makefiles"
|
||||
) else if /I "%1" == "VSSolution" (
|
||||
set VS_SOLUTION=1
|
||||
if "!VS_VERSION!" == "9" (
|
||||
if "!ARCH!" == "amd64" (
|
||||
set CMAKE_GENERATOR="Visual Studio 9 2008 Win64"
|
||||
) else (
|
||||
set CMAKE_GENERATOR="Visual Studio 9 2008"
|
||||
)
|
||||
) else if "!VS_VERSION!" == "10" (
|
||||
if "!ARCH!" == "amd64" (
|
||||
set CMAKE_GENERATOR="Visual Studio 10 Win64"
|
||||
) else (
|
||||
set CMAKE_GENERATOR="Visual Studio 10"
|
||||
)
|
||||
) else if "!VS_VERSION!" == "11" (
|
||||
if "!ARCH!" == "amd64" (
|
||||
set CMAKE_GENERATOR="Visual Studio 11 Win64"
|
||||
) else if "!ARCH!" == "arm" (
|
||||
set CMAKE_GENERATOR="Visual Studio 11 ARM"
|
||||
set CMAKE_GENERATOR_HOST="Visual Studio 11"
|
||||
) else (
|
||||
set CMAKE_GENERATOR="Visual Studio 11"
|
||||
)
|
||||
) else if "!VS_VERSION!" == "12" (
|
||||
if "!ARCH!" == "amd64" (
|
||||
set CMAKE_GENERATOR="Visual Studio 12 Win64"
|
||||
) else if "!ARCH!" == "arm" (
|
||||
set CMAKE_GENERATOR="Visual Studio 12 ARM"
|
||||
set CMAKE_GENERATOR_HOST="Visual Studio 12"
|
||||
) else (
|
||||
set CMAKE_GENERATOR="Visual Studio 12"
|
||||
)
|
||||
)
|
||||
) else if /I "%1" == "RTC" (
|
||||
echo Runtime checks enabled
|
||||
set VS_RUNTIME_CHECKS=1
|
||||
) else (
|
||||
goto continue
|
||||
)
|
||||
)
|
||||
|
||||
:: Go to next parameter
|
||||
SHIFT
|
||||
goto repeat
|
||||
:continue
|
||||
|
||||
:: Inform the user about the default build
|
||||
if "!CMAKE_GENERATOR!" == "Ninja" (
|
||||
echo This script defaults to Ninja. Type "configure help" for alternative options.
|
||||
)
|
||||
|
||||
:: Create directories
|
||||
|
@ -165,11 +189,9 @@ if EXIST CMakeCache.txt (
|
|||
)
|
||||
|
||||
if "%BUILD_ENVIRONMENT%" == "MinGW" (
|
||||
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%"
|
||||
) else if "%BUILD_ENVIRONMENT%" == "Clang" (
|
||||
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%"
|
||||
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%"
|
||||
) else (
|
||||
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%"
|
||||
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..
|
||||
|
|
Loading…
Reference in a new issue