Difference between revisions of "How to build VCMI (Linux)"
(→Configure external program configure) |
(→Setting up a development environment using Eclipse CDT) |
||
Line 2: | Line 2: | ||
There is a guide for compiling and running VCMI located in the SVN trunk root directory: [https://vcmi.svn.sourceforge.net/svnroot/vcmi/trunk/README.linux README.linux] | There is a guide for compiling and running VCMI located in the SVN trunk root directory: [https://vcmi.svn.sourceforge.net/svnroot/vcmi/trunk/README.linux README.linux] | ||
− | = Setting up a development environment using | + | = Setting up a development environment using QtCreator = |
− | |||
− | + | QtCreator is the recommended IDE for VCMI development on linux distros. (It may be used on other operating systems as well) It has the following advantages compared to other IDEs: | |
− | + | * Almost no manual configuration when used with CMake (Project configuration is read from CMake text files) | |
+ | * Fast parser/indexer, stable | ||
+ | * Can use several compiler toolchains: GCC, Visual Studio, Clang | ||
+ | * Doesn't pollute SVN with project files | ||
− | + | You can download QtCreator from here: http://qt-project.org/downloads#qt-creator | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | == | + | == Configuration == |
+ | To open the project you have to click File -> Open file or project... -> Select /trunk/src/CMakeLists.txt | ||
+ | For the first time and for every CMake project configuration change you have to execute CMake. This step can be done when opening the project for the first time or alternatively via the left bar -> Projects -> Build Settings -> Execute CMake. You have to specify CMake arguments and the build dir. CMake arguments can be the following: | ||
+ | <pre>-DDISABLE_ERM=ON -DCMAKE_BUILD_TYPE=Debug</pre> | ||
+ | The build dir should be set to sth. like /trunk/build for the debug build and /trunk/buildrel for the release build. | ||
+ | For cleaning the build dir a command like "make clean" may be not enough. Better way is to delete the build dir, re-create it and re-execute CMake. Steps for cleaning can be configured in the Projects tab as well. | ||
− | === | + | == Debugging == |
− | + | There is a problem with QtCreator when debugging both vcmiclient and vcmiserver. If you debug the vcmiclient, start a game, attach the vcmiserver process to the gdb debugger(Debug > Start Debugging > Attach to Running External Application...) then breakpoints which are set for vcmiserver will be ignored. This looks like a bug, in any case it's not intuitively. Two workarounds are available luckily: | |
− | |||
− | |||
− | |||
− | + | 1) Run vcmiclient (no debug mode), then attach server process to the debugger | |
− | + | 2) Open two instances of QtCreator and debug vcmiserver and vcmiclient separately(it works!) | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− |
Revision as of 17:06, 22 October 2012
Contents
Compiling VCMI
There is a guide for compiling and running VCMI located in the SVN trunk root directory: README.linux
Setting up a development environment using QtCreator
QtCreator is the recommended IDE for VCMI development on linux distros. (It may be used on other operating systems as well) It has the following advantages compared to other IDEs:
- Almost no manual configuration when used with CMake (Project configuration is read from CMake text files)
- Fast parser/indexer, stable
- Can use several compiler toolchains: GCC, Visual Studio, Clang
- Doesn't pollute SVN with project files
You can download QtCreator from here: http://qt-project.org/downloads#qt-creator
Configuration
To open the project you have to click File -> Open file or project... -> Select /trunk/src/CMakeLists.txt For the first time and for every CMake project configuration change you have to execute CMake. This step can be done when opening the project for the first time or alternatively via the left bar -> Projects -> Build Settings -> Execute CMake. You have to specify CMake arguments and the build dir. CMake arguments can be the following:
-DDISABLE_ERM=ON -DCMAKE_BUILD_TYPE=Debug
The build dir should be set to sth. like /trunk/build for the debug build and /trunk/buildrel for the release build. For cleaning the build dir a command like "make clean" may be not enough. Better way is to delete the build dir, re-create it and re-execute CMake. Steps for cleaning can be configured in the Projects tab as well.
Debugging
There is a problem with QtCreator when debugging both vcmiclient and vcmiserver. If you debug the vcmiclient, start a game, attach the vcmiserver process to the gdb debugger(Debug > Start Debugging > Attach to Running External Application...) then breakpoints which are set for vcmiserver will be ignored. This looks like a bug, in any case it's not intuitively. Two workarounds are available luckily:
1) Run vcmiclient (no debug mode), then attach server process to the debugger
2) Open two instances of QtCreator and debug vcmiserver and vcmiclient separately(it works!)