Skip to content

Building

Filip Gawin edited this page Jul 5, 2018 · 71 revisions

Introduction

  • This is a general guide on how to build OpenRW mostly aimed at beginners.
    • There are also other ways which are not described here.
  • Try to avoid using path-names which contain spaces as your toolchain or OpenRW may not be able to handle it.
  • Use forward slashes (/) instead of backward slashes (\) for path-names unless explicitly stated otherwise.
  • Text in angle brackets (< and >) should be replaced by you (also remove the brackets!).

Pre-steps

You usually have to install dependencies or set up your toolchain before you can start building OpenRW.

Linux

It is assumed that you have a toolchain installed (including git, gcc, cmake and all standard libraries)

Ubuntu

# apt install libbullet-dev libsdl2-dev libavcodec-dev libavformat-dev libglm-dev libopenal-dev libboost-dev libboost-filesystem-dev libboost-system-dev libboost-program-options-dev

Arch Linux

# pacman -S bullet glm ffmpeg sdl2 boost

Note that there is an AUR package which is maintained by a community member.

Gentoo Linux

SDL2 has to be compiled with OpenGL support so add media-libs/libsdl2 opengl to /etc/portage/package.use.

# emerge -a sci-physics/bullet media-libs/glm media-video/ffmpeg media-libs/libsdl2 dev-libs/boost

Fedora

# dnf install libGL-devel openal-soft-devel ffmpeg-devel bullet-devel glm-devel SDL2-devel boost-devel

Windows

MinGW / MSYS

If you don't have MSYS installed yet, download and install MSYS. Please do not include spaces in the MSYS install path.

Start a MSYS2 MinGW shell and install the MinGW packages for the toolchain and the dependencies using the following command:

pacman -Syu
pacman -S mingw-w64-x86_64-gcc make mingw-w64-x86_64-openal mingw-w64-x86_64-bullet mingw-w64-x86_64-glm mingw-w64-x86_64-ffmpeg mingw-w64-x86_64-SDL2 mingw-w64-x86_64-boost

Note that this installs the 64-bit toolchain. If you want to produce 32-bit code you should instead install packages starting with mingw-w64-i686- instead of mingw-w64-x86_64-

Next, type cmake to find out if you have an existing CMake installation. If you don't have it installed already (command not found), type pacman -S mingw-w64-x86_64-cmake for 64-bit version or pacman -S mingw-w64-i686-cmake for 32-bit version to start the installation.

You can also install Git using pacman -S git if you don't have another Git installation and intend to use it.

You can close the MSYS shell now.

Microsoft Visual Studio 2017

  1. Install a Git client such as Git for Windows

  2. Install CMake

  • You can download any Windows version here.
  • If you use the graphical installer (.msi-File) you should choose one of the "Add CMake to the system PATH"-options for convenience. If you don't do this (or use the version without installer), you'll manually have to add CMake to the %PATH% variable if you intend to use the console version. Alternatively, you can use the graphical user-interface for CMake.
  1. Install Boost
  • Visual Studio 2017 needs version 14.1
  • This wiki assumes Boost is installed in C:\boost
  • You can either build it from source or, the recommended way, install it from binary
  • Binaries: 32-bit 64-bit
  • Sources
  1. Clone the openrw git project from https://github.com/rwengine/openrw.git

macOS

Mac users should install Xcode and those packages from Homebrew:

brew install cmake bullet glm ffmpeg sdl2 boost

OpenBSD

Only tested on -current

pkg_add cmake ffmpeg glm bullet sdl2 gcc-4.9

On OpenBSD you will also need to tell openrw to build using egcc and eg++:

export CC=egcc CXX=eg++ 

Getting the source code

Git

Git is recommended if you also want to develop OpenRW.

git clone --recursive https://github.com/rwengine/openrw.git openrw

Note that you must use the recursive option to also clone the submodules.

Source Package

Alternatively, you can download the latest source code package.

Build

Most platforms

Open a shell in the OpenRW directory and type:

mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release
make

Windows

MinGW / MSYS

Open a MinGW Shell (this is not the MSYS shell you've used to install MinGW!) in the OpenRW directory and type:

mkdir build
cd build
cmake .. -G"MSYS Makefiles" -DCMAKE_BUILD_TYPE=Release
make

Microsoft Visual Studio 2017

This expects cmake in your %PATH% or shell environment

  1. Open a command window

    • This requires cmake to be your %PATH%
  2. Change the working directory to the checked out openrw directory

  3. Run the following (setting variables the following variables

    • For 32-bit Release builds:
set PLATFORM=win32
set CONFIGURATION=Release
set CMAKE_GENERATOR=Visual Studio 15 2017
set BOOST_ROOT=C:\boost
set BOOST_VERSION=1.67.0
set DEP_DIR=C:\dependencies
set WIN_DEP_NAME=openrw-windows-dependencies
set WIN_DEP_URL=https://github.com/rwengine/openrw-windows-dependencies
  • For 64-bit Release builds:
set PLATFORM=x64
set CONFIGURATION=Release
set CMAKE_GENERATOR=Visual Studio 15 2017
set BOOST_ROOT=C:\boost
set BOOST_VERSION=1.67.0
set DEP_DIR=C:\dependencies
set WIN_DEP_NAME=openrw-windows-dependencies
set WIN_DEP_URL=https://github.com/rwengine/openrw-windows-dependencies
  1. Run the experimental script to fetch the dependencies, configure and build the project
ctest -S cmake/ctest/script_experimental.ctest
  1. A Visual Studio 2017 project has been created in the build\experimental subdirectory.

Additional CMake Build options

The default build configuration will only build rwgame. To build other components:

  • BUILD_TESTS — Build the test suite
  • BUILD_VIEWER — Build the Qt GUI for viewing data
  • ENABLE_SANITIZERS — Enable selected sanitizers for easier debugging (available: address, undefined, leak, thread)

An up-to-date list of (most) configuration options can be found at https://github.com/rwengine/openrw/blob/master/cmake_options.cmake

Clone this wiki locally