CMake

From ReactOS
Jump to: navigation, search
Imbox notice.png Notice: This page is deprecated and is purely here for archival purposes. For instructions on building ReactOS, please see the build environment page of the development guide.

CMake is a cross-platform build system.

r56105 implements cmake RC handling, but mentions a bug in cmake. That bug is located here.

Contents

Preparing the Build Environment

First you need to download and install ReactOS Build Environment here

Since revision r51836, trunk can be built using cmake.

Precompiled Headers Support (PCH)

For reduced build time, Precompiled Headers Support was introduced. Next you should enable this feature in ReactOS CMake configure script (configure.cmd/configure.sh) by changing -DPCH=0 to -DPCH=1.

Preparing the Output Location

Before building either the tools or ReactOS itself the output location must be created and prepared. This is an easy step and involves only one command. This command is located in the root of recent revisions of the source code and can be run either from the root directory itself or any other directory you want the build your sources in.

Linux/Unix

Run:

configure.sh

Windows

Both MinGW and Microsoft Visual C++ compiler is supported. Command is very similar with slightly different output location.

MinGW

Run:

configure.cmd

After executing, folder output-MinGW-i386 will be created in root of ReactOS tree. You will be redirected to it.

Visual Studio and Microsoft Visual C++

To prepare the location for use with Visual Studio or Microsoft Visual C++:

  1. Open a Windows DDK/WDK/Visual Studio command prompt.
  2. There are two methods to compile using Microsoft Visual C++.
  • If you prefer older method of building, just configure as usual:
configure.cmd
  • To generate Visual Studio solution files instead, using the following command:
configure.cmd VSSolution
Note: compiling with Visual Studio or with msbuild is not working yet. VSSolution is only provided for convenient soure code editing and browsing.

After executing, folder output-VS9-i386 or output-VS10-i386 will be created in root of ReactOS tree. You will be redirected to it.

Building Tools

To build the branch, build tools must be compiled first. This only needs to be done for the first build and whenever there is a change to the build tools.

From your output directory, go to host-tools. Follow specific instruction for your compiler.

 cd host-tools

MinGW

make

Visual Studio or Microsoft Visual C++

nmake

To generate Visual Studio solution files too, create another folder – because by default, configure.cmd uses the same folder name, which leads to mixed files. For example to use for nmake build folder output-VS9nmake-i386 you should do the following:

 mkdir output-VS9nmake-i386
 cd output-VS9nmake-i386
 ..\configure.cmd

And then build host tools as usual:

 cd host-tools
 nmake
 cd ..

With the build tools compiled, ReactOS can now be compiled. In the case of CMakeLists being updated it is best to remove the content of the build-ros folder and rebuild ReactOS.

 cd reactos
 make

Combining the above steps together:

 configure.cmd
 cd host-tools
 make
 cd ../reactos
 make

Building ReactOS

Building Modules

To build a specific module (i.e: "win32k" ) you can follow the next steps: Building Modules

Building ReactOS with nmake/msbuild

If you want to build ReactOS with nmake you can receive such error during building

'mc' is not recognized as an internal or external command,operable program or batch file.

Seems you are using Microsoft Visual C++ Express Edition. Go here for getting info and working around the issue. It might also be possible to use "windmc" from MinGW binutils as an alternative implementation of MC.exe.

Building Modules much Faster (CMake feature)

Imbox notice.png Notice: The following syntax can be used just with CMake.

CMake implements a feature that can speed up the modules building process using the Fast syntax. You can use the Fast syntax if your changes just affects one module and does not change any code of others modules that the Desired module depends on. This /fast syntax skips dependency checking before compiling starts, so it is terrible fast.

Imbox notice.png Notice: You need at least to have compiled the desired module once with "make Desired_module " before using the Fast syntax.

One simple example: You have changed just some "win32k" code (desired module) but you did not change any module that the desired module depends on (i.e,the PSDK headers), you have also the "Win32k-before-changes" module compiled, then you can use the Fast syntax to compile the new "win32k" module in few seconds.

Warning: The Fast syntax just will look for changes in the Desired module, not checking if any other modules have been modified.

The Fast syntax to build any module is:

make Desired_module/fast

If you want to compile Win32k, it would be:

make win32k/fast

Building a Bootcd

To build a bootcd you can follow the next steps: Building ReactOS

Building a bootcd much Faster

NOTE: This method is just available with CMake.

Thanks to Fast syntax,creating a bootcd is much faster. Before compiling bootcd with Fast syntax you have to be sure that any Dependent module has been compiled previously. "/Fast" skips dependency checking before compiling starts.

Remember: You need at least to have compiled the Desired module once with "make Desired_module " before using the bootcd Fast syntax.
Read  Building Modules much Faster for more info.

An example: "You have added some changes in win32k module and now you want a bootcd with your new modified win32k.You have,also, the "win32k-before-changes" compiled."

make win32k/fast

,as your changes are just related to win32k.

And then:

make bootcd/fast

Read the following carefully:

It's mandatory to compile at least once with "make bootcd" before using the Fast syntax.
It's mandatory to compile the module changes before invoking bootcd/fast, otherwise your changes won't be added.
If your changes are modifying modules that win32k depends on, you should use "make win32k" and then invoke "make bootcd/fast" instead.
If your changes are modifying several INDEPENDENT modules, compile all of them with Fast syntax and afterwards a perform a bootcd/fast compilation.
This method becomes less practical when you alter many modules.

See also

Personal tools
Namespaces

Variants
Actions
Navigation
Tools