Compiling Sources under Windows
From Rigs of Rods Wiki
Contents |
You can download and compile the Rigs of Rods sources completely with tools that are available for free.
Required Software
Download and install all required software first:
- Visual Studio C++ Express 2010 (any other VS version above that should work as well)
- install the latest Service Pack (SP1 as of Jan 2012), see http://www.microsoft.com/visualstudio/en-us/
- DirectX SDK June 2010 or February 2010
- CMake
- Latest RoR dependencies: http://sourceforge.net/projects/rigsofrods/files/rigsofrods/0.4-dev/ (download ror-dependencies-XX.zip) (replace XX with the highest number available, download and store the zip, we will unpack it later on). (Note: 64 bit prepackaged dependencies are not available at the moment; see [1])
- Latest RoR sources: http://sourceforge.net/projects/rigsofrods/files/rigsofrods/0.4-dev/ (download rigsofrods-source-0.4.XX.zip) (replace XX with the highest number available, download and store the zip, we will unpack it later on)
(restart your computer after installing all above tools)
Setting up the environment
Since 0.39.2 it is possible to build Rigs of Rods under Windows with precompiled dependencies for 32 bit and 64 bit. Depending on what you compile, some steps might slightly differ. Also, you can only build x64 (64 bit version) on a real 64 bit platform. However, you can still build x86 (32 bit) on an 64 bits platform due to backwards compatibility.
Getting the source code from sourceforge
- Create an empty directory anywhere where you have enough free disk space (~3 GB) for example, we chose this now: C:\dev\
- unpack the file rigsofrods-source-*.zip into that directory. It will create a new directory called "rigsofrods-source-0.4.X"
- unpack ror-dependencies-*.zip into C:\dev\rigsofrods-source-0.4.X as directory "dependencies" so that it is beside the "bin" and "source" directories.
Using CMake
- Start cmake from the Windows start menu: START->Programs->CMake->cmake-gui
- "Where is the source code": C:\dev\rigsofrods-source-0.4.X\
- "Where to build the binaries":
- for a 32 bit build: C:\dev\rigsofrods-source-0.4.X\build_x86
- for a 64 bit build: C:\dev\rigsofrods-source-0.4.X\build_x64
- for a 32 bit build: C:\dev\rigsofrods-source-0.4.X\build_x86
- Click the "Configure" button.
- for a 32 bit build choose "Visual Studio 2010" and "Use default native compilers" (first option).
- for a 64 bit build choose "Visual Studio 2010 Win64" and "Use default native compilers" (first option).
- Click the "Configure" button.
- Say "yes" if it asked if the directory should be created.
- Click "Configure" twice until all entries are white
- Click "Generate" and close CMake
Compiling the source code
- Navigate in Windows explorer to the folder C:\dev\rigsofrods-source-0.4.X\build_x86 (or build_x64 for 64 bit) and open the file RoR.sln. Visual Studio should open. (if you are asked, open with Visual Studio for C++)
- In Visual Studio, do the following: from the menu: Build -> build Solution (this can take some time, around 15 minutes on an average dualcore/ i7-2600K : 9min)
- The compilation is done when you can read something like the following in the bottom text output window: ========== Build: * succeeded * ==========
Done! After building you will find RoR ready to use in the bin\Release directory.
You can navigate with the Windows explorer to C:\dev\rigsofrods-source-0.4.X\bin\Release\ and use it the same way as game directory if it was installed there.
Note: the only difference is that the resources will reside one directory higher, but RoR should figure that out itself.
Troubleshooting
- If the compile step is ok but you don't see any executable or the log writes some missing libs, it may be something wrong with the linking step. Some common issues are the DirectX libraries. To include them manually to the project, right-click on RoR "folder" (the folder on the left in Visual Studio, where the project is) and click Properties. A popup window should appear, then go to Configuration properties and then to VC++ directories. Please add to Libraries directory this path (note: use ";" to separate the various paths): C:\Program Files\Microsoft DirectX SDK (<your version>)\Lib\x86. You have to change your version with the version that's installed on your machine. The simplest way to do it is to browse the program file folder. Don't remove or add anything else
- If you are unable to compile RoR at all or strange errors comes up (like RPC errors), you missed to update to latest version both Boost or DirectX SDK. This is an important step before continue.
- If you are unable to compile RoR, ensure your build is set to Release mode, not debug mode (see [2])
- It may happen that RoR wont start in the bin directory. Simply put the new executable into main release folder and try launch from there. If it doesn't, you simply missed something.
- If you receive an error such as "fatal error C1083: Cannot open include file: 'stdint.h': No such file or directory " Your dependencies folder may be 'read only'. To fix, right click the dependencies folder, un-tick read only, and apply to all files and sub-directories.
- If you try to run the compiled RoR Configurator it will tell you that you are missing some .dll files. You then know that you chose the wrong compilation options when compiling wxidgets. We normally link statically against the libs.
- These compile steps and hints are valid only under Visual C++ 2010 and Windows, although they may be similar for other configurations. To build sources for other systems, please see: Compile sources


Gold
Silver
Bronze