1
0
mirror of synced 2025-02-09 23:28:22 +01:00
jujube/docs/Compiling.md

2.5 KiB

Compiling jujube

jujube uses the meson build system.

Regardless of the target platform the build steps are pretty much the same :

  1. Get an up-to-date C++ compiler
  2. Install (or build) the dependencies :
    • meson : the build system, installation explained here
    • SFML 2.5.1 : the game framework
    • possibly others
  3. Download the code from the repo
  4. Go to your terminal and type
    $ cd {jujube repo root}
    $ CXX={your compiler} meson build
    $ cd build
    $ ninja
    
    (Replacing the {...}s with what you chose)

and voila !

If you managed to compile jujube with another toolchain I did not mention here you're very welcome to do a PR appending the relevant parts of this doc.

Linux

You need at least gcc 9.0.0

Install meson either from system packages, or alternatively with pip if you want a more recent meson version

Install dependencies, for instance on Debian :

$ git submodule init
$ git submodule update
$ sudo apt install libsfml-dev libdw-dev

Windows

This section explains how to setup MSYS2 to compile jujube. MSYS2 is most likely not the only way to go but it's my favorite way of getting a very recent gnu-friendly toolchain on windows.

MSYS2

Installing MSYS2 is extremly straightforward and detailed on their website. Once you're done pacman -Syuing and pacman -Suing your system you can install the required packages for jujube :

$ pacman -S meson mingw-w64-x86_64-toolchain mingw-w64-x86_64-meson mingw-w64-x86_64-sfml mingw-w64-x86_64-cairo

then you can just use the same build commands as the Linux section but from the MSYS2 MinGW 64-bit terminal

MacOS

clang-9 from brew's llvm package

If you do not have it already, install Homebrew. When it's done use it to install basically everything :

$ brew install llvm sfml openal-soft

Once it's done (llvm is huge, go do something else while it installs), open a terminal, cd to your local copy of jujube's repo and use this carefully crafted command to setup your build folder :

$ LLVM=$(brew --prefix llvm) \
CC=$LLVM/bin/clang \
CXX=$LLVM/bin/clang++ \
LD=$LLVM/bin/ld.lld \
AR=$LLVM/bin/llvm-ar \
RANLIB=$LLVM/bin/llvm-ranlib \
PKG_CONFIG_PATH+=$(brew --prefix sfml)/lib/pkgconfig:$(brew --prefix openal-soft)/lib/pkgconfig \
LDFLAGS+="-L$LLVM/lib -Wl,-rpath,$LLVM/lib" \
CPPFLAGS+="-I$LLVM/include -I$LLVM/include/c++/v1/" \
meson build

then just

$ cd build
$ ninja