Difference between revisions of "Compiling with CMake (OpenXcom)"

From UFOpaedia
Jump to navigation Jump to search
m (proofread)
m (typo)
Line 1: Line 1:
 
== Before building ==
 
== Before building ==
In addition to the OpenXcom dependencies [[Compiling (OpenXcom)#Dependencies |dependencies]], you will need CMake version 2.8.0 or later.
+
In addition to the OpenXcom [[Compiling (OpenXcom)#Dependencies |dependencies]], you will need CMake version 2.8.0 or later.
  
 
CMake can be used to build OpenXcom with differents tools. So far only the Makefile and Visual Studio have been tried. Other Generators (Xcode/Code blocks, ...) might work, but if you choose to use them, we currently have no way to make sure that they work. If broken, patches are welcome to make them work.
 
CMake can be used to build OpenXcom with differents tools. So far only the Makefile and Visual Studio have been tried. Other Generators (Xcode/Code blocks, ...) might work, but if you choose to use them, we currently have no way to make sure that they work. If broken, patches are welcome to make them work.

Revision as of 11:11, 31 August 2013

Before building

In addition to the OpenXcom dependencies, you will need CMake version 2.8.0 or later.

CMake can be used to build OpenXcom with differents tools. So far only the Makefile and Visual Studio have been tried. Other Generators (Xcode/Code blocks, ...) might work, but if you choose to use them, we currently have no way to make sure that they work. If broken, patches are welcome to make them work.

Note : Once a project has been generated, you don't need to regenerate it after updating the source. CMake will automatically check for modifications and regenerate the project for you.

Source dir/build dir: CMake allows you to separate the source directory (where the source resides) from the binary directory (where the project is generated). This allows you to always have a clean source directory (no clutter left from builds). The source and binary directories can be the same, but it's generally recommended to separate them.


Generate a build project

Using CMake GUI tool

  • Launch the CMake configuration tools. First specify the path to the OpenXcom source tree.
  • Then specify where the OpenXcom project should be generated.
  • Click on configure. The first time, CMake will ask you which kind of build tool you wish to use.
  • Now CMake will analyze your system and once finished, you will be presented with a list of options. If all is fine for you, then click on generate.

Using CMake interactive command line tools

ccmake is a command line tools which allows you to configure the build interactively. You can launch it with:

 cd "openxcom build dir" &&
 ccmake -G 'Generator name' "path to openxcom source tree"

Generator name, is the name of the build system you wish to use. You can see possible values with:

 cmake help

If omitted, cmake will default to 'Unix Makefile'. Note that this needed only the first time you generate the project.

As with the GUI, tweak the options as needed and then configure the project before generating it.


Using CMake command line tools

 cd "openxcom build dir" &&
 cmake -G 'Generator name' -DOPTION_NAME=OPTION_VALUE "path to openxcom source tree"

You can check options value with:

 cmake -L

To change the value of an option:

 cmake -DOPTION_NAME=OPTION_VALUE "path to openxcom source tree"


Once the project is generated, you can use it as you would have done without using CMake.