Difference between revisions of "How to build VCMI (Linux)"

From VCMI Project Wiki
Jump to: navigation, search
(Configure make targets)
(Replaced content with "{{Template:MovedToWebpage|https://vcmi.eu/developers/Building_Linux/}}")
 
(53 intermediate revisions by 13 users not shown)
Line 1: Line 1:
= Compiling VCMI =
+
{{Template:MovedToWebpage|https://vcmi.eu/developers/Building_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 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.
 
 
 
<ol>
 
<li>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 [http://www.eclipse.org/downloads/ Eclipse downloads].</li>
 
<li>Unpack the downloaded package.
 
<pre>tar xzf eclipse.tar.gz</pre></li>
 
<li>Move it to the /opt directory which is used for additional mostly not-UNIX-like programs in matters of the directory structure.
 
<pre>sudo mv eclipse /opt</pre></li>
 
<li>Adjust file access rights.
 
<pre>cd /opt
 
sudo chown -R root:root eclipse
 
sudo chmod -R +r eclipse
 
sudo chmod +x `sudo find eclipse -type d`</pre></li>
 
<li>Make eclipse more accessible.<pre>sudo touch /usr/bin/eclipse
 
sudo chmod 755 /usr/bin/eclipse
 
sudoedit /usr/bin/eclipse</pre>Enter these few lines in the editor, save the file and close the editor.<pre>#!/bin/sh
 
export ECLIPSE_HOME="/opt/eclipse"
 
$ECLIPSE_HOME/eclipse $* </pre></li>
 
<li>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.<pre>sudoedit /usr/share/applications/eclipse.desktop</pre>
 
Enter the following lines in the editor:
 
<pre>[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 </pre></li>
 
<li>Clean eclipse.<pre>/opt/eclipse/eclipse -clean</pre></li>
 
<li>Start eclipse. Adjust workspace directory to sth. like: ~/Eclipse</li>
 
<li>Go to: Help -> Install new software...</li>
 
<li>Click on Add... and enter the Location <i>http://download.eclipse.org/releases/indigo</i> and Name <i>Indigo</i>. Make sure that you adjust the Location and Name to the used eclipse version.</li>
 
<li>Type in <i>Work with</i> 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.</li>
 
</ol>
 
 
 
== 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.
 
 
 
[[File:Eclipse_Include_Path.jpg|350px]]
 
 
 
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.
 
 
 
[[File:Eclipse_SourcePaths.jpg|350px]]
 
 
 
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.
 
 
 
[[File:Eclipse_Symbols.jpg|350px]]
 
 
 
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 : <code class="inline">--datadir=/usr/local/share/games --bindir=/usr/local/games --libdir=/usr/local/lib64/games.</code> 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...
 
# sudo vi /etc/ld.so.conf.d/vcmi-86_64.conf. Add this line: /usr/local/lib64/games/vcmi. This is needed because VCMI is not installed and to find shared libraries.
 

Latest revision as of 16:06, 16 July 2024

Logo256.png    Page moved to VCMI-Homepage