Skip to content

Building and installing from source

Benedikt Wagener edited this page Apr 19, 2024 · 76 revisions

Notice: We focus on keeping these instructions accurate for the latest development version, git master. So if you are trying older stable releases, for example, you might find that these don't work perfectly - at least the required package lists, the CMake procedure is pretty much the same.

Table of Contents

Preparations

Be sure not to have multiple Performous versions installed at the same time. It may seem to work, but the graphics may display incorrectly due to wrong theme files being used. To prevent that, clean up old files:

 rm -rf /usr/local/bin/performous /usr/local/share/games/performous/

Installing build dependencies

If you happen to be running one of these, please start by installing the following packages. If not, just skip this section and follow the instructions. We try to keep these lists accurate and up-to-date with the development version. If you find that something is missing or that there are unnecessary package installs, please fix it.

Gettext (localization), Help2Man (UNIX manual pages), OpenCV (webcam support) and PortMidi (MIDI drum support) are optional and can be left out if no support for these functions is required.

Debian and Ubuntu

Bare minimum

  sudo apt install git cmake build-essential gettext help2man
  sudo apt install libopenblas-dev \
                   libfftw3-dev \
                   libicu-dev \
                   libepoxy-dev \
                   libsdl2-dev \
                   libfreetype6-dev \
                   libpango1.0-dev \
                   librsvg2-dev \
                   libxml++2.6-dev \
                   libavcodec-dev \
                   libavformat-dev \
                   libswscale-dev \
                   libjpeg-dev \
                   portaudio19-dev \
                   libglm-dev \
                   libboost-all-dev \
                   nlohmann-json3-dev \
                   libaubio-dev \
                   libfmt-dev

With MIDI Drum Support

  sudo apt install libportmidi-dev

With Webcam support

  sudo apt install libopencv-dev

With webserver support

  sudo apt install libcpprest-dev

To translate stuff

  sudo apt install python

Unit tests with Google-Test (optional but recommended)

  sudo apt install libgtest-dev libgmock-dev

Notice: Dependency problems may prevent installation of portaudio19-dev. At least with Ubuntu 13.04 this can be solved by first installing libjack-jackd2-dev, even though that package is not actually needed for Performous.

Alternatively, you can do:

 sudo apt-get build-dep performous

which installs all the build dependencies for the version in the repositories. It might not be completely accurate for the current git version, but should get you pretty far.

Gentoo

 sudo emerge boost git cmake help2man glew libsdl2 ffmpeg portaudio libxmlpp \
   opencv portmidi

Fedora

(You need RPM Fusion Free repository for ffmpeg):

 yum install git cmake gcc-c++ gettext cairo-devel librsvg2-devel libsigc++20-devel \
   glibmm24-devel libxml++-devel boost-devel SDL2-devel libepoxy-devel ffmpeg-devel \
   portaudio-devel help2man redhat-lsb opencv-devel portmidi-devel libjpeg-turbo-devel \
   pango-devel jsoncpp-devel glm-devel openblas-devel fftw-devel cpprest-devel 

After installing these, proceed to to Build and Install.

NOTE: An additional flag has to be passed to cmake so as to correctly use the `boost` libraries. At the cmake stage of the install on Fedora, use the following command:

    cmake -DUSE_BOOST_REGEX=1 ../

macOS

These instructions will walk you through building Performous for macOS (10.9+) and bundling and packaging it inside a DMG ready to install. By default these instructions build the internal webserver, the extra tools (such as Singstar extractor; note, not all are currently working in macOS, even if they all do build succesfully), and support for webcam (via OpenCV)

  • These instruction have been tested with macOS 10.12.5 and XCode 8.3.3.
1. Install macports first, clean installation is preferred to avoid conflicts. 2. Update macports and its port list via
 sudo port selfupdate
  • Most dependencies required to use the provided build script must be installed using MacPorts. A couple of them (marked with asterisks, below) are not available in this manner and will have to be obtained and built separately.
You can use the default
  sudo port install <dependency_name>

to install the dependencies and it's reported to work. However, official macOS releases are built using the following configuration parameters:

 sudo /opt/local/bin/port -vsf install <package_name> -universal configure.compiler="clang" \ 
 configure.cxx_stdlib="libc++" configure.macosx_deployment_target="10.9" \
 configure.sdkroot="/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk" \
 configure.cxxflags="-std=c++11 -mmacosx-version-min=10.9 -m64 -arch x86_64 -stdlib=libc++ \ 
 -Wl,-headerpad_max_install_names" configure.cflags="-m64 -arch x86_64 -mmacosx-version-min=10.9 \
 -Wl,-headerpad_max_install_names" configure.ldflags="-m64 -arch x86_64 -stdlib=libc++ \ 
 -headerpad_max_install_names -mmacosx-version-min=10.9"

and also these, in ~/.macports/macports.conf (largely they're the same things as the commandline parameters, but Macports is sometimes... well, special, in deciding which things can be configured via command-line and which cannot.

  build_arch          	x86_64
  cxx_stdlib		libc++
  configure.cxx_stdlib	libc++
  macosx_deployment_target 10.9
  configure.cxxflags  "-mmacosx-version-min=10.9 -m64 -arch x86_64 -stdlib=libc++ -Wl,-headerpad_max_install_names"
  configure.cflags  "-mmacosx-version-min=10.9 -m64 -arch x86_64 -Wl,-headerpad_max_install_names"
  configure.ldflags "-m64 -arch x86_64 -stdlib=libc++ -headerpad_max_install_names -mmacosx-version-min=10.9"
  cxxflags  "-mmacosx-version-min=10.9 -m64 -arch x86_64 -stdlib=libc++ -Wl,-headerpad_max_install_names"
  cflags  "-mmacosx-version-min=10.9 -m64 -arch x86_64 -Wl,-headerpad_max_install_names"
  ldflags "-m64 -arch x86_64 -stdlib=libc++ -headerpad_max_install_names -mmacosx-version-min=10.9"
  configure.sdkroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk
  sdkroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk
  universal_archs     	x86_64 noarch
  buildmakejobs       	0

3. Dependencies

  • npm
  • boost
  • libxmlxx2
  • libsdl2
  • ffmpeg
  • cmake
  • jsoncpp
  • help2man
  • libepoxy
  • librsvg
  • portaudio
  • portmidi
  • opencv
  • dylibbundler (*)
  • asio-c++ (*)
  • cppnetlib (*)
      • Note: Libraries that are required by other dependencies are absent from this list (since they will be installed automatically) in order to simplify the instructions.
      • Note: Dependencies marked with an asterisk are not available or are outdated in Macports and should be obtained elsewhere.
4. Download dylibbundler, asioc++ and cpp-netlib version 0.11.2
 mkdir asio-build && cd asio-build
  ASIO_STANDALONE=1 CXXFLAGS="-std=c++11 -stdlib=libc++" CC="/usr/bin/clang" CXX="/usr/bin/clang++" ../asio-1.10.6/configure --prefix=/opt/local --with-boost=no
 make check && sudo make install
 mkdir cppnetlib-build && cd cppnetlib-build
 cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_CXX_FLAGS="-std=c++11 \
 -stdlib=libc++ -arch x86_64 -Wl,-headerpad_max_install_names" -DCMAKE_OSX_DEPLOYMENT_TARGET=10.9 \ 
 -DCMAKE_C_FLAGS="-Wl,-headerpad_max_install_names -arch x86_64" -DCMAKE_INSTALL_PREFIX=/opt/local/ \ 
 -DCMAKE_EXE_LINKER_FLAGS=-headerpad_max_install_names -DCPP-NETLIB_BUILD_SHARED_LIBS=ON -DBUILD_SHARED_LIBS=ON \
 -DCMAKE_SHARED_LINKER_FLAGS=-headerpad_max_install_names -DCMAKE_MACOSX_RPATH=ON -DCMAKE_OSX_ARCHITECTURES=x86_64 \
 ../cpp-netlib-0.11.2-final
 make -j0 test && sudo make install
  • Note: In Sierra, it is possible the mime-roundtrip test fails with a SIGSEGV while using boost 1.59. If this happens you need to install boost 1.60+ (instructions on doing so will require creating a custom port; you can find instructions to do this and the required files in the macports website)
  • Note: Make sure the path to configure is correct, here I am using the default folder to which asioc++ is extracted.
5. Clone Performous from git as per the other build instructions

6. Run the provided build script

  • Open a terminal and navigate to performous/osx-tools/, then type
 chmod +x ./performous-app-build.sh && ./performous-app-build.sh
    • Note: There might be messages stating you need to install further dependencies for the build process. Follow on-screen instructions here
    • Note: Make sure to edit the performous-app-build.sh script and change the MAKE_JOBS variable to a number suitable to your machine, as a rule-of-thumb, you should change it to the lesser of how many CPU cores or Gb of RAM your computer has.
7. This should create a file Performous.dmg in that directory. Mount that and drag Performous to Applications to install.

8. You'll most likely need to visit the audio configuration first in the configure menu. The integrated webserver can also be configured. Also check the wiki for supported paths for songs.

9. Play and have fun!

macOS with Homebrew

Building with Homebrew is easier than with MacPorts.

brew install boost cmake ffmpeg@4 help2man icu4c portaudio portmidi opencv libepoxy librsvg libxml++3 sdl2 dylibbundler aubio fftw glm nlohmann-json fmt
brew link ffmpeg@4

Then follow the usual Performous build instructions. No special flags are required and you can do make install without sudo.

You can also generate a Mac App and dmg with:

chmod +x ./performous-app-build.sh && ./performous-app-build.sh

Windows

There are two ways to create a Windows executable:

1. Using Visual Studio (with MSVC)

2. Crosscompiling from Linux (with MXE)

Each come with their own difficulties but are explained in the sections ahead.

Visual Studio

We used Visual Studio Community Edition 2022 to create our native Windows builds. You'll need to have the C++ MFC for latest v143 build tools (x86 & x64) component of Visual Studio installed. As package manager we use the latest master of vcpkg We assume you have Git configured and are able to run commands at the commandline or from PowerShell. To be able to build a 64bit Performous we'll have to go through a few simple steps:

1. Download + Install vcpkg:

  • determine the correct vcpkg revision by checking .github/workflows/windows.yml, look for the step that uses the Lord-Kamina/vcpkg-action@update_cache action and copy the value of the "revision" variable
git clone https://github.com/Microsoft/vcpkg
cd vcpkg
git checkout <vcpkg revision determined in previous step>
git pull
.\bootstrap-vcpkg.bat
.\vcpkg.exe integrate install
.\vcpkg.exe install aubio boost-asio boost-iostreams boost-locale boost-program-options boost-system cairo cpprestsdk ffmpeg fftw3 fmt fontconfig gdk-pixbuf gettext glibmm glm gtest icu libepoxy librsvg libsigcpp libxml2 libxmlpp nlohmann-json openblas opencv openssl pango portaudio portmidi pthreads sdl2

2. Set some environment variable to configure vcpkg (Windows Button + R -> sysdm.cpl -> go to "Advanced" tab -> "Environment variables" -> New Uservariable):

KEY = VCPKG_ROOT
VALUE = C:\Users\baklap4\source\repos\performous\vcpkg

KEY = VCPKG_DEFAULT_TRIPLET
VALUE = x64-windows

KEY = VCPKG_FEATURE_FLAGS
VALUE = versions

3. Important for Visual Studios use of the CMakePresets.json settings instead Visual Studios own is the following configuration. Open the "Options" dialog -> CMake -> General -> CMake configuration file. Select "Never use CMake Presets".

4. Download pkg-config or here

5. Extract your zip next to the vcpkg folder so you'll get a structure like this:

<root>
  |_>vcpkg/
  |_>pkg-config/
6. Setup some environment variables to configure pkgconfig (Windows Button + R -> sysdm.cpl -> go to "Advanced" tab -> "Environment variables" -> New Uservariable)
KEY = PKG_CONFIG_EXECUTABLE
VALUE = C:\Users\baklap4\source\repos\performous\pkg-config\bin\pkg-config.exe

7. Clone Performous (git clone https://github.com/performous/performous.git), open folder with Visual Studio's folder view feature. Tested at VS2022, but should also works with VS2019 and VS2017.

8. Wait for cmake to generate cache

9. Start a build (ctrl + shift + b) and wait for it to finish

10. Start playing and debugging the game.

Cross-compilation

The dependencies can be cross-compiled for Windows from Debian/Ubuntu Linux (possibly others, too), using the MinGW32/MinGW54 cross compiler. Best results are currently achieved using the "M cross environment" aka. MXE:

Get MXE:

 git clone -b master https://github.com/mxe/mxe.git

Set up the settings.mk file (adjust JOBS to your number of CPU cores):

 JOBS := 4
 MXE_TARGETS :=  i686-w64-mingw32.shared
 LOCAL_PKG_LIST := gettext sdl2 boost portaudio ffmpeg portmidi pango \
   gdk-pixbuf librsvg libsigc++ libxml++ libepoxy
 .DEFAULT local-pkg-list:
 local-pkg-list: $(LOCAL_PKG_LIST)

Run "make" to build the cross-compiler and packages (you can speed up the process by doing "make -j3", where 3 is the number of CPU cores you wish to use).

When building later, replace the plain cmake command with these commands:

 MXE_PREFIX=/where/mxe/is/installed
 MXE_TARGET=i686-w64-mingw32.shared
 cmake .. -DPKG_CONFIG_EXECUTABLE=$MXE_PREFIX/usr/bin/$MXE_TARGET-pkg-config \
  -DCMAKE_TOOLCHAIN_FILE=$MXE_PREFIX/usr/$MXE_TARGET/share/cmake/mxe-conf.cmake \
  -DBoost_THREAD_LIBRARY_RELEASE=$MXE_PREFIX/usr/$MXE_TARGET/bin/libboost_thread_win32-mt.dll \
  -DENABLE_WEBCAM=OFF

Downloading and installing the sources

Obtain latest code

Recommended: Using Git

Use Git to get the latest development version from our public repository:

 git clone git://github.com/performous/performous.git
 cd performous
 git submodule init
 git submodule update

You'll need a Git client. The command line program is fine, but if you prefer graphical interface, you can install e.g. git-gui on Linux and TortoiseGIT on Windows.

Alternative: Source code tarballs

If you don't want to bother with git, you can just download the bleeding edge code directly.

Tarballs of stable releases are also available for distributors but they are not recommended if you are building it for yourself. You can download the released sources from Performous Download page.

Build and install

CMake

 cd performous      # Where you downloaded the sources
 mkdir build        # Make the build in a separate folder that you can easily clean up
 cd build
 cmake ..           # Prepare build and check that all dependencies are in place
 make -j8           # Compile everything (replace 8 with number of CPU cores)
 sudo make install  # Install
 performous         # Start the game

If you get errors (especially if they are from the cmake command), you are probably missing some libraries required by the game. Install the needed libraries (development versions, e.g. libboost-dev) and retry the failing step until all dependencies are sorted out.

Optionally, if you want to change installation path or do other compile-time configuration, you can use ccmake command line tool in build directory, after running cmake:

 ccmake .

There are also graphical interfaces for CMake, e.g. cmake-qt-gui on Ubuntu. Running cmake or ccmake is not required with GUI tools.

Before installing vo "make install", modify CMAKE_INSTALL_PREFIX if you don't want it installed in /usr/local/.

Building an AppImage (Experimental)

Note: It is highly recommended to build the AppImage on the oldest LTS supported version of Ubuntu. The version of Ubuntu that is used to build the AppImage must also match the target dependencies being pulled in to the AppImage, for example having the host machine running Ubuntu Focal while pulling in dependencies from the Ubuntu Focal deb repo. You will need all of the development packages needed to build Performous on the host machine as well.

To build an AppImage for performous, do the following:

1. Install AppImage-Builder

2. Setup, compile and install performous into an AppDir folder, using a modified prefix:

# Set The performous version
export PACKAGE_VERSION="<Insert Version Here>"
sed -i s/@@VERSION@@/${PACKAGE_VERSION}/ AppImageBuilder.yml
mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release -DENABLE_WEBSERVER=ON -DENABLE_WEBCAM=ON -DPERFORMOUS_VERSION=$PACKAGE_VERSION ..
make -j$(nproc) install DESTDIR=../AppDir
cd ..

3. Build the AppImage from the AppDir, using the recipe provided for performous, which contains all needed dependencies:

appimage-builder --recipe AppImageBuilder.yml --skip-test
Clone this wiki locally