Building Pegasus

Pegasus is a cross-platform native application written in C++ and built mainly on top of the Qt libraries. Manually building has the following requirements:

Info

  1. You can use either Qt or SDL2 for gamepad handling. SDL2 has better compatibility, but may not be readily available on as many platforms as Qt.
  2. Git can be used to download the source code, and, if available, will also be used to determine the version number shown in the program.

To install Qt, you can follow the guide on this page.
To install SDL2, you can use your platform's package manager or you can download the library directly from its official site.
To install Git, use your platform's package manager, or the official installer, and make sure it's avalable in your PATH.

The build process

The source code can be found here. Download it using Git or as a zip file from the webpage.

Pegasus is a Qt qmake project. Qt provides a graphical IDE, called Qt Creator, which you can use building such projects, or you can call qmake directly from the command line.

Using Qt Creator

  1. Open Qt Creator and open the project file (pegasus.pro)
  2. Qt Creator will ask you which Qt setup ("kit") you want to use (in case you've installed multiple versions), and where you want to place the generated build files. If everything's OK, click Configure Project.
  3. (optional) Change the configuration (see below)
  4. In the bottom left corner, on the sidebar of Qt Creator, you can find 4 buttons:

    • with the button that looks like a desktop monitor, you can change the build type (optimized Release build or development-friendly but slower Debug build)
    • the green arrow will build and run the program
    • the green arrow with a bug will also open several debug toolbars
    • the hammer will build the project but won't start the application

  5. Change the build type to Release, and press the green arrow to build and run the project.

Using the command line

  1. Create a build directory somewhere, and step into it
  2. Call qmake like this: /path/to/qmake path/to/project [options].
    • If you have multiple Qt versions installed, make sure you call the right qmake.
      If you've installed using the official release from the Qt site, you can find it in [qt-installdir]/Qt5/[version]/gcc_64/bin. You can add it to your PATH if you want, but it's not necessary.
    • You can also change some configuration options, which you can find below.
  3. Call make
  4. (optional) Call make install

Configuration options

You can change build parameters to qmake (the Qt configuration tool) by appending KEY=VALUE pairs to its command line call. If you're using Qt Creator, you can find these settings on the Projects -> Build settings tab, where you can modify the Additional arguments option (see here).

build steps screenshot

SDL gamepad support

By default, the build will use Qt's built-in gamepad support. To improve compatibility, you can use SDL2 instead. The build behaviour can be controlled through the following parameters:

OptionDescription
USE_SDL_GAMEPADSetting this to 1 will enable the SDL gamepad backend and disable the Qt one.
SDL_LIBSA space-separated list of linker flags (eg. -l and -L).
SDL_INCLUDESa space-separated list of include directories. One of them must contain the file SDL.h.

If only USE_SDL_GAMEPAD is set (ie. SDL_LIBS and SDL_INCLUDES are both empty), pkg-config will be used on platforms where it is available.

Example

Example configuration 1: qmake path/to/sources USE_SDL_GAMEPAD=1

Example configuration 2:

qmake path/to/sources \
    USE_SDL_GAMEPAD=1 \
    SDL_LIBS="-L/path/to/sdl/lib/ -lSDL2 -Wl,--no-undefined" \
    SDL_INCLUDES=/path/to/sdl/include/SDL2/

Note that only the gamepad module is used from SDL, so if you're also building your own SDL, you can turn off many of its features during configuration. You should not link to SDL2main.

Deployment

Some platforms optionally support installing and deploying builds. In practice, this means preparing the final executable and copying it to a particular location. The behaviour can be controlled through the following parameters:

OptionDescription
INSTALLDIRThe general installation directory used by make install. Defaults to /opt/pegasus-frontend on Linux, /usr/local/pegasus-frontend on Mac and C:\pegasus-frontend on Windows.
INSTALL_BINDIRThe installation directory of the executable. Defaults to INSTALLDIR. On most distros /usr/bin is a good value.
INSTALL_DOCDIRIf set, make install will copy the license and readme files there. On most distros /usr/share/doc/pegasus-frontend is a good value.
INSTALL_DESKTOPDIRLinux only. If set, make install will create an XDG desktop file there (making Pegasus appear in the main menu). Unset by default, on most distros /usr/share/applications is a good value.
INSTALL_ICONDIRLinux only. If set, make install will create an XDG icon file there (making Pegasus have an icon on the tray and the menu). Unset by default, on most distros /usr/share/pixmaps or /usr/share/icons/hicolor/128x128/apps is a good value.
INSTALL_APPSTREAMDIRLinux only. If set, make install will create an AppStream XML entry there (making Pegasus appear in certain app store applications). Unset by default, on most distros /app/share/metainfo is a good value.

Example

Example configuration for a global Linux installation:

qmake path/to/sources \
    INSTALL_BINDIR=/usr/bin \
    INSTALL_DOCDIR=/usr/share/doc/pegasus-frontend \
    INSTALL_ICONDIR=/usr/share/pixmaps \
    INSTALL_DESKTOPDIR=/app/share/applications \
    INSTALL_APPSTREAMDIR=/app/share/metainfo