Building Moondust Project from sources

This is a special manual where will be written about building process for each operating system.

Common Preparation

 * Download sources (clone dev repo)
 * Download any config pack

First of all, you will need to download all sources:

Try to clone the repository by this command:

But if you failed to clone repo, you can download sources as ZIP:

https://github.com/Wohlhabend-Networks/PGE-Project

(use the link "Download Zip" for getting the sources from GitHub)



And after download any configuration package (which contains graphics, music and sounds) which need to be able work with PGE:

http://wohlsoft.ru/config_packs.php

Note: Don't forget place configs, languages (after built *.qm files) directories with compiled executable file!

Dependences

 * Qt >= 5.4 (You can download it here: http://qt-project.org/downloads (You need the community version)
 * gcc >=4.7
 * g++ >=4.7
 * freeglut:
 * freeglut3-dev (Debian/Ubuntu/Mint)
 * freeglut-devel (RedHat / CentOS / Fedora)
 * SDL2 >= 2.0 (Will be built with built_deps.sh script)
 * SDL2_mixer >= 2.0 (Will be built with built_deps.sh script)

GCC
Install gcc on Debian/Ubuntu/Mint

on Redhat / CentOS

on openSUSE

SDL
At first, download the SDL library:

On Linux Mint you just can execute to install all dependencies:

Install official SDL2_mixer build: (But instead of you can build a modified SDL2_mixer library which includes with PGE Sources in the _Libs/SDL2_mixer_modified )

Differences: between official and modded builds:
 * Added resample source from 'madplay' player to implement better audio resampling
 * Ability to build via qmake from Qt
 * Enabled true loops for ModPlug and MikMod libraries
 * Attempt to add .SPC playback

If your distro hasn't SDL2 builds, you can found sources of SDL and SDL_mixer dependents in the _Libs/_sources/ folder. You can try to build them with running of "build_linux_usr.sh" as root which will build SDL with /usr/ prefix or run the build_linux.sh which will build dependencies into _Libs/_builds/linux folder. All dependencies will be built when you will run "build_deps.sh" from project root folder. NOTE: If running this under Debian/Ubuntu/Linux Mint, you may also need to install automake.

Qt 5
To get Qt installation you have two ways: you can install Qt5 packages from your repositories but also you can download it here:

http://www.qt.io/download-open-source/

Note: You can see more download links if you will open "View all downloads" page.

If you download necessary package from official site, you should open Terminal and set "executable" permission to get able start installation.

and follow install instructions.
 * download package to your PC
 * Set executable:
 * Run installer:

after installation don't forget to check installed Qt (If your Qt was installed into "/opt/Qt/"):

If you will get message like this: Everything are okay ;-)

for convenience, you can make symlink to qmake in the /usr/bin and use qmake easier:

Warning! If you have already installed other versions of Qt you can create symlink, for example, with "qmake-qt5" name

Preparing for build

 * Extract the source code to a folder where you can find it easily (for example, /home/vasya/projects/pge/)
 * Extract the downloaded config pack into /path/to/your/source/Content/configs

You must have this tree:

 -configs//data --music --sound --graphics common characters --mario --peach --luigi --toad --link level --background --background2 --block --npc --effect worldmap --level --player --tiles --scene --tile for example /opt/Qt/5.4/gcc_64/bin/qmake, /opt/Qt/5.4/gcc_64/bin/lrelease)
 * open the terminal and change current directory to the unpacked folder with project sources
 * run the generate_paths.sh file and when gedit will open, type the paths to qmake and to lrelease (in the bin directory of your Qt,
 * run the build_deps.sh to build included dependent libraries.

Building code
To build project use the special build.sh script:

chmod u+x build.sh ./build.sh

If you got problems with building process try to build project manually:

qmake cd Editor lrelease pge_editor.pro cd .. make make install

When everything will be built, you will see the built executables in the ./bin folder.

To start usage of the editor, run the pge_editor file

Dependences

 * MinGW >= 4.8 (You can get MinGW installer here: http://sourceforge.net/projects/mingw/files/latest/download?source=files) (MinGW already includes with Qt MinGW installer)
 * Qt >= 5.4 (You can download it here: http://qt-project.org/downloads) (Get Qt 5.4.1 Community version for minGW)
 * SDL2 >= 2.0 (Already includes in the _Libs/_builds/win32 )
 * SDL2_mixer >= 2.0 (Already includes in the _Libs/_builds/win32 )

Installation of the development tools
Install all the tools in a folder, for example, C:\DevTools. Qt installation Note: you must enable those components: Other components are optional and doesn't required
 * MinGW into C:\DevTools\MinGW (if you got it separated)
 * Qt into C:\DevTools\Qt
 * 5.4.1 -> mingw491_qt54 or similar
 * Tools -> MinGW 4.9.1 or similar

After the install, you can add MinGW and Qt directories into PATH environment:

(if tools was installed into C:\DevTools, you must append those folders into PATH global variable) C:\DevTools\MinGW\bin C:\DevTools\MinGW\msys\1.0\bin C:\DevTools\MinGW\lib C:\DevTools\MinGW\msys\1.0\lib to use your installed MinGW or C:\DevTools\Qt\5.4.1\Tools\mingw491_32\bin to use the internal preinstalled MinGW in the Qt folder

C:\DevTools\Qt\5.4.1\mingw49_32\bin C:\DevTools\Qt\5.4.1\mingw49_32\lib

PATH string to append:
 * C:\DevTools\Qt\5.4.1\mingw49_32\bin;C:\DevTools\Qt\5.4.1\mingw49_32\lib;C:\DevTools\Qt\5.4.1\Tools\mingw491_32\bin

Preparing to build

 * Extract the source code to a folder where you can find it easily (Path shouldn't contain non-ASCII characters!)
 * Extract the downloaded config pack into /path/to/your/source/Content/configs

You must have this tree:

 -configs//data --music --sound --graphics common characters --mario --peach --luigi --toad --link level --background --background2 --block --npc --effect worldmap --level --player --tiles --scene --tile

for example C:\DevTools\Qt\5.4.0\mingw48_32\bin and C:\DevTools\Qt\Tools\mingw48_32\bin)
 * run the generate_paths.bat file and when notepad will open, type the paths to Qt and to MinGW
 * run the build_deps.bat to build included dependent libraries.

Build code
build.bat If everything is successfully built, you will see the built PGE executables in the bin subfolder - it's the compiled editor. You can run and use it!
 * In the project folder, hold Shift key on your keyboard and press the right mouse button, and in the context menu select "Open command window" (available for Windows 7 and newer).
 * In the opened command Window, enter these commands for the build:

P.S. If you was built the dynamic version, you need to copy some libraries from Qt's bin folder, and also you need for a "plugins", "imageformats" folder which you can copy from Qt's folder.

Also you can build manually: qmake cd Editor lrelease pge_editor.pro cd .. make make install

And you can run pge_editor.exe from a bin directory to run editor or pge_engine.exe to launch game engine

Dependences

 * XCode and command line dev-tools must be installed (https://developer.apple.com/xcode/downloads/)
 * Qt >= 5.4
 * (You can download it here: http://www.qt.io/download-open-source/) (Get Qt 5.4.1 Community version)
 * Qt can be installed from homebrew with command brew install qt5
 * SDL2 >= 2.0 (will be built with build_deps.sh script)
 * SDL2_mixer >= 2.0 (will be built with build_deps.sh script)

XCode
To install XCode you need to download it from your App Store.

Qt
You have two ways to install Qt:
 * via homebrew in with terminal command:
 * via Online installer (We recommends you to choice the ~/Qt path which will be easy to access from Finder)

Preparing to build

 * Extract the source code to a folder where you can find it easily (Path shouldn't contain non-ASCII characters!)
 * Extract the downloaded config pack into /path/to/your/source/Content/configs

You must have this tree:

 -configs//data --music --sound --graphics common characters --mario --peach --luigi --toad --link level --background --background2 --block --npc --effect worldmap --level --player --tiles --scene --tile

for example ~/Qt/clang_32/bin)
 * run the generate_paths_osx.sh file and when nano will open, add Qt path into environment and save file with CMD+O
 * run the build_deps.bat to build included dependent libraries.

Building code
To build project use the special build.sh script:

./build.sh

If you got problems with building process try to build project manually:

qmake cd Editor lrelease pge_editor.pro cd .. make make install

When everything will be built, you will see the built app bundles in the ./bin folder.

To start usage of the editor, run the pge_editor.app file

Links

 * Original building manual on PGE Forums