2011-04-03 20:21:04 +00:00
|
|
|
@echo off
|
2010-12-17 20:11:04 +00:00
|
|
|
|
2011-02-18 17:35:50 +00:00
|
|
|
:: Get the source root directory
|
|
|
|
set REACTOS_SOURCE_DIR=%~dp0
|
2011-02-21 20:11:52 +00:00
|
|
|
set USE_NMAKE=
|
2010-12-17 20:11:04 +00:00
|
|
|
|
2011-02-18 17:35:50 +00:00
|
|
|
:: Detect build environment (MinGW, VS, WDK, ...)
|
|
|
|
if defined ROS_ARCH (
|
|
|
|
set BUILD_ENVIRONMENT=MinGW
|
2011-01-22 16:25:35 +00:00
|
|
|
set ARCH=%ROS_ARCH%
|
2011-02-18 17:35:50 +00:00
|
|
|
echo Detected RosBE for %ROS_ARCH%
|
|
|
|
) else if defined DDK_TARGET_OS (
|
2011-01-22 16:05:07 +00:00
|
|
|
if "%_BUILDARCH%" == "x86" (
|
2011-01-22 16:25:35 +00:00
|
|
|
set ARCH=i386
|
2011-01-22 16:05:07 +00:00
|
|
|
)
|
2011-01-24 18:13:40 +00:00
|
|
|
if "%_BUILDARCH%" == "AMD64" (
|
|
|
|
set ARCH=amd64
|
|
|
|
)
|
2010-12-17 20:11:04 +00:00
|
|
|
set BUILD_ENVIRONMENT=WDK
|
2011-02-21 20:11:52 +00:00
|
|
|
set USE_NMAKE=1
|
2011-02-18 17:35:50 +00:00
|
|
|
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%
|
2011-02-21 20:11:52 +00:00
|
|
|
if not "%1" == "VSSolution" (
|
|
|
|
set USE_NMAKE=1
|
|
|
|
echo This script defaults to nmake. To use Visual Studio GUI specify "VSSolution" as a parameter.
|
|
|
|
)
|
2011-02-18 17:35:50 +00:00
|
|
|
) else if defined sdkdir (
|
|
|
|
if "%TARGET_CPU%" == "x86" (
|
|
|
|
set ARCH=i386
|
|
|
|
)
|
|
|
|
if "%TARGET_CPU%" == "x64" (
|
|
|
|
set ARCH=amd64
|
|
|
|
)
|
|
|
|
set BUILD_ENVIRONMENT=SDK
|
2011-02-21 20:11:52 +00:00
|
|
|
set USE_NMAKE=1
|
2011-02-18 17:35:50 +00:00
|
|
|
echo Detected Windows SDK %TARGET_PLATFORM%-%ARCH%
|
2010-12-17 20:11:04 +00:00
|
|
|
)
|
|
|
|
|
2011-02-18 17:35:50 +00:00
|
|
|
if defined ARCH if defined BUILD_ENVIRONMENT (
|
|
|
|
goto createdirs
|
|
|
|
)
|
|
|
|
|
2011-02-21 20:11:52 +00:00
|
|
|
echo Error: Unable to detect a build environment. Configure script failure.
|
2011-02-18 17:35:50 +00:00
|
|
|
exit /b
|
|
|
|
|
|
|
|
:: Create directories
|
|
|
|
:createdirs
|
|
|
|
|
|
|
|
set REACTOS_OUTPUT_PATH=output-%BUILD_ENVIRONMENT%-%ARCH%
|
2011-02-21 20:11:52 +00:00
|
|
|
if "%REACTOS_SOURCE_DIR%" == "%CD%\" (
|
2011-02-18 17:35:50 +00:00
|
|
|
echo Creating directories in %REACTOS_OUTPUT_PATH%
|
|
|
|
|
|
|
|
if not exist %REACTOS_OUTPUT_PATH% (
|
|
|
|
mkdir %REACTOS_OUTPUT_PATH%
|
|
|
|
)
|
|
|
|
cd %REACTOS_OUTPUT_PATH%
|
|
|
|
)
|
2010-12-17 20:11:04 +00:00
|
|
|
|
|
|
|
if not exist host-tools (
|
|
|
|
mkdir host-tools
|
|
|
|
)
|
2011-02-18 17:35:50 +00:00
|
|
|
if not exist reactos (
|
|
|
|
mkdir reactos
|
|
|
|
)
|
|
|
|
|
|
|
|
:hostprep
|
|
|
|
echo Preparing host tools...
|
2010-12-17 20:11:04 +00:00
|
|
|
cd host-tools
|
2011-01-24 18:13:40 +00:00
|
|
|
if EXIST CMakeCache.txt (
|
|
|
|
del CMakeCache.txt /q
|
|
|
|
)
|
2010-12-17 20:11:04 +00:00
|
|
|
set REACTOS_BUILD_TOOLS_DIR=%CD%
|
2011-02-18 17:35:50 +00:00
|
|
|
|
|
|
|
if "%BUILD_ENVIRONMENT%" == "MinGW" (
|
|
|
|
cmake -G "MinGW Makefiles" -DARCH=%ARCH% %REACTOS_SOURCE_DIR%
|
2011-02-21 20:11:52 +00:00
|
|
|
) else if defined USE_NMAKE (
|
2011-02-18 17:35:50 +00:00
|
|
|
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%
|
|
|
|
)
|
2010-12-17 20:11:04 +00:00
|
|
|
)
|
|
|
|
cd..
|
|
|
|
|
2011-02-18 17:35:50 +00:00
|
|
|
:reactprep
|
2010-12-17 20:11:04 +00:00
|
|
|
echo Preparing reactos...
|
|
|
|
|
|
|
|
cd reactos
|
2011-01-24 18:13:40 +00:00
|
|
|
if EXIST CMakeCache.txt (
|
|
|
|
del CMakeCache.txt /q
|
|
|
|
)
|
2011-02-18 17:35:50 +00:00
|
|
|
|
|
|
|
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%
|
2011-02-21 20:11:52 +00:00
|
|
|
) else if defined USE_NMAKE (
|
2011-02-18 17:35:50 +00:00
|
|
|
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%
|
|
|
|
)
|
2010-12-17 20:11:04 +00:00
|
|
|
)
|
2011-02-18 17:35:50 +00:00
|
|
|
|
2010-12-17 20:11:04 +00:00
|
|
|
cd..
|
2011-02-18 17:35:50 +00:00
|
|
|
|
|
|
|
echo Configure script complete! Enter directories and execute appropriate build commands(ex: make, nmake, etc...).
|
2010-12-17 20:11:04 +00:00
|
|
|
|