How to compile

This page explains how to build Lagrange in a POSIX-compatible environment. The required tools are a C11 compiler (e.g., Clang or GCC), CMake and pkg-config.

❶ Download and extract a source tarball. Please note that the GitHub/Gitea-generated tarballs do not contain the “the_Foundation” submodule; check which tarball you are getting. Alternatively, you may also clone the repository and its submodules:

git clone --recursive --branch release \
  https://git.skyjake.fi/skyjake/lagrange

❷ Check that you have the dependencies installed: SDL2, OpenSSL, libpcre, zlib, libunistring. For example, on macOS this would do the trick (using Homebrew):

brew install cmake sdl2 openssl@1.1 pcre libunistring

Or on Ubuntu:

sudo apt install cmake libsdl2-dev libssl-dev libpcre3-dev \
  zlib1g-dev libunistring-dev

❸ Optionally, install the mpg123 decoder library for MPEG audio support. For example, the macOS Homebrew package is "mpg123" and on Ubuntu it is "libmpg123-dev".

❹ Create a build directory.

❺ In your empty build directory, run CMake:

cmake {path_of_lagrange_sources}

❻ Build it:

cmake --build .

❼ Now you can run "lagrange", "lagrange.exe", or "Lagrange.app".

Installing to a directory

To install to "/dest/path":

cmake {path_of_lagrange_sources} -DCMAKE_INSTALL_PREFIX=/dest/path
cmake --build . --target install

This will also install an XDG .desktop file for launching the app.

Compiling on macOS

When compiling on macOS there are a couple of things to note: Homebrew's OpenSSL needs to be manually added to pkg-config's search path, and SDL requires a small patch to enable smooth trackpad momentum scrolling to work as expected.

Compiling on Windows

Windows builds require MSYS2. Cygwin should also work, although hasn't been tested.

Compiling on Raspberry Pi 2/3

You should use a version of SDL that is compiled to take advantage of the Broadcom VideoCore OpenGL ES hardware. This provides the best performance when running Lagrange in a console.

When running under X11, software rendering is the best choice and in that case the SDL from Raspbian etc. is sufficient.

The following build options are recommended on Raspberry Pi: