Difference between revisions of "CMake"

From ReactOS Wiki
Jump to: navigation, search
(copyedit: Reorganize into sections, remove: generic build commands (link through "See also" section))
Line 1: Line 1:
Here are few steps required for compiling the branch (using Windows XP):
+
[http://www.cmake.org/ CMake] is a cross-platform build system. It is a proposed alternative to [[RBuild]].
  
 +
== Preparing the Build Environment ==
 +
To build using CMake the <tt>cmake-bringup</tt> branch must first be [[Subversion/Using the command line client#Checking out the sources|checked out]]. After obtaining the source, the following two subfolders must be created:
 +
* <tt>build</tt>
 +
* <tt>build-ros</tt>
  
1. First of all we will need CMake from the [http://www.cmake.org CMake] homepage. While installing please do not forget about adding it to the <tt>PATH</tt> variable. (You will probably need to logout from your account to apply the changes.)
+
Navigate to the tools subfolder in the RosBE folder and copy <tt>make.exe</tt> to <tt>mingw32-make.exe</tt>.
  
 +
== Building ==
 +
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.
  
2. Checkout the branch: http://svn.reactos.org/svn/reactos/branches/cmake-bringup/ (read more about subversion [[Subversion|here]])
+
cd build
 +
cmake -G "MinGW Makefiles" ..\
 +
make
 +
cd ..
  
 +
With the build tools compiled, ReactOS can now be compiled. In the case of <tt>CMakeLists</tt> being updated it is best to remove the content of the <tt>build-ros</tt> folder and rebuild ReactOS.
  
3. Create two more folders in <tt>cmake-bringup</tt>:
+
cd build-ros
 +
cmake -G "MinGW Makefiles" -DCMAKE_TOOLCHAIN_FILE=toolchain-mingw32.cmake ..\
 +
make
  
<pre>mkdir build
+
== See also ==
mkdir build-ros</pre>
+
* [[Building ReactOS]]
 +
* [[Building Modules]]
  
Now go to your RosBE folder and in 'tools' subfolder copy make.exe to mingw32-make.exe.
+
[[Category:Building]]
 
 
 
 
4. Launch the RosBE command line. First we are going to build tools (you can change <code>make</code> to <code>makex</code> to use more than one processor/core):
 
 
 
<pre>cd build
 
cmake -G "MinGW Makefiles" ..\
 
make
 
cd ..</pre>
 
 
 
 
 
5. Now we can build ReactOS source using freshly compiled tools:
 
 
 
<pre>cd build-ros
 
cmake -G "MinGW Makefiles" -DCMAKE_TOOLCHAIN_FILE=toolchain-mingw32.cmake ..\
 
make
 
(cd ..) <- optionally</pre>
 
 
 
 
 
You can also build any of the modules separately, like:
 
 
 
<pre>make icu4ros</pre>
 
 
 
 
 
Or clean any of them, like:
 
 
 
<pre>make icu4ros clean</pre>
 
 
 
 
 
List of modules and build targets is available using:
 
 
 
<pre>make help</pre>
 
 
 
 
 
To clean the whole tree (like in RBuild):
 
 
 
<pre>make clean</pre>
 
 
 
 
 
6. As build tools are not changing very often, contents of <tt>build</tt> folder can be compiled once and does not need recompilation with every commit.
 
 
 
In case of any updated CMakeLists from other folders (like ReactOS headers, libraries or apps), it is best to remove content of <tt>build-ros</tt> folder, and repeat step 5
 

Revision as of 23:35, 5 September 2010

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

Preparing the Build Environment

To build using CMake the cmake-bringup branch must first be checked out. After obtaining the source, the following two subfolders must be created:

  • build
  • build-ros

Navigate to the tools subfolder in the RosBE folder and copy make.exe to mingw32-make.exe.

Building

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 build
cmake -G "MinGW Makefiles" ..\
make
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 build-ros
cmake -G "MinGW Makefiles" -DCMAKE_TOOLCHAIN_FILE=toolchain-mingw32.cmake ..\
make

See also