Getting started » Downloading and building extras

Guide how to download and build extras for Magnum engine.

Extras bring additional functionality for the Magnum engine — playground for testing new APIs, specialized stuff that doesn't necessarily need to be a part of the main Magnum repository or mutually exclusive functionality.

Prepared packages

The easiest way to install Magnum Extras is to use one of the ready-made packages for your platform of choice. See Manual build if you want to have more control. Cross-compiling is very similar to cross-compiling of Magnum itself.

Vcpkg packages on Windows

Magnum Extras are available as a Vcpkg package. After setting up Vcpkg like described in the README, you can install latest stable version of Magnum Extras with all dependencies like this:

vcpkg install magnum-extras

But often you may want to install the latest Git revision of all Magnum projects instead:

vcpkg install corrade --head
vcpkg install magnum --head
vcpkg install magnum-extras --head

This by default installs a 32-bit dynamic version of the package, you can use vcpkg install magnum-extras:x64-windows or vcpkg install magnum-extras:x64-windows-static to install a 64-bit (static) version instead. You can also use the VCPKG_DEFAULT_TRIPLET variable to change the default — see the Vcpkg triplet documentation for more information.

Note that just a subset of extra libraries is installed by default. To opt-in or opt-out of additional features, you can use the following syntax; feature names are simply names of CMake WITH_* options from the Enabling or disabling features section but lowercase. See the feature documentation for more information.

vcpkg install magnum-extras[ui]

Packages installed using Vcpkg can be used straight away in Visual Studio — all you need to do is to #include the headers you want, the buildsystem will do all needed library linking and setup behind the scenes automatically. (Cool, isn't it?)

In order to make Magnum projects installed using Vcpkg available to CMake-based projects, specify the Vcpkg toolchain file on the command line when invoking CMake in a fresh build directory, for example:

mkdir build && cd build
cmake .. -DCMAKE_TOOLCHAIN_FILE=C:/src/vcpkg/scripts/buildsystems/vcpkg.cmake

If you want to pass additional flags to CMake, run vcpkg edit magnum-extras and edit OPTIONS in vcpkg_configure_cmake().

There are also Vcpkg packages for Magnum Plugins and Magnum Integration.

ArchLinux packages

In package/archlinux/magnum-extras-git there is a package for Git development build. The package is also in AUR as magnum-extras-git. It depends on Corrade, Magnum and Magnum Plugins ArchLinux packages.

There are also a few development packages for native builds, cross-compilation for Emscripten, Android and MinGW or various sanitizer/coverage builds. See the PKGBUILD files in the package/archlinux directory. They allow you to build and install the package directly from source tree. Example usage:

git clone git://github.com/mosra/magnum-extras && cd magnum-extras
cd package/archlinux
makepkg -fp PKGBUILD # or any other PKGBUILD file

In most cases the development PKGBUILDs also contain a check() function which will run all unit tests before packaging. That might sometimes fail or take too long, pass --nocheck to makepkg to skip that.

Once built, install the package using pacman:

sudo pacman -U magnum-extras-*.pkg.tar.xz

Edit the PKGBUILDs if you want to pass additional flags to CMake or enable / disable additional features.

There are also ArchLinux packages for Magnum Integration and Magnum Examples.

Packages for Debian, Ubuntu and derivatives

The package/debian/ directory contains all files needed for building Debian packages. You need the Corrade, Magnum and Magnum Plugins Debian packages installed and in addition also the dpkg-dev and debhelper packages. Building is easy, just change directory to package root, link or copy the package/debian directory there and run dpkg-buildpackage:

git clone git://github.com/mosra/magnum-extras && cd magnum-extras
ln -s package/debian .
dpkg-buildpackage

This will compile binary and development packages, which will then appear in a parent directory. Install them using dpkg:

sudo dpkg -i ../magnum-extras*.deb

If you want to pass additional flags to CMake or enable / disable additional features, add them to dh_auto_configure at the bottom of debian/rules. Watch out, as indentation has to be done using tabs, not spaces.

There are also Debian packages for Magnum Integration and Magnum Examples.

Gentoo Linux ebuilds

Gentoo Git ebuild is available in the package/gentoo directory. Get the Corrade, Magnum and Magnum Plugins Gentoo packages first and then build and install Magnum Extras like this:

git clone git://github.com/mosra/magnum-extras && cd magnum-extras
cd package/gentoo
sudo ebuild dev-libs/magnum-extras/magnum-extras-99999.ebuild manifest clean merge

If you want to pass additional flags to CMake or enable / disable additional features, add them to mycmakeargs in the *.ebuild file.

There are also Gentoo packages for Magnum Integration and Magnum Examples.

Homebrew formulas for macOS

macOS Homebrew formulas building the latest Git revision are in the package/homebrew directory. Either use the *.rb files directly or use the tap at https://github.com/mosra/homebrew-magnum. This will install the latest stable version of Magnum Extras with all dependencies:

brew install mosra/magnum/magnum-extras

But often you may want to install the latest Git revision of all Magnum projects instead:

brew install --HEAD mosra/magnum/corrade
brew install --HEAD mosra/magnum/magnum
brew install --HEAD mosra/magnum/magnum-plugins
brew install --HEAD mosra/magnum/magnum-extras

When installing from the *.rb files you need to install the Corrade, Magnum and Magnum Plugins Homebrew packages first. If you want to pass additional flags to CMake or enable / disable additional features, edit the *.rb file.

There are also Homebrew packages for Magnum Integration and Magnum Examples.

Manual build

The source is available on GitHub: https://github.com/mosra/magnum-extras. Building extras is very similar to building Magnum itself. See Downloading and building for additonal information about building and running tests, crosscompiling and platform-specific issues.

Enabling or disabling features

Similarly to Magnum, the libraries are build as shared by default. If you are developing for a platform which doesn't support shared libraries or if you just want to link them statically, enable BUILD_STATIC to build the libraries as static. If you plan to use them with shared libraries later, enable also position-independent code with BUILD_STATIC_PIC.

Libraries built in the Debug configuration (e.g. with CMAKE_BUILD_TYPE set to Debug) have a -d suffix, similarly to what is done when building Magnum itself.

By default no libraries are built and you need to select them manually:

  • WITH_UI — Build the Ui library
  • WITH_UI_GALLERY — Build the magnum-ui-gallery executable, which showcases the default Ui library widget style

Note that each namespace documentation contains more detailed information about its dependencies, availability on particular platforms and also a guide how to enable given library for building and how to use it with CMake.

Building documentation

The documentation for extras is built as part of of the main Magnum documentation. Clone the projects next to each other and continue as described in Building documentation.

Continuous Integration

Travis

In package/ci/ there is a travis.yml file with Linux GCC 4.7, macOS, Linux desktop GLES2/GLES3, iOS GLES2/GLES3, Emscripten WebGL1/WebGL2, Android GLES2/GLES3, AddressSanitizer and ThreadSanitizer configuration. Online at https://travis-ci.org/mosra/magnum-extras.

AppVeyor

In package/ci/ there is an appveyor.yml file with Windows desktop MSVC, MinGW, Windows desktop GLES2/GLES3 and Windows RT GLES2/GLES3 configuration. Online at https://ci.appveyor.com/project/mosra/magnum-extras.

Codecov.io

Linux, Linux GLES, macOS and Windows MinGW builds contribute to a combined code coverage report, available online at https://codecov.io/gh/mosra/magnum-extras.