Difference between revisions of "CMake"

From ReactOS Wiki
Jump to: navigation, search
Line 31: Line 31:
 
  configure.cmd VSSolution
 
  configure.cmd VSSolution
  
After executing <tt>configure.cmd</tt> or <tt>configure.cmd VSSolution</tt> in root of ReactOS tree will be created folder output-MinGW-i386 or output-VS9-i386. You need to go there:
+
After executing <tt>configure.cmd</tt> or <tt>configure.cmd VSSolution</tt> in root of ReactOS tree will be created folder output-MinGW-i386 or output-VS9-i386. You wiil be redirected to it.
 
 
cd output-MinGW-i386    ---- when using gcc
 
cd output-VS9-i386      ---- when using nmake/msbuild
 
  
 
== Building Tools==
 
== Building Tools==

Revision as of 10:33, 17 May 2011

CMake is a cross-platform build system. It is a proposed alternative to RBuild.

Latest version (cmake 2.8.4) has a bug (cmake bug report). Please comment the line "set_property(GLOBAL PROPERTY RULE_MESSAGES OFF)" in root CMakeLists.txt. (place a # in front of it)

Preparing the Build Environment

First you need to download and install Cmake build system from here

To build using CMake the cmake-bringup branch (now also trunk is supported) must first be checked out.

On Windows only : Navigate to the tools subfolder in the RosBE folder and copy make.exe to mingw32-make.exe.

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:

configure.cmd

if you are using Linux/Unix use:

configure.sh

This command is located in the root of recent revisions of cmake branch and must be run in the directory the branch was checked out.

Visual Studio and Microsoft Visual C++

To prepare the location for use with Visual Studio or Microsoft Visual C++ open a Windows DDK/WDK/Visual Studio command prompt and enter the command above.

Generating Visual Studio solution files

To generate Visual Studio solution files instead use the following (from Windows DDK/WDK/Visual Studio command prompt):

configure.cmd VSSolution

After executing configure.cmd or configure.cmd VSSolution in root of ReactOS tree will be created folder output-MinGW-i386 or output-VS9-i386. You wiil be redirected to it.

Building Tools

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

cd host-tools
make
cd ..

If you are using Visual Studio or Microsoft Visual C++(and you executed configure.cmd earlier from DDK/WDK/VS command prompt) use nmake instead of make:

cd host-tools
nmake
cd ..

If you are using Visual Studio or Microsoft Visual C++(and you executed configure.cmd VSSolution earlier from DDK/WDK/VS command prompt) use msbuild instead of make(there are few solutions/projects in folder so you must specify solution/project name after msbuild):

cd host-tools
msbuild reactos.sln
cd ..

If you have problems with building things from command line go here. This must help.

And of course you can use IDE with GUI instead of doing this in command line. If you still have questions go here

If you want to build ReactOS with both nmake and msbuild you need to create another folder for one of them(because by default configure.cmd creates output-VS9-i386 for both and files will be mixed). For example to use for nmake build folder output-VS9nmake-i386 you need to do next:

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 Modules much Faster (CMake feature)

NOTE: 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.

NOTE2: 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