-
Notifications
You must be signed in to change notification settings - Fork 181
Building
- 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!).
You usually have to install dependencies or set up your toolchain before you can start building OpenRW.
It is assumed that you have a toolchain installed (including git
, gcc
, cmake
and all standard libraries)
# 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
# pacman -S bullet glm ffmpeg sdl2 boost
Note that there is an AUR package which is maintained by a community member.
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
# dnf install libGL-devel openal-soft-devel ffmpeg-devel bullet-devel glm-devel SDL2-devel boost-devel
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.
-
Install a Git client such as Git for Windows
-
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.
- 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
- Clone the openrw git project from
https://github.com/rwengine/openrw.git
Mac users should install Xcode and those packages from Homebrew:
brew install cmake bullet glm ffmpeg sdl2 boost
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++
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.
Alternatively, you can download the latest source code package.
Open a shell in the OpenRW directory and type:
mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release
make
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
This expects cmake
in your %PATH%
or shell environment
-
Open a command window
- This requires
cmake
to be your%PATH%
- This requires
-
Change the working directory to the checked out
openrw
directory -
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
- Run the experimental script to fetch the dependencies, configure and build the project
ctest -S cmake/ctest/script_experimental.ctest
- A Visual Studio 2017 project has been created in the
build\experimental
subdirectory.
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