Difference between revisions of "How to build VCMI (Linux)"
(→Configure debug/run applications) |
(→Configure debug/run applications) |
||
Line 81: | Line 81: | ||
Add new launch configuration(C++ application) | Add new launch configuration(C++ application) | ||
+ | |||
Choose vcmiclient via Search project... | Choose vcmiclient via Search project... | ||
+ | |||
Make sure that Use Workspace Settings is enabled | Make sure that Use Workspace Settings is enabled | ||
+ | |||
VCMI won't start/debug if you don't set a specific environment variable due to shared libraries loading. Go to tab Environment -> New... Name = LD_LIBRARY_PATH Value = e.g. /usr/local/lib64/games/vcmi(where your shared libraries are located) | VCMI won't start/debug if you don't set a specific environment variable due to shared libraries loading. Go to tab Environment -> New... Name = LD_LIBRARY_PATH Value = e.g. /usr/local/lib64/games/vcmi(where your shared libraries are located) | ||
Then go to Project -> Properties -> C/C++ Build -> Builder settings -> Change build location to sth. like project/build(where your makefiles are located) | Then go to Project -> Properties -> C/C++ Build -> Builder settings -> Change build location to sth. like project/build(where your makefiles are located) |
Revision as of 13:54, 21 April 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 Eclipse CDT
In order to do that you should followed the guide above first.
Installing Eclipse
If you have installed Eclipse already, then you can skip this section.
- Eclipse offers a wide range of supported programming languages. The classic package only supports Java. It can be extended to support languages like C++, PHP, JavaScript, ActionScript,... via the "Install new software..."-dialog within Eclipse. Therefore you have one programming environment this means one program which provides many languages. That's the way described here. As a starting point download Eclipse Classic first. It can be obtained from here Eclipse downloads.
- Unpack the downloaded package.
tar xzf eclipse.tar.gz
- Move it to the /opt directory which is used for additional mostly not-UNIX-like programs in matters of the directory structure.
sudo mv eclipse /opt
- Adjust file access rights.
cd /opt sudo chown -R root:root eclipse sudo chmod -R +r eclipse sudo chmod +x `sudo find eclipse -type d`
- Make eclipse more accessible.
sudo touch /usr/bin/eclipse sudo chmod 755 /usr/bin/eclipse sudoedit /usr/bin/eclipse
Enter these few lines in the editor, save the file and close the editor.#!/bin/sh
export ECLIPSE_HOME="/opt/eclipse"
$ECLIPSE_HOME/eclipse $* - If you're using GNOME as the window manager then you may do the following steps. It's default on Fedora. That way you can start eclipse via the actvities window or the programs tab.
sudoedit /usr/share/applications/eclipse.desktop
Enter the following lines in the editor:
[Desktop Entry] Encoding=UTF-8 Name=Eclipse Comment=Eclipse IDE Exec=eclipse Icon=/opt/eclipse/icon.xpm Terminal=false Type=Application Categories=GNOME;Application;Development; StartupNotify=true
- Clean eclipse.
/opt/eclipse/eclipse -clean
- Start eclipse. Adjust workspace directory to sth. like: ~/Eclipse
- Go to: Help -> Install new software...
- Click on Add... and enter the Location http://download.eclipse.org/releases/indigo and Name Indigo. Make sure that you adjust the Location and Name to the used eclipse version.
- Type in Work with the name of the recently added repository. Then select the package Programming Languages -> C/C++ Development Tools and install it. This will install Eclipse CDT.
Setup a VCMI project
Create project
- File -> New Project... -> C/C++ -> C++ Project -> Next
- Type in a project name e.g. vcmi_animRewrite for the branch animRewrite, vcmi_trunk for the trunk, vcmi_0_88 for the tag 0.88
- Choose Makefile project -> Empty project -> Toolchain -> Linux GCC -> Finish
- Right click on project -> Properties. This will open the project properties where you can configure the sources folder, include paths,...
Add the bolded include paths as you can see them in the picture.
You have to click on Link Folder... and then Link to folder in the filesystem. Select the /src folder and the /build folder of one SVN project. If you link the /build folder then you can execute make targets.
Add the bolded symbols as you can see them in the picture. This one is missing add this as well: __GXX_EXPERIMENTAL_CXX0X__ That symbols are for the Eclipse CDT parser only.
You'll recognize that there are some errors in some source files. That's because the Eclipse parser can't understand every C++ language feature especially c++11. This doesn't mean that they are real errors. BOOST_FOREACH errors are fixed with the appropriate macro stated above in the picture. The parser has problems with std::make_pair perhaps this will be fixed in a later release of CDT as this error message appears often. We recommend to leave error, warning reporting turned on as you can directly see what is likely to be a problem for the GCC compiler.
Configure external program configure
- Go to Run -> External Tools -> External Tools Configuration...
- Add new launch configuration(Program) -> Choose the configure script as the location via the Browser Workspace Button
- Working directory is the /build folder
- Arguments may the following :
--datadir=/usr/local/share/games --bindir=/usr/local/games --libdir=/usr/local/lib64/games.
The /vcmi folder at the end of datadir and libdir is not missing. It will be added automatically by the configure script. - Save configuration with Apply and Close.
That way you don't need to run the ./configure script via the terminal. It can be executed within eclipse.
Configure debug/run applications
Go to Run -> Debug/Run configurations...
Add new launch configuration(C++ application)
Choose vcmiclient via Search project...
Make sure that Use Workspace Settings is enabled
VCMI won't start/debug if you don't set a specific environment variable due to shared libraries loading. Go to tab Environment -> New... Name = LD_LIBRARY_PATH Value = e.g. /usr/local/lib64/games/vcmi(where your shared libraries are located)
Then go to Project -> Properties -> C/C++ Build -> Builder settings -> Change build location to sth. like project/build(where your makefiles are located)