Building Moondust Project from sources
This is a special manual where will be written about building process for each operating system.
Common Preparing
- 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:
#make directory for your repos if you haven't it
mk ~/myrepos
cd ~/myrepos/
#clone repo into your new directory
git clone https://github.com/Wohlhabend-Networks/PGE-Project.git
But if you was 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!
Building for Linux
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
- SDL2_mixer >= 2.0
Installing of development tools
GCC
Install gcc on Debian/Ubuntu/Mint
sudo apt-get gcc g++ freeglut3-dev make git wget
sudo apt-get install build-essential
sudo apt-get install "^libxcb.*" libx11-xcb-dev libglu1-mesa-dev libxrender-dev
on Redhat / CentOS
sudo yum install gcc g++ freeglut-devel make git wget
on openSUSE
sudo zypper install gcc g++ freeglut-devel make git wget
SDL
At first, download the SDL library:
On Linux Mint you just can execute to install all dependencies:
sudo apt-get install libsdl2-2.0.0 libsdl2-dev libmodplug1 libmodplug-dev libogg-dev libvorbis-dev libmad0 libmad0-dev libflac-dev
Install official SDL2_mixer build:
sudo apt-get install libsdl2-mixer-2.0.0 libsdl2-mixer-dev
(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
But, if your distro hasn't SDL2 builds, you will need to get a source package:
http://www.libsdl.org/download-2.0.php
And download the SDL2_mixer's source too:
http://www.libsdl.org/projects/SDL_mixer/
Here you will need for these libs: libogg, libvorbis and libflac
http://xiph.org/downloads/
Here you need to download the mikmod library:
http://mikmod.sourceforge.net/#files
And here you need to download the LibMAD library to allow MP3 playback via SDL2_mixer:
http://sourceforge.net/projects/mad/files/
You also can get all libraries from our folder:
http://wohlsoft.ru/docs/Software/LibSDL/
Don't forget to download fix for configure script of the libmad:
http://wohlsoft.ru/docs/Software/LibSDL/libmad-0.15.1b-mingw-w64.patch
Note You can found sources of SDL 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 build_linux.sh which will build dependencies into _Libs/_builds/linux folder
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.
- download package to your PC
wget http://download.qt-project.org/official_releases/online_installers/qt-opensource-linux-x64-online.run
- Set executable:
chmod u+x qt-opensource-linux-x64-1.6.0-4-online.run
- Run install:
./qt-opensource-linux-x64-1.6.0-4-online.run
and follow install instructions.
and, after install don't forgot check installed Qt (If you set install folder is "/opt/Qt/"):
/opt/Qt/5.4.0/gcc_64/bin/qmake -v
If you get message like this:
QMake version 3.0
Using Qt version 5.4.0 in /opt/Qt/5.3.1/gcc_64/lib
All is okay ;-)
for convenience, you can add symlink to qmake in /usr/bin and use qmake simply:
<pre>sudo ln -s /opt/Qt/5.4.0/gcc_64/bin/qmake /usr/bin/qmake
Warning! :warning: If you have installed other versions of Qt, you can create symlink, for example, as "qmake-qt5"
After the install, unpack all sources from ZIP to any folder (for example, /home/vasya/projects/pge/)
cd ~/projects/pge/PGE-Project-master/
Preparing for build
- Extract the source code to a folder where you can find it easily
- Extract the downloaded config pack into /path/to/your/source/Content/configs
You must have this tree:
- run the generate_paths.sh file and when notepad will open, type the paths to qmake and to lrelease (in the bin directory of your Qt,
for example /opt/Qt/5.4/gcc_64/bin/qmake, /opt/Qt/5.4/gcc_64/bin/lrelease)
- run the build_deps.sh to build included dependent libraries.
Building code
You simply use the special build script in the "build.sh" file for build project
And you can build sources simply:
chmod u+x build.sh ./build.sh
If everything is successfully built, you will see the file "pge_editor" in the ./bin folder. Exec this file for starting the editor.
Also you can build manually:
qmake cd Editor lrelease pge_editor.pro cd .. make make install
And after you will can run application from a bin directory
Building for Windows
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.
- MinGW into C:\DevTools\MinGW (if you got it separated)
- Qt into C:\DevTools\Qt
Qt installation Note: you must enable those components:
- 5.4.1 -> mingw491_qt54 or similar
- Tools -> MinGW 4.9.1 or similar
Other components are optional and doesn't required
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:
- run the generate_paths.bat file and when notepad will open, type the paths to Qt and to MinGW
for example C:\DevTools\Qt\5.4.0\mingw48_32\bin and C:\DevTools\Qt\Tools\mingw48_32\bin)
- run the build_deps.bat to build included dependent libraries.
Build code
- 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:
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!
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
Building for Mac OS X
Comming soon!
