Compiling

Paul Chote edited this page Jun 4, 2018 · 56 revisions
Clone this wiki locally

If you just want to run a pre-built version of the code, see Installation.

You can download the OpenRA source code either from the Releases page (we suggest using the -source.tar.bz2, which are pre-configured with the correct in-game version strings), or using Git. If you want to modify OpenRA and share your changes with others then we strongly recommend that you follow the instructions in the contributing guide to fetch OpenRA using Git. If you just want to play OpenRA, the tarballs provide a lower barrier to entry.

Windows

OpenRA includes a helper script called make.cmd that can automatically configure and build the source code without requiring external tools.

The first step to compiling OpenRA, even if you plan to use Visual Studio, is to run make.cmd and select the dependencies option at the prompt. This command will automatically download the thirdparty libraries that are needed from nuget.

You can then run make.cmd again and choose the all option to compile the code. Run launch-game.cmd and select a mod to launch the game.

If you download the source code using Git and want to play online you must run make.cmd with the version command to set the in-game version string. This step is not required if you download the source tarball.

If you'd like to edit or compile the source code using Visual Studio:

  • Open OpenRA.sln with Visual Studio 2013/2012 (Community/Express). Then Build → Build Solution (F6).
  • Right click on the OpenRA project (Solution 'OpenRA') in Solution Explorer → Properties. Change Single startup project into "OpenRA.Game".
  • Start the game by going to Debug → Start Without Debugging / Start Debugging. (F5)
  • To start a specific default mod in the Windows version, you have to right click on the OpenRA project (Solution 'OpenRA') in Solution Explorer → Properties again, open the configuration manager by clicking the button in the top right, select the dropdown ("Release") in the top left and click <New...>. Add a name for your configuration, select to copy the settings from debug and make sure to check create a new configuration. After that, open in the main menu bar Debugging → "Properties of OpenRA.Game", select the configuration you created and set Game.Mod=ra to the default mod you want to start, for example Game.Mod=cnc or Game.Mod=ts. Save the file, close it and start the mod by going to Debug.

Linux/Mac

OpenRA uses several external libraries to provide low-level functionality. Most systems will already include these, but if OpenRA fails to compile or run then you should make sure that these are available:

  • Mono framework (macOS: Do not install mono via brew. This installs libraries to the wrong location for OpenRA)
  • SDL 2 (Linux only: OpenRA includes a custom macOS dylib)
  • Lua 5.1 (Linux only: OpenRA includes a custom macOS dylib)
  • FreeType
  • OpenAL
  • curl
  • unzip
  • xdg-utils (Linux only)

Check INSTALL.md for the exact package names on a variety of distros.

From a terminal in the OpenRA source directory:

  • make dependencies will download and copy necessary mono/.NET libraries to the working directory. It will also identify and configure the path to your system Lua library.
  • Build the source with make all
  • Run the game with launch-game.sh