3 :: Special case %1 = arm_hosttools %2 = vcvarsall.bat %3 = %CMAKE_GENERATOR%
4 if /I "%1" == "arm_hosttools" (
5 echo Configuring x86 host tools for ARM cross build
7 :: This launches %VSINSTALLDIR%VS\vcvarsall.bat
10 :: Configure host tools for x86
11 cmake -G %3 -DARCH=i386 %~dp0
15 :: Get the source root directory
16 set REACTOS_SOURCE_DIR=%~dp0
19 :: Detect presence of cmake
20 cmd /c cmake --version 2>&1 | find "cmake version" > NUL || goto cmake_notfound
22 :: Detect build environment (MinGW, VS, WDK, ...)
24 echo Detected RosBE for %ROS_ARCH%
25 set BUILD_ENVIRONMENT=MinGW
27 if /I "%1" == "Codeblocks" (
28 set CMAKE_GENERATOR="CodeBlocks - MinGW Makefiles"
29 ) else if /I "%1" == "Eclipse" (
30 set CMAKE_GENERATOR="Eclipse CDT4 - MinGW Makefiles"
31 ) else if /I "%1" == "Ninja" (
32 set CMAKE_GENERATOR="Ninja"
34 set CMAKE_GENERATOR="MinGW Makefiles"
37 ) else if defined DDK_TARGET_OS (
38 echo Detected DDK/WDK for %DDK_TARGET_OS%-%_BUILDARCH%%
39 set BUILD_ENVIRONMENT=WDK
40 if "%_BUILDARCH%" == "x86" (
42 ) else if "%_BUILDARCH%" == "AMD64" (
48 ) else if defined VCINSTALLDIR (
49 :: VS command prompt does not put this in enviroment vars
50 cl 2>&1 | find "x86" > NUL && set ARCH=i386
51 cl 2>&1 | find "x64" > NUL && set ARCH=amd64
52 cl 2>&1 | find "ARM" > NUL && set ARCH=arm
53 cl 2>&1 | find "14." > NUL && set BUILD_ENVIRONMENT=VS8
54 cl 2>&1 | find "15." > NUL && set BUILD_ENVIRONMENT=VS9
55 cl 2>&1 | find "16." > NUL && set BUILD_ENVIRONMENT=VS10
56 cl 2>&1 | find "17." > NUL && set BUILD_ENVIRONMENT=VS11
57 if not defined BUILD_ENVIRONMENT (
58 echo Error: Visual Studio version too old or version detection failed.
62 echo Detected Visual Studio Environment %BUILD_ENVIRONMENT%-%ARCH%
63 if /I "%1" == "VSSolution" (
64 if "%BUILD_ENVIRONMENT%" == "VS8" (
65 if "%ARCH%" == "amd64" (
66 set CMAKE_GENERATOR="Visual Studio 8 2005 Win64"
68 set CMAKE_GENERATOR="Visual Studio 8 2005"
70 ) else if "%BUILD_ENVIRONMENT%" == "VS9" (
71 if "%ARCH%" == "amd64" (
72 set CMAKE_GENERATOR="Visual Studio 9 2008 Win64"
74 set CMAKE_GENERATOR="Visual Studio 9 2008"
76 ) else if "%BUILD_ENVIRONMENT%" == "VS10" (
77 if "%ARCH%" == "amd64" (
78 set CMAKE_GENERATOR="Visual Studio 10 Win64"
80 set CMAKE_GENERATOR="Visual Studio 10"
82 ) else if "%BUILD_ENVIRONMENT%" == "VS11" (
83 if "%ARCH%" == "amd64" (
84 set CMAKE_GENERATOR="Visual Studio 11 Win64"
85 ) else if "%ARCH%" == "arm" (
86 set CMAKE_GENERATOR="Visual Studio 11 ARM"
88 set CMAKE_GENERATOR="Visual Studio 11"
93 echo This script defaults to nmake. To use Visual Studio GUI specify "VSSolution" as a parameter.
96 ) else if defined sdkdir (
97 echo Detected Windows SDK %TARGET_PLATFORM%-%TARGET_CPU%
98 if "%TARGET_CPU%" == "x86" (
100 ) else if "%TARGET_CPU%" == "x64" (
104 set BUILD_ENVIRONMENT=SDK
108 echo Error: Unable to detect build environment. Configure script failure.
113 if not defined ARCH (
114 echo unknown build architecture
118 :: Detect nmake generator
119 if %USE_NMAKE% == 1 (
120 if /I "%1" == "CodeBlocks" (
121 set CMAKE_GENERATOR="CodeBlocks - NMake Makefiles"
122 ) else if /I "%1" == "Eclipse" (
123 set CMAKE_GENERATOR="Eclipse CDT4 - NMake Makefiles"
124 ) else if /I "%1" == "JOM" (
125 set CMAKE_GENERATOR="NMake Makefiles JOM"
126 ) else if /I "%1" == "Ninja" (
127 set CMAKE_GENERATOR="Ninja"
129 set CMAKE_GENERATOR="NMake Makefiles"
133 :: Create directories
134 set REACTOS_OUTPUT_PATH=output-%BUILD_ENVIRONMENT%-%ARCH%
135 if "%REACTOS_SOURCE_DIR%" == "%CD%\" (
136 echo Creating directories in %REACTOS_OUTPUT_PATH%
138 if not exist %REACTOS_OUTPUT_PATH% (
139 mkdir %REACTOS_OUTPUT_PATH%
141 cd %REACTOS_OUTPUT_PATH%
144 if not exist host-tools (
147 if not exist reactos (
151 echo Preparing host tools...
153 if EXIST CMakeCache.txt (
154 del CMakeCache.txt /q
156 set REACTOS_BUILD_TOOLS_DIR=%CD%
158 :: Use x86 for ARM host tools
159 if "%ARCH%" == "arm" (
160 :: Launch new script instance for x86 host tools configuration
161 start "Preparing host tools for ARM cross build..." /I /B /WAIT %~dp0configure.cmd arm_hosttools "%VSINSTALLDIR%VC\vcvarsall.bat" %CMAKE_GENERATOR%
163 cmake -G %CMAKE_GENERATOR% -DARCH=%ARCH% "%REACTOS_SOURCE_DIR%"
168 echo Preparing reactos...
170 if EXIST CMakeCache.txt (
171 del CMakeCache.txt /q
174 if "%BUILD_ENVIRONMENT%" == "MinGW" (
175 cmake -G %CMAKE_GENERATOR% -DENABLE_CCACHE=0 -DPCH=0 -DCMAKE_TOOLCHAIN_FILE=toolchain-gcc.cmake -DARCH=%ARCH% -DREACTOS_BUILD_TOOLS_DIR:DIR="%REACTOS_BUILD_TOOLS_DIR%" "%REACTOS_SOURCE_DIR%"
176 ) else if "%BUILD_ENVIRONMENT%" == "WDK" (
177 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%"
179 cmake -G %CMAKE_GENERATOR% -DCMAKE_TOOLCHAIN_FILE=toolchain-msvc.cmake -DARCH=%ARCH% -DREACTOS_BUILD_TOOLS_DIR:DIR="%REACTOS_BUILD_TOOLS_DIR%" "%REACTOS_SOURCE_DIR%"
184 echo Configure script complete! Enter directories and execute appropriate build commands(ex: make, nmake, jom, etc...).
188 echo Unable to find cmake, if it is installed, check your PATH variable.