Source code compiling

From SRB2 Wiki
Jump to navigation Jump to search
This article or section is badly written and in need of a rewrite. You can help the SRB2 Wiki by fixing this article to meet with the standards described by the Manual of Style.
To do
Overhaul this article and related subarticles – see the talk page

Welcome to the source code compiling tutorial. This tutorial teaches you how to compile SRB2's source code to create an executable you can launch. The compiling process is necessary for creating custom source code modifications or creating builds from the GitHub development repositories. This tutorial won't teach you how to modify the source code, it will only explain the process of compiling for several platforms.

Build systems

There are three main build systems used for compiling SRB2:

Makefiles (Windows/Linux)

Main article: Makefiles

This is the current method of compilation internally. For Windows, MinGW is required for compiling using Makefiles.

Visual C++ (Windows)

Visual C++ (MSVC) is Microsoft's C/C++ compiler. It is included in Microsoft's IDE, Visual Studio. While there exist projects for compiling SRB2 with MSVC, Windows builds compiled with Visual Studio versions older than 2015 cannot play multiplayer games with GCC builds due to differences in each compiler's struct packing schemes. As such, it is usually advised to use MinGW instead as the official builds are compiled under GCC.

Download Visual Studio 2017 Community Edition first from here. Visual Studio 2017 Community Edition is a free version of Visual Studio and is ideal for SRB2. NASM is required to build the game with Visual Studio.

Simply open the project file and press a little green arrow in the toolbar, and the compiled EXE and r_opengl.dll (if you didn't use SDL2) will be placed in bin/VC10/Win32/Release or bin/VC10/Win32/Debug. If this failed, please contact Alam or Wolfy on the Discord server.

CMake (Windows/Mac OS X/Linux)

Main article: CMake

See also: Compiling on macOS

In the future, SRB2 is planned to switch to CMake as its primary compiler. The implementation is currently unfinished, as such the compiled game may have sound and rendering errors.