Skip to content

Build Instructions for Linux

jcm edited this page Nov 25, 2024 · 24 revisions

Note

This page applies to the in-development new build system. For current build instructions, see here.

Table of Contents

Debian-based Build Instructions

1. Install dependencies

  • In a terminal window, install ares dependencies using apt:

    First, install build system dependencies:

    sudo apt install build-essential cmake ninja-build pkg-config curl ccache git
    

    Compiling with clang is optional, but generally recommended:

    sudo apt install clang
    

    Next, install required ares dependencies:

    sudo apt install \
        libgtk-3-dev \
        libcanberra-gtk-module \
        libgl-dev
    

    Lastly, install optional dependencies (at least one audio driver is recommended):

    sudo apt install \
        libasound2-dev \
        libao-dev \
        libopenal-dev \
        libsdl2-dev \
        libpulse-dev
    

    Installing librashader (via Open Build Service) is also recommended but not required.

2. Get the source code

  1. In a terminal window, navigate to a directory where you would like to build ares.
  2. Clone the ares repository and change into its directory:
git clone https://github.com/ares-emulator/ares
cd ares

3. Build ares

First, generate a build environment:

mkdir build && cd build
cmake .. -G Ninja

During the above generation step, you can optionally configure ares in a number of ways. See the Build Options page for a full list of configuration options. If you wish to compile with clang in particular, pass -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ at the generation step.

Next, build the project:

cmake --build .

With ares built, you may run it from the staging directory:

./rundir/bin/ares

If you want to install ares to another location, you may also optionally do so with CMake:

cmake --install . --prefix </your/chosen/prefix>

Red-Hat based (Fedora, etc.)

1. Install dependencies

  • In a terminal window, install ares dependencies using dnf:

    Build system dependencies:

    sudo dnf install cmake ninja-build pkg-config curl ccache git
    

    Compiling with clang is optional, but generally recommended:

    sudo dnf install clang
    

    Next, install required ares dependencies:

    sudo dnf install \
        gtk3-devel \
        libx11-devel \
        libXrandr-devel \
        mesa-libGL-devel \
    

    Lastly, install optional dependencies (at least one audio driver is recommended):

    sudo dnf install \
        openal-soft-devel \
        alsa-lib-devel \
        sdl2-devel \
        pulseaudio-libs-devel
    

    Installing librashader (via Open Build Service) is also recommended but not required.

2. Get the source code

  1. In a terminal window, navigate to a directory where you would like to build ares.
  2. Clone the ares repository and change into its directory:
git clone https://github.com/ares-emulator/ares
cd ares

3. Build ares

First, generate a build environment:

mkdir build && cd build
cmake .. -G Ninja

During the above generation step, you can optionally configure ares in a number of ways. See the Build Options page for a full list of configuration options. If you wish to compile with clang in particular, pass -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ at the generation step.

Next, build the project:

cmake --build .

With ares built, you may run it from the staging directory:

./rundir/bin/ares

If you want to install ares to another location, you may also optionally do so with CMake:

cmake --install . --prefix </your/chosen/prefix>

Other

Building ares on other Linux distributions should not present a high degree of difficulty. The primary requirement is that OpenGL and one of ares's audio drivers is supported on the system. Here we present general package requirements

Prerequisites

  • Git
  • CMake 3.28 or higher
  • Clang or GCC
  • pkg-config

Optional but recommended build tools include:

  • Ninja
  • Ccache

ares requires development versions of the following packages in order to build:

  • X11
  • libGL
  • GTK3

Recommended development packages include:

You may also configure with development packages for other audio drivers:

  • OpenAL
  • AO
  • ALSA
  • PulseAudio

Configuration

First, clone the ares repository:

git clone https://github.com/ares-emulator/ares
cd ares

Building ares with clang and Ninja is recommended:

mkdir build && cd build
cmake .. -G Ninja

The generation step will report what features are enabled and disabled according to the libraries found on your system. Next, build ares:

cmake --build .

After building, products can be found in the rundir folder. ares can be run from this location, or the rundir can be relocated. ares can also be installed:

cmake --install . --prefix <your install prefix>

For further configuration options, see the Build Options page.

Staging Directory Structure

The build staging directory uses a standard prefix structure described below. Since ares does not ship any libraries, ares can be run freely from this staging directory, and the rundir can also be relocated. It is still, however, recommended to use CMake's --install command to install ares in a particular location. Installs and staging follow CMake GNUInstallDirs conventions for directory naming.

If you wish to not install slang-shaders underneath the ares data directory, pass -DARES_BUNDLE_SHADERS=NO during build configuration.

rundir
  ├─ bin
  │   ├─ ares
  │   └─ sourcery
  └─ share
      ├─ ares
      │   ├─ Database
      │   │     ├─ Arcade.bml
      │   │     ├─ BS Memory.bml
      │   │     ├─ Famicom.bml
      │   │     ├─ MSX.bml
      │   │     ├─ MSX2.bml
      │   │     ├─ Neo Geo.bml
      │   │     ├─ Sufami Turbo.bml
      │   │     ├─ Super Famicom Boards.bml
      │   │     └─ Super Famicom.bml
      │   └─ Shaders
      │         └─ <contents of slang-shaders>
      ├─ applications
      │       └─ ares.desktop
      └─ icons
           └─ hicolor
                 └─ 256x256
                       └─ apps
                            └─ ares.png