- "::" instead of "REM" inside a if () in batch is evil and can cause a really nice mess from time to time.

- Changing one "exit" to "exit /b" was not nice from me in the past.
ARM build now prepares host tools nicely again and you can build em. ARM build itself dies very early due to ..\..\boot\freeldr\freeldr\arch\arm\boot.S(9) : fatal error C1083: Cannot open include file: 'ksarm.h': No such file or directory

svn path=/trunk/; revision=69191
This commit is contained in:
Daniel Reimer 2015-09-12 09:51:25 +00:00
parent eb498f8e5d
commit edca40a05a

View file

@ -1,13 +1,13 @@
@echo off @echo off
:: This is needed so as to avoid static expansion of environment variables REM This is needed so as to avoid static expansion of environment variables
:: inside if (...) conditionals. REM inside if (...) conditionals.
:: See http://stackoverflow.com/questions/305605/weird-scope-issue-in-bat-file REM See http://stackoverflow.com/questions/305605/weird-scope-issue-in-bat-file
:: for more explanation. REM for more explanation.
:: Precisely needed for configuring Visual Studio Environment. REM Precisely needed for configuring Visual Studio Environment.
setlocal enabledelayedexpansion setlocal enabledelayedexpansion
:: Does the user need help? REM Does the user need help?
if /I "%1" == "help" goto help if /I "%1" == "help" goto help
if /I "%1" == "/?" ( if /I "%1" == "/?" (
:help :help
@ -19,30 +19,29 @@ if /I "%1" == "/?" (
exit /b exit /b
) )
:: Special case %1 = arm_hosttools %2 = vcvarsall.bat %3 = %CMAKE_GENERATOR% REM Special case %1 = arm_hosttools %2 = vcvarsall.bat %3 = %CMAKE_GENERATOR%
if /I "%1" == "arm_hosttools" ( if /I "%1" == "arm_hosttools" (
echo Configuring x86 host tools for ARM cross build echo Configuring x86 host tools for ARM cross build
:: This launches %VSINSTALLDIR%VS\vcvarsall.bat REM This launches %VSINSTALLDIR%VS\vcvarsall.bat
call %2 x86 call %2 x86
:: Configure host tools for x86 REM Configure host tools for x86
cmake -G %3 -DARCH:STRING=i386 %~dp0 cmake -G %3 -DARCH:STRING=i386 %~dp0
endlocal exit
exit /b
) )
:: Get the source root directory REM Get the source root directory
set REACTOS_SOURCE_DIR=%~dp0 set REACTOS_SOURCE_DIR=%~dp0
:: Set default generator REM Set default generator
set CMAKE_GENERATOR="Ninja" set CMAKE_GENERATOR="Ninja"
set CMAKE_GENERATOR_HOST=!CMAKE_GENERATOR! set CMAKE_GENERATOR_HOST=!CMAKE_GENERATOR!
:: Detect presence of cmake REM 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, ...) REM Detect build environment (MinGW, VS, WDK, ...)
if defined ROS_ARCH ( if defined ROS_ARCH (
echo Detected RosBE for %ROS_ARCH% echo Detected RosBE for %ROS_ARCH%
set BUILD_ENVIRONMENT=MinGW set BUILD_ENVIRONMENT=MinGW
@ -50,7 +49,7 @@ if defined ROS_ARCH (
set MINGW_TOOCHAIN_FILE=toolchain-gcc.cmake set MINGW_TOOCHAIN_FILE=toolchain-gcc.cmake
) else if defined VCINSTALLDIR ( ) else if defined VCINSTALLDIR (
:: VS command prompt does not put this in environment vars REM VS command prompt does not put this in environment vars
cl 2>&1 | find "x86" > NUL && set ARCH=i386 cl 2>&1 | find "x86" > NUL && set ARCH=i386
cl 2>&1 | find "x64" > NUL && set ARCH=amd64 cl 2>&1 | find "x64" > NUL && set ARCH=amd64
cl 2>&1 | find "ARM" > NUL && set ARCH=arm cl 2>&1 | find "ARM" > NUL && set ARCH=arm
@ -74,7 +73,7 @@ if defined ROS_ARCH (
exit /b exit /b
) )
:: Checkpoint REM Checkpoint
if not defined ARCH ( if not defined ARCH (
echo Unknown build architecture echo Unknown build architecture
endlocal endlocal
@ -83,7 +82,7 @@ if not defined ARCH (
set NEW_STYLE_BUILD=0 set NEW_STYLE_BUILD=0
:: Parse command line parameters REM Parse command line parameters
:repeat :repeat
if /I "%1%" == "-DNEW_STYLE_BUILD" ( if /I "%1%" == "-DNEW_STYLE_BUILD" (
set NEW_STYLE_BUILD=%2 set NEW_STYLE_BUILD=%2
@ -156,17 +155,17 @@ set NEW_STYLE_BUILD=0
) )
) )
:: Go to next parameter REM Go to next parameter
SHIFT SHIFT
goto repeat goto repeat
:continue :continue
:: Inform the user about the default build REM Inform the user about the default build
if "!CMAKE_GENERATOR!" == "Ninja" ( if "!CMAKE_GENERATOR!" == "Ninja" (
echo This script defaults to Ninja. Type "configure help" for alternative options. echo This script defaults to Ninja. Type "configure help" for alternative options.
) )
:: Create directories REM Create directories
set REACTOS_OUTPUT_PATH=output-%BUILD_ENVIRONMENT%-%ARCH% set REACTOS_OUTPUT_PATH=output-%BUILD_ENVIRONMENT%-%ARCH%
if "%REACTOS_SOURCE_DIR%" == "%CD%\" ( if "%REACTOS_SOURCE_DIR%" == "%CD%\" (
echo Creating directories in %REACTOS_OUTPUT_PATH% echo Creating directories in %REACTOS_OUTPUT_PATH%
@ -195,9 +194,9 @@ if "%NEW_STYLE_BUILD%"=="0" (
set REACTOS_BUILD_TOOLS_DIR=!CD! set REACTOS_BUILD_TOOLS_DIR=!CD!
:: Use x86 for ARM host tools REM Use x86 for ARM host tools
if "%ARCH%" == "arm" ( if "%ARCH%" == "arm" (
:: Launch new script instance for x86 host tools configuration REM Launch new script instance for x86 host tools configuration
start "Preparing host tools for ARM cross build..." /I /B /WAIT %~dp0configure.cmd arm_hosttools "%VSINSTALLDIR%VC\vcvarsall.bat" %CMAKE_GENERATOR_HOST% start "Preparing host tools for ARM cross build..." /I /B /WAIT %~dp0configure.cmd arm_hosttools "%VSINSTALLDIR%VC\vcvarsall.bat" %CMAKE_GENERATOR_HOST%
) else ( ) else (
cmake -G %CMAKE_GENERATOR% -DARCH:STRING=%ARCH% "%REACTOS_SOURCE_DIR%" cmake -G %CMAKE_GENERATOR% -DARCH:STRING=%ARCH% "%REACTOS_SOURCE_DIR%"