Difference between revisions of "Compiling Phaethon"

From xoreos Wiki
Jump to: navigation, search
(Add a page explaining how to compile Phaethon)
 
(Libraries: Update)
Line 39: Line 39:
 
* [http://www.zlib.net/ zlib] (>= 1.2.3.4)
 
* [http://www.zlib.net/ zlib] (>= 1.2.3.4)
 
* [http://tukaani.org/xz/ liblzma] (>= 5.0.5)
 
* [http://tukaani.org/xz/ liblzma] (>= 5.0.5)
* [http://www.xmlsoft.org/ libxml2] (>= 2.8.0)
 
 
* [http://www.boost.org/ Boost] (>= 1.53.0)
 
* [http://www.boost.org/ Boost] (>= 1.53.0)
 
** Boost.Utility
 
** Boost.Utility
Line 45: Line 44:
 
** Boost.System
 
** Boost.System
 
** Boost.Filesystem
 
** Boost.Filesystem
** Boost.Regex
 
 
** Boost.Unordered
 
** Boost.Unordered
 
** Boost.Hash
 
** Boost.Hash
Line 51: Line 49:
 
** Boost.Chrono
 
** Boost.Chrono
 
** Boost.Function
 
** Boost.Function
** Boost.Bind
 
 
** Boost.Uuid
 
** Boost.Uuid
 
** Boost.Smart_Ptr
 
** Boost.Smart_Ptr
 
** Boost.ScopeExit
 
** Boost.ScopeExit
** Boost.Atomic
 
 
** Boost.Locale
 
** Boost.Locale
** Boost.Thread
 
 
* [https://www.qt.io/ Qt] (>= 5.7.1)
 
* [https://www.qt.io/ Qt] (>= 5.7.1)
 
** Qt5Core
 
** Qt5Core
Line 70: Line 65:
 
On Debian-based GNU/Linux distribution (including Ubuntu), you should be able to install these libraries and their development packages with
 
On Debian-based GNU/Linux distribution (including Ubuntu), you should be able to install these libraries and their development packages with
  
  sudo apt-get install zlib1g-dev liblzma-dev libxml2-dev libboost-all-dev \
+
  sudo apt-get install zlib1g-dev liblzma-dev libboost-all-dev \
 
     libopenal-dev libmad0-dev libogg-dev libvorbis-dev  \
 
     libopenal-dev libmad0-dev libogg-dev libvorbis-dev  \
 
     qtbase5-dev, libqt5gui5, libqt5widgets5
 
     qtbase5-dev, libqt5gui5, libqt5widgets5
Line 76: Line 71:
 
On Arch Linux, you can install these dependencies with
 
On Arch Linux, you can install these dependencies with
  
  sudo pacman -S zlib xz libxml2 boost boost-libs openal libmad libogg \
+
  sudo pacman -S zlib xz boost boost-libs openal libmad libogg \
 
     libvorbis qt5-base
 
     libvorbis qt5-base
  
Line 83: Line 78:
 
On Windows, if you're using MSYS2, you can install these dependencies for 32-bit with
 
On Windows, if you're using MSYS2, you can install these dependencies for 32-bit with
  
   pacman -S mingw-w64-i686-zlib mingw-w64-i686-xz mingw-w64-i686-libxml2 \
+
   pacman -S mingw-w64-i686-zlib mingw-w64-i686-xz \
 
     mingw-w64-i686-boost mingw-w64-i686-openal mingw-w64-i686-libmad \
 
     mingw-w64-i686-boost mingw-w64-i686-openal mingw-w64-i686-libmad \
 
     mingw-w64-i686-libogg mingw-w64-i686-libvorbis mingw-w64-i686-qt-creator
 
     mingw-w64-i686-libogg mingw-w64-i686-libvorbis mingw-w64-i686-qt-creator
Line 89: Line 84:
 
On Windows, if you're using MSYS2, you can install these dependencies for 64-bit with
 
On Windows, if you're using MSYS2, you can install these dependencies for 64-bit with
  
   pacman -S mingw-w64-x86_64-zlib mingw-w64-x86_64-xz mingw-w64-x86_64-libxml2 \
+
   pacman -S mingw-w64-x86_64-zlib mingw-w64-x86_64-xz \
 
     mingw-w64-x86_64-boost mingw-w64-x86_64-openal mingw-w64-x86_64-libmad \
 
     mingw-w64-x86_64-boost mingw-w64-x86_64-openal mingw-w64-x86_64-libmad \
 
     mingw-w64-x86_64-libogg mingw-w64-x86_64-libvorbis mingw-w64-x86_64-qt-creator
 
     mingw-w64-x86_64-libogg mingw-w64-x86_64-libvorbis mingw-w64-x86_64-qt-creator

Revision as of 17:38, 17 May 2020

This page gives a few tips and pointers on how to compile Phaethon on various platforms.

Compiler and build system

Phaethon is written in C++, so a C++ compiler, like GCC or clang is required. Phaethon follows the C++14 standard. It has two build systems: Autotools (Autoconf, Automake and Libtool) and CMake. Use whichever you feel more comfortable with.

GNU/Linux

On Debian-based distributions (including Ubuntu), you should be able to install the required compiler and build system packages with

apt-get install libc6-dev g++ make autoconf automake libtool gettext

On Arch Linux, you can install the necessary packages with

sudo pacman -S base-devel cmake

On other distributions, it should work similarily.

Windows

Since Visual Studio does not work with autotools, you have to use the CMake build system if you want to compile xoreos with Visual Studio. If you're using MinGW, however, you're free to choose either build system.

On Windows, it is recommended that instead of Visual Studio, you use MSYS2 together with Mingw-w64 (which can produce both 32-bit and 64-bit binaries). MSYS2 provides a package manager, with which you can install xoreos' library dependencies very easily.

You can install the 32-bit toolchain in MSYS2 with

pacman -S base-devel git mingw-w64-i686-toolchain mingw-w64-i686-cmake

You can install the 64-bit toolchain in MSYS2 with

pacman -S base-devel git mingw-w64-x86_64-toolchain mingw-w64-x86_64-cmake

Libraries

Phaethon uses the following libraries to function:

  • iconv
  • zlib (>= 1.2.3.4)
  • liblzma (>= 5.0.5)
  • Boost (>= 1.53.0)
    • Boost.Utility
    • Boost.StringAlgo
    • Boost.System
    • Boost.Filesystem
    • Boost.Unordered
    • Boost.Hash
    • Boost.Date_Time
    • Boost.Chrono
    • Boost.Function
    • Boost.Uuid
    • Boost.Smart_Ptr
    • Boost.ScopeExit
    • Boost.Locale
  • Qt (>= 5.7.1)
    • Qt5Core
    • Qt5Gui
    • Qt5Widgets
    • Qt5Concurrent
  • OpenAL (>= 1.12) (See below)
  • MAD (>= 0.15.1b)
  • libogg (>= 1.2.0)
  • libvorbis (>= 1.3.1)

On Debian-based GNU/Linux distribution (including Ubuntu), you should be able to install these libraries and their development packages with

sudo apt-get install zlib1g-dev liblzma-dev libboost-all-dev \
    libopenal-dev libmad0-dev libogg-dev libvorbis-dev  \
    qtbase5-dev, libqt5gui5, libqt5widgets5

On Arch Linux, you can install these dependencies with

sudo pacman -S zlib xz boost boost-libs openal libmad libogg \
    libvorbis qt5-base

Other GNU/Linux distributions should work similarily.

On Windows, if you're using MSYS2, you can install these dependencies for 32-bit with

 pacman -S mingw-w64-i686-zlib mingw-w64-i686-xz \
    mingw-w64-i686-boost mingw-w64-i686-openal mingw-w64-i686-libmad \
    mingw-w64-i686-libogg mingw-w64-i686-libvorbis mingw-w64-i686-qt-creator

On Windows, if you're using MSYS2, you can install these dependencies for 64-bit with

 pacman -S mingw-w64-x86_64-zlib mingw-w64-x86_64-xz \
    mingw-w64-x86_64-boost mingw-w64-x86_64-openal mingw-w64-x86_64-libmad \
    mingw-w64-x86_64-libogg mingw-w64-x86_64-libvorbis mingw-w64-x86_64-qt-creator

Windows users not using MSYS2 will have to visit each website manually and download a precompiled version, or, if not available, download the source and compile the library themselves.

A note on OpenAL

On Mac OS X, we're using Apple's OpenAL implementation, so OpenAL does not need to be installed separately there.

On both GNU/Linux and Microsoft Windows, we require OpenAL Soft. There is a propriety OpenAL implementation by Creative Labs, Inc. for Microsoft Windows, which can be found at http://openal.org/, but it's unfortunately old, outdated and abandoned. We do not recommend its use.

Likewise, on NetBSD and other systems using pkgsrc, you should use openal-soft instead of openal.

Compiling Phaethon

Make sure you have your compiler, build system and libraries installed correctly. Then open a terminal and change into the directory of your sources.

autotools

Type

./autogen.sh && ./configure && make

The binaries can then be found in the src subdirectory.

Optional, non-conventional ./configure flags:

  • --with-werror  
Compile with -Werror
  • --without-warnings  
Compile without the extra warnings enabled
  • --with-lto  
Compile with link-time optimization


CMake

Type

cmake . && make

The binaries can then be found in the bin subdirectory.

Please read Running CMake on the CMake website for in-depth information on invoking CMake.

Unit tests

On both build systems,

make check

compiles and runs our unit tests.