Editing MG/Linux Compiling

Jump to navigation Jump to search

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.

Latest revision Your text
Line 1: Line 1:
This page explains how to compile [[MegaGlest]] on Linux platforms.
+
This page explains how to compile [[MegaGlest]] on linux platforms.
 
 
===Linux quick setup===
 
[[MG/Getting The Code#Linux quick setup|''See here'']]
 
  
 
==Requirements==
 
==Requirements==
*[[MG/Getting The Code|''Download the project'']] from the GIT repository using the command line (recommended) or your favorite GIT tool (such as [http://www.rabbitvcs.org/ RabbitVCS] or [https://code.google.com/p/tortoisegit/ TortoiseGIT]).
+
*[[MG/Getting The Code|Download the project]] from the [[MG/SVN Structure|SVN]] using the command line or your favorite SVN tool (such as [http://www.rabbitvcs.org/ RabbitVCS] or [http://tortoisesvn.tigris.org/ TortoiseSVN]).
*Install build dependencies. These are usally packaged by Linux distributions. On '''Debian, Ubuntu, Fedora, Opensuse and even more Linux distributions''' you may use
+
*Download package dependencies for your Linux distribution (see <tt>mk/linux/setupBuildDeps.sh</tt> which can do that for Debian, Ubuntu, Fedora and Open SuSE based distro's). The following is the current dependency list (and the tools require wx):
cd mk/linux
 
sudo ./setupBuildDeps.sh
 
to install them. If your distribution is not supported or you prefer to install yourself: This is the current dependency list - where packages are available, the package names may start with ''lib'' and usually have ''-dev(el)'' towards the end:
 
  
<tt>gcc gcc-c++ cmake sdl2 alut GL GLU vorbis x11 lua jpeg png curl ircclient glew ftgl fribidi cppunit vlc miniupnpc</tt>
+
**jpeg
 +
**png
 +
**lua5.1
 +
**SDL
 +
**SDLmain
 +
**curl
 +
**xerces-c
 +
**openal
 +
**ogg
 +
**vorbis
 +
**vorbisfile
 +
**vorbisenc
 +
**alut
 +
**z
 +
**GL
 +
**GLU
 +
**ircclient
 +
**ftgl-dev
 +
**miniupnpc-dev
  
Additionally for map editor and model viewer:
+
*Additionally for Game Tools:
  
<tt>wxgtk xml2</tt>
+
**glew-dev
 +
**wxbase2.8
 +
**wxgtk2.8
 +
**gtk2.0-dev
 +
**xml2-dev
  
==Compilation==
+
==Building using CMake by Script==
*Update the branch you are working in with the [https://docs.megaglest.org/MG/Getting_The_Code#Update_the_source_code latest GIT code]
+
*Go to the top level project directory (<tt>megaglest</tt> or trunk or whever you placed the project)
===Scripted build ===
+
*On linux run <tt>build-mg.sh</tt>
(''Recommended way'')
+
*On windows run <tt>build-mg.bat</tt>
*Start the build:
+
*To compile for windows under linux run <tt>build-mg-win32.sh</tt>
cd mk/linux
 
./build-mg.sh
 
*To start MegaGlest:
 
./megaglest
 
  
===Building using CMake by Hand===
+
==Building using CMake by Hand==
*Open a terminal window and navigate to '''the specified branch''' and type the following:
+
*Open a terminal window and navigate to '''trunk (or the specified branch)''' and type the following:
cd mk/linux
 
 
  mkdir build
 
  mkdir build
 
  cd build
 
  cd build
  cmake ../../..
+
  cmake ..
 
  make
 
  make
*In the line <tt>cmake ../../..</tt> you can put additional parameters <tt>cmake <parameters> ../../..</tt> where every parameter should be preceded by <tt>-D</tt>.
+
*If nothing goes wrong you will see <tt>megaglest</tt> (and other binaries) in the same folder (<tt>mk/linux</tt>).
 
*NOTE: most developer that are not planning to run megaglest from the standard linux LHS paths (like usr/local/bin) should run cmake with the following syntax so that the resulting binaries look in the local compiled folders for data files:
 
*NOTE: most developer that are not planning to run megaglest from the standard linux LHS paths (like usr/local/bin) should run cmake with the following syntax so that the resulting binaries look in the local compiled folders for data files:
cd mk/linux
 
 
  mkdir build
 
  mkdir build
 
  cd build
 
  cd build
  cmake -DCMAKE_INSTALL_PREFIX='' -DWANT_DEV_OUTPATH=ON ../../..
+
  cmake -DCMAKE_INSTALL_PREFIX= ..
 
  make
 
  make
  
As example other special CMake options for customized builds:
+
Notice a space between the parameter -DCMAKE_INSTALL_PREFIX and ..
 +
 
 +
'''Notes:'''
 +
The follow are build types supported using cmake:
 +
*Release
 +
*Debug
 +
*RelWithDebInfo
 +
*MinSizeRel
 +
 
 +
To change the build type execute cmake (default is Release) using:
 +
cmake -D CMAKE_BUILD_TYPE=<...>
 +
 
 +
e.g.
 +
cmake -D CMAKE_BUILD_TYPE=Debug
 +
 
 +
Other special CMake options for customized builds:
 +
 
 
  -DBUILD_MEGAGLEST=On
 
  -DBUILD_MEGAGLEST=On
 +
-DBUILD_MEGAGLEST_CONFIGURATOR=On
 
  -DBUILD_MEGAGLEST_MAP_EDITOR=On
 
  -DBUILD_MEGAGLEST_MAP_EDITOR=On
 
  -DBUILD_MEGAGLEST_MODEL_IMPORT_EXPORT_TOOLS=On
 
  -DBUILD_MEGAGLEST_MODEL_IMPORT_EXPORT_TOOLS=On
Line 49: Line 76:
 
  -DWANT_STATIC_LIBS=On
 
  -DWANT_STATIC_LIBS=On
 
  -DMINIUPNPC_VERSION_PRE1_6=Off
 
  -DMINIUPNPC_VERSION_PRE1_6=Off
  ...
+
  -DMINIUPNPC_VERSION_PRE1_5=Off
but if you want to see this list ^ up to date (and with useful description) then use <tt>cmake -LH ../../..</tt> on the beginning.
+
-DWANT_STREFLOP=On
 +
-DUSE_FTGL=On
 +
-DWANT_SVN_STAMP=On
 +
-DCMAKE_INSTALL_PREFIX=
 +
-DMEGAGLEST_BIN_INSTALL_PATH=
 +
-DMEGAGLEST_DATA_INSTALL_PATH=
 +
-DMEGAGLEST_DESKTOP_INSTALL_PATH=
 +
-DMEGAGLEST_ICON_INSTALL_PATH=
 +
-DMEGAGLEST_MANPAGE_INSTALL_PATH=
 +
-DCUSTOM_DATA_INSTALL_PATH=
  
==Cross Compiling Windows binaries on Linux==
+
==Cross Compiling Windows binaries on Linux using MingW:==
 
*This process is still experimental and is not fully supported at the moment but rather for educational purposes.
 
*This process is still experimental and is not fully supported at the moment but rather for educational purposes.
 
*Download and extract the MingW win32 dependency archive from [https://sourceforge.net/projects/megaglest/files/win32_deps_mingw.7z/download Sourceforge] and extract into the <tt>source</tt> folder.
 
*Download and extract the MingW win32 dependency archive from [https://sourceforge.net/projects/megaglest/files/win32_deps_mingw.7z/download Sourceforge] and extract into the <tt>source</tt> folder.
 
*Install the MingW cross compiler for your distro. In Ubuntu run:
 
*Install the MingW cross compiler for your distro. In Ubuntu run:
 
  sudo apt-get install mingw32 mingw32-binutils mingw32-runtime
 
  sudo apt-get install mingw32 mingw32-binutils mingw32-runtime
*Open a terminal and <tt>cd</tt> to the root folder of your Mega-Glest folder.
+
*Open a terminal and <tt>cd</tt> to the root folder of your Mega-Glest folder (usually trunk).
*Modify the script. You also need to change <tt>windows_deps/curl-7.20.1</tt> to <tt>windows_deps/curl-7.21.3</tt>
+
*Modify the script. You also need to change <tt>win32_deps/curl-7.20.1</tt> to <tt>win32_deps/curl-7.21.3</tt>
 
*Run the script:
 
*Run the script:
cd mk/linux
 
 
  ./build-mg-win.sh
 
  ./build-mg-win.sh
 
*If all goes well you should see the Windows <tt>.exe</tt> binaries produced in the <tt>data/glest_game</tt> folder.
 
*If all goes well you should see the Windows <tt>.exe</tt> binaries produced in the <tt>data/glest_game</tt> folder.
  
 
==Test binaries==
 
==Test binaries==
To test running the game, run the binary '''in <tt>mk/linux</tt>''' like this:
+
To test running the game, run the binary in <tt>mk/linux</tt> like this:
 
  ./megaglest
 
  ./megaglest
  
Line 72: Line 107:
 
  ./megaglest --version
 
  ./megaglest --version
 
  ./megaglest --opengl-info
 
  ./megaglest --opengl-info
 
==Trouble shooting==
 
If your build fails, and you have not been building for a while, this is usually due to '''outdated build dependencies''' and in this case you should do:
 
cd mk/linux
 
sudo ./setupBuildDeps.sh
 
If MegaGlest crashes you should '''do a full rebuild'''. To trigger a full rebuild you should just remove the <tt>build</tt> directory before the build, e.g. by run:
 
cd mk/linux && rm -r build && ./build-mg.sh
 
 
==Reporting bugs==
 
If you think you have run into a bug in MegaGlest, and neither reading the [http://readme.megaglest.org/ README] and [http://faq.megaglest.org/ FAQ] nor searching for it at http://bugs.megaglest.org helps, then please report a new bug at http://bugs.megaglest.org/ (one-time registration is necessary to post).
 
When filing a bug, please provide a log of the build process of a '''full rebuild'''.
 
  
 
==See Also==
 
==See Also==
Line 92: Line 116:
 
[[Category:MG]]
 
[[Category:MG]]
 
[[Category:Compiling]]
 
[[Category:Compiling]]
[[Category:Development]]
 

Please note that all contributions to MegaGlest are considered to be released under the Creative Commons Attribution Share Alike (see MegaGlest:Copyrights for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource. Do not submit copyrighted work without permission!

To edit this page, please answer the question that appears below (more info):

Cancel Editing help (opens in new window)