Difference between revisions of "Compiling VDrift"

From VDrift
Jump to: navigation, search
(Added links to seperate OS pages.)
 
(6 intermediate revisions by the same user not shown)
Line 1: Line 1:
Compiling VDrift is different depending on the operating system on which it is compiled.
+
Compiling VDrift depends upon the build environment beeing set up correctly. See [[Getting VDrift]].
[[Compiling on Linux]]
+
 
[[Compiling on Mac OS X]]
+
Compiling VDrift makes it possible to [[Installing|Installing VDrift]].
[[Compiling on Windows]]
+
 
==Linux==
+
Compiling VDrift is different depending on the operating system on which it is compiled. So follow the applicable passage.
===Prerequisites===
+
 
Make sure you have all the required libraries and build tools. Make sure you also have the development files for each of the libraries.
+
= Compiling on FreeBSD =
 +
 
 +
To compile VDrift on FreeBSD, use the ports system.
 +
 
 +
== Latest Release ==
 +
 
 +
If you downloaded a release, simply run <code>make</code> on the '''vdrift''' port:
 +
 
 +
  cd /usr/ports/games/vdrift && make install clean clean-depends
 +
 
 +
== Development Version ==
 +
 
 +
If you Downloaded the development version, copy the '''vdrift''' and '''vdrift-data''' ports to '''vdrift-devel''' and '''vdrift-data-devel''':
 +
 
 +
  cd /usr/ports/games && cp -rf vdrift vdrift-devel && cp -rf vdrift-data vdrift-data-devel
 +
 
 +
To compile, run <code>make</code> on the newly-created '''vdrift-devel''' port:
 +
 
 +
  cd /usr/ports/games/vdrift-devel && make install clean clean-depends
 +
 
 +
= Compiling on Linux =
 +
 
 +
== Prerequisites ==
  
 
The required build tools include:
 
The required build tools include:
Line 20: Line 42:
 
* '''vorbisfile''' - File loading library for the ogg vorbis format
 
* '''vorbisfile''' - File loading library for the ogg vorbis format
 
* '''libvorbis''' - The Vorbis General Audio Compression Codec
 
* '''libvorbis''' - The Vorbis General Audio Compression Codec
 +
* '''libbullet''' - Bullet Physics Library
 +
* '''libcurl''' - the multiprotocol file transfer library
 +
* '''libarchive''' - library for reading and writing archive formats
 
* Boost C++ Libraries (header-file-only)
 
* Boost C++ Libraries (header-file-only)
 
* ASIO C++ Libraries (header-file-only)
 
* ASIO C++ Libraries (header-file-only)
  
Your Linux distribution may have different package names and/or bundled differently. The list above should give enough information to search for applicable packages within your distribution's package manager.
+
Make sure you have all the required libraries and build tools. Make sure you also have the development files for each of the libraries. Your Linux distribution may have different package names and/or bundled differently. The list above should give enough information to search for applicable packages within your distribution's package manager.
 
 
For Ubuntu, all the required packages may be installed using this command:
 
sudo apt-get install g++ scons libsdl-gfx1.2-dev libsdl-image1.2-dev libsdl-net1.2-dev libvorbis-dev libglew-dev libasio-dev libboost-dev
 
  
For Ubuntu 8.04 you additionally need:
+
=== Bullet ===
sudo apt-get install libboost-date-time-dev libboost-regex-dev
 
 
 
====Bullet====
 
As of SVN R2358 (2009-06-15 release and later), no steps are required to build bullet and you can continue to the next section.
 
  
 
For the 2009-02-15 release, the only step required is to expand the Bullet source archive:
 
For the 2009-02-15 release, the only step required is to expand the Bullet source archive:
Line 39: Line 57:
 
{{note|For older versions of VDrift, you will need to follow the [[Old Method of Compiling Bullet]].}}
 
{{note|For older versions of VDrift, you will need to follow the [[Old Method of Compiling Bullet]].}}
  
====SCons====
+
Ubuntu does not include a libbullet package, but getdeb does. To add the
 +
getdeb-repository to your sources-list.d:
 +
 
 +
    wget -q -O - http://archive.getdeb.net/getdeb-archive.key | sudo apt-key add -
 +
    sudo sh -c 'echo "deb http://archive.getdeb.net/ubuntu natty-getdeb games" > /etc/apt/sources.list.d/getdeb.list'
 +
    sudo apt-get update
 +
 
 +
=== LibGLEW ===
 +
 
 +
{{note|VDrift requires libglew version greater than 1.5.3.}}
 +
 
 +
Ubuntu 11.04 (Natty Narwhal) does contain libglew1.5, only. To install
 +
libglew1.6 and its development headers:
 +
 
 +
    wget http://archive.ubuntu.com/ubuntu/pool/universe/g/glew/libglew1.6_1.6.0-3_amd64.deb
 +
    sudo dpkg -i libglew1.6_1.6.0-3_amd64.deb
 +
    rm libglew1.6_1.6.0-3_amd64.deb
 +
   
 +
    wget http://archive.ubuntu.com/ubuntu/pool/universe/g/glew/libglew1.6-dev_1.6.0-3_amd64.deb
 +
    sudo dpkg -i libglew1.6-dev_1.6.0-3_amd64.deb
 +
    rm libglew1.6-dev_1.6.0-3_amd64.deb
 +
 
 +
=== Ubuntu 8.04 ===
 +
 
 +
For Ubuntu 8.04 you additionally need:
 +
sudo apt-get install libboost-date-time-dev libboost-regex-dev
 +
 
 +
=== SCons ===
 +
 
 
As of the 2005-10-02 release, VDrift no longer uses ./configure, make, etc. (autotools). Now the project is built with [http://scons.org/ SCons]. You may want to read a little about [[Using SCons]].
 
As of the 2005-10-02 release, VDrift no longer uses ./configure, make, etc. (autotools). Now the project is built with [http://scons.org/ SCons]. You may want to read a little about [[Using SCons]].
  
 
There are two ways to use SCons. The first way is to install scons on your system through your package manager, then you can use it simply by the name of the program, "scons". If you followed the directions for installing prerequisites for Ubuntu above, then you're done and can continue on to the next section. The second way is to use the scons-local package (included with VDrift) which will do the same thing but doesn't require that you install scons on your system. To do this, you must move the scons-local-0.96.95.tar.gz archive from tools to the root vdrift folder, un-tar the archive, and then use the <code>./scons.py</code> command instead of <code>scons</code>.
 
There are two ways to use SCons. The first way is to install scons on your system through your package manager, then you can use it simply by the name of the program, "scons". If you followed the directions for installing prerequisites for Ubuntu above, then you're done and can continue on to the next section. The second way is to use the scons-local package (included with VDrift) which will do the same thing but doesn't require that you install scons on your system. To do this, you must move the scons-local-0.96.95.tar.gz archive from tools to the root vdrift folder, un-tar the archive, and then use the <code>./scons.py</code> command instead of <code>scons</code>.
  
===Get the Code===
+
=== All other Packages ===
You can get the code from a source package for a particular version, or you can [[Getting the development version|get the development version]].
 
====Source Package====
 
[http://sourceforge.net/project/showfiles.php?group_id=137283 Download] the latest VDrift Linux source package. All the files in the package are in a directory called vdrift-'''version'''-src where '''version''' is something like 2009-06-15.
 
  
Unpack the archive.
 
  
tar jxvf vdrift-2009-06-15-src.tar.bz2
+
All other required packages can be installed using this command:
  
=====Enter directory=====
+
    sudo apt-get install g++ libarchive-dev libarchive-dev libasio-dev \
Now change directories into the location of your newly created VDrift source tree.
+
                        libboost-dev libcurl4-gnutls-dev libdrm-dev \
cd vdrift-2009-06-15
+
                        libgl1-mesa-dev libglu1-mesa-dev libkms1 \
 +
                        mesa-common-dev libsdl-gfx1.2-dev libsdl-image1.2-dev \
 +
                        libsdl-net1.2-dev libvorbis-dev freeglut3 libbullet0 \
 +
                        libbullet-dev scons
 +
 
 +
== Optional: Using scons-local instead of installing SCons ==
  
====Optional: Using scons-local instead of installing SCons====
 
 
If you have decided not to install SCons on your system, you can use scons-local. To set it up, do the following:
 
If you have decided not to install SCons on your system, you can use scons-local. To set it up, do the following:
  
Line 64: Line 110:
 
{{note|Some of the following steps refer to the <code>scons</code> command, you should now replace that with <code>./scons.py</code>.}}
 
{{note|Some of the following steps refer to the <code>scons</code> command, you should now replace that with <code>./scons.py</code>.}}
  
===Compiling===
+
== Compiling ==
 +
 
 
To compile VDrift, just use the <code>scons</code> command.
 
To compile VDrift, just use the <code>scons</code> command.
 
  scons
 
  scons
  
====Optional: Compile Options====
+
=== Optional: Compile Options ===
 +
 
 
You can use one or more compile options. To compile with optimization for a certain platform, you can use the '''arch''' option.
 
You can use one or more compile options. To compile with optimization for a certain platform, you can use the '''arch''' option.
 
  scons arch=a64
 
  scons arch=a64
 
Compiling VDrift in '''release''' mode will turn off debugging options, and enable more compiler optimizations.  VDrift runs much more quickly in release mode.
 
Compiling VDrift in '''release''' mode will turn off debugging options, and enable more compiler optimizations.  VDrift runs much more quickly in release mode.
 
  scons release=1
 
  scons release=1
 +
To enable force feedback, use this option:
 +
scons force_feedback=1
 +
You can get a list of all compile time options with:
 +
scons --help
 
{{note|These options are probably best left off the first time you compile. If you have problems compiling or running VDrift, it is easier to debug with them off. Once you verify that VDrift is compiling, then recompile with these optimizations to improve performance.}}
 
{{note|These options are probably best left off the first time you compile. If you have problems compiling or running VDrift, it is easier to debug with them off. Once you verify that VDrift is compiling, then recompile with these optimizations to improve performance.}}
  
===Installing===
+
== Installing ==
VDrift does not need to be installed to work and you can run it from the folder where you compiled it. If you do want to install, use the SCons build target '''install'''. This command must be run as root.
+
 
 +
VDrift does not need to be installed to work and you can run it from the folder where you compiled it. If you do want to install, use the SCons build target '''install'''. This command must be run as root.
 
  sudo scons install
 
  sudo scons install
 +
 
{{note|The <code>scons install</code> process was broken for several releases including the 2009-02-15 release and may fail to install needed datafiles.  If you have release 2009-02-15 or earlier, run "sudo scons install" as noted above and then manually re-copy the data files to the installed destination folder:
 
{{note|The <code>scons install</code> process was broken for several releases including the 2009-02-15 release and may fail to install needed datafiles.  If you have release 2009-02-15 or earlier, run "sudo scons install" as noted above and then manually re-copy the data files to the installed destination folder:
 
  sudo cp -r data/* /usr/share/games/vdrift/data}}
 
  sudo cp -r data/* /usr/share/games/vdrift/data}}
  
====Optional: Installation Location====
+
=== Optional: Installation Location ===
 +
 
 
You can change the installation prefix. For example, if you want VDrift to go in <code>/usr/local/share/games/vdrift</code>, you can change the '''prefix''' setting.
 
You can change the installation prefix. For example, if you want VDrift to go in <code>/usr/local/share/games/vdrift</code>, you can change the '''prefix''' setting.
 
  scons install prefix=/usr/local
 
  scons install prefix=/usr/local
Line 87: Line 142:
 
{{note|There are many more build and install options, see the [[Using SCons]] page for more information.}}
 
{{note|There are many more build and install options, see the [[Using SCons]] page for more information.}}
  
===Running===
+
= Compiling on Mac OS =
For release 2009-02-15 and earlier, if you used the default install locations, VDrift can be run with the command:
+
 
/usr/share/games/vdrift/bin/vdrift
+
== Prerequisites ==
For release 2009-06-15 and later, if you used the default install locations, VDrift can be run with the command:
 
/usr/local/bin/vdrift
 
  
==Mac OS X==
+
The VDrift Mac OS X project requires Xcode 3.2 or later. The latest version, [http://developer.apple.com/xcode/ Xcode] 4.1 is free on the [http://itunes.apple.com/us/app/xcode/id422352214?mt=12&ls=1 Mac App Store].
===Prerequisites===
 
The VDrift Mac OS X project requires Xcode version 2.2 with the "10.4 Universal SDK" and the "X11 SDK" installed.
 
  
===Download===
 
 
Get the VDrift source code, either from the latest source release on the [http://sourceforge.net/project/showfiles.php?group_id=137283 VDrift downloads page], or the [[Getting the development version#Mac OS X|development version]].
 
Get the VDrift source code, either from the latest source release on the [http://sourceforge.net/project/showfiles.php?group_id=137283 VDrift downloads page], or the [[Getting the development version#Mac OS X|development version]].
  
===Build===
+
== Building ==
Finally open ''tools/osx/vdrift.xcodeproj'' and hit "Build" from XCode's "Build" menu.
+
 
 +
Open ''tools/osx/vdrift.xcodeproj'' and in Xcode 4 or higher click "Build" in the "Product" menu, otherwise hit "Build" from XCode's "Build" menu.
  
==Windows==
+
== Error fixing ==
In order to build VDrift for Windows, you must set up the tools to build the software, build VDrift, and then install VDrift into a runtime folder.
 
  
===Source and Data===
+
If when building, you get some errors, it is most likely because the Xcode project is out of date (it often is as we don't have an active Mac OS X developer). To fix it:
====VDrift====
+
* Remove files from Xcode that are in the project but not in the repository anymore.
Get the VDrift source code and data, either from the latest source release on the [http://sourceforge.net/project/showfiles.php?group_id=137283 VDrift downloads page], or the [[Getting the development version#Windows|development version]].
+
* Add new files to Xcode that are in the repository, but have not yet been added to the project.
{{note|From this point on the directory in which you checked out VDrift will be referred to as the root VDrift directory. The development environment setup script puts this in an environment variable $VDRIFT_DIR.}}
 
  
====Boost====
+
= Compiling on Windows =
Download a Boost distribution from this link:
 
  
http://sourceforge.net/project/showfiles.php?group_id=7586&package_id=8041&release_id=679861
+
== Prerequisites ==
  
Uncompress Boost, and move the boost_1_39_0/boost folder to VDrift/tools/win/include
+
* Get the VDrift source code and data [[Getting the development version#Windows|development version]].
 +
* Alternatively you can download certain vdrift revisions from gihub/sourceforge web interfaces. For source select a tag and click download https://github.com/VDrift/vdrift and https://github.com/VDrift/vdrift-win. Place vdrift-win into vdrift directory. For data select a tag and download the tarball http://vdrift.svn.sourceforge.net/viewvc/vdrift/tags/. Place data into vdrift directory.
  
====ASIO====
+
== Building with Code::Blocks/MinGW ==
Download the ASIO distribution from this link:
 
  
http://sourceforge.net/project/showfiles.php?group_id=122478&package_id=134200&release_id=665620
+
* Download [http://sourceforge.net/projects/mingw/files/ latest MinGW]. When asked to select components for install, you only need the base system and the g++ compiler.
 +
* Your PATH Environment Variable should contain the MinGW bin path(e.g. C:\MinGW\bin;).
 +
* Download [http://forums.codeblocks.org/index.php/board,20.0.html Code::Blocks nightly]
 +
* Run "vdrift-win\premake4 codeblocks" command line from vdrift directory to generate the solution.
  
Uncompress ASIO, and move asio-1.4.1/include/* to VDrift/tools/win/include
+
== Building with MSVC ==
  
===Install and Configure Build Tools===
+
* Run "vdrift-win\premake4 vs2008" or "vdrift-win\premake4 vs2010" command line from vdrift directory to generate the appropriate solution.
{{note|The versions listed for these tools were the ones used at time of this writing (current stable versions of all packages), there may be new versions. This is a known working configuration.}}
 
  
====MinGW====
+
== Building with Scons(broken) ==
  
* Download [http://downloads.sourceforge.net/mingw/MinGW-5.1.3.exe?modtime=1168811236&big_mirror=1 MinGW 5.1.3] or [http://www.tdragon.net/recentgcc/ TDM's GCC/mingw32]
+
{{note|SCons will prefer the MSVC tools over the MinGW. So if you have Microsoft Visual Studio installed, you might have problems building VDrift with Scons.}}
* Run the installer.
+
* Download [http://sourceforge.net/projects/mingw/files/ latest MinGW]. When asked to select components for install, you only need the base system and the g++ compiler.
* When asked to select components for install, you only need the base system and the g++ compiler.
 
* Choose the default install location.
 
 
* Your PATH Environment Variable should contain the MinGW bin path(e.g. C:\MinGW\bin;).
 
* Your PATH Environment Variable should contain the MinGW bin path(e.g. C:\MinGW\bin;).
 
+
* Download [http://www.python.org/ftp/python/2.6.4/python-2.6.4.msi Python 2.6.4]
====Building with Code::Blocks====
 
 
 
* [http://forums.codeblocks.org/index.php/board,20.0.html Download Code::Blocks nightly]
 
* Open the project file in tools\win\vdrift.cbp and build vdrift.
 
 
 
====Building with Scons====
 
{{note|SCons will prefer the MSVC tools over the MinGW tools. So if you have Microsoft Visual Studio installed, you might have problems building VDrift with Scons.}}
 
* [http://www.python.org/ftp/python/2.6.4/python-2.6.4.msi Download Python 2.6.4]
 
 
* Run the installer and accept all the defaults.
 
* Run the installer and accept all the defaults.
  
* [http://www.scons.org/ Download SCons 1.20]
+
* Download [http://www.scons.org/ SCons 1.20]
 
* Run the installer. It should find your Python installation, accept all defaults.
 
* Run the installer. It should find your Python installation, accept all defaults.
 
* Your PATH Environment Variable should contain the Python and Python scripts paths(e.g. C:\Python26;C:\Python26\Scripts;).
 
* Your PATH Environment Variable should contain the Python and Python scripts paths(e.g. C:\Python26;C:\Python26\Scripts;).
 
=====Building with batch script=====
 
 
* Open a new CMD prompt by choosing START, RUN, cmd, OK.
 
* Open a new CMD prompt by choosing START, RUN, cmd, OK.
 
* Change directories to the spot where you checked VDrift out.
 
* Change directories to the spot where you checked VDrift out.
Line 156: Line 194:
 
  tools/win/bin/build_vdrift.bat
 
  tools/win/bin/build_vdrift.bat
  
=====Building with MSYS=====
+
== Installing VDrift Data ==
 
 
* [http://downloads.sourceforge.net/mingw/MSYS-1.0.10.exe?modtime=1079444447&big_mirror=1 Download MSYS 1.0.10]
 
* Run the installer.
 
* Choose the default install location.
 
* When presented with a terminal asking if you want to continue with the post-install, type '''y''', then press enter.
 
* When asked if MinGW is installed, enter '''C:/MinGW''', then press enter.
 
* The MSYS post install script should find your MinGW installation now and configure itself.
 
 
 
* [http://downloads.sourceforge.net/mingw/msysDTK-1.0.1.exe?modtime=1041430674&big_mirror=1 Download MSYS-DTK 1.01]
 
* Run the installer and accept all the defaults.
 
 
 
* To build VDrift you must use the MSYS terminal to run the build script.
 
* Launch MSYS by clicking '''Start''' -> '''Programs''' -> '''MinGW''' -> '''MSYS''' -> '''msys'''.
 
* Change directories to the spot where you checked VDrift out. If your username is '''Administrator''' and you put it on your Desktop in a directory named '''VDrift''', you would enter this command:
 
cd /c/Documents\ and\ Settings/Administrator/Desktop/VDrift
 
* Now, to build VDrift, run the command:
 
sh tools/win/bin/build_vdrift.sh
 
  
===Run VDrift===
 
 
* Move or copy the VDrift data to a directory named data within the root VDrift directory. This can be done in a few different ways, depending on how you obtained the VDrift data. You could check it out directly here, or you could check it out in another place and use TortoiseSVN to export it to this location. If you downloaded a VDrift data archive you can extract it here, or extract it elsewhere and then move or copy the necessary files to runtime. In the end, just make sure you have a directory structure with paths like '''VDrift/data/cars/''', '''VDrift/data/tracks/''', etc.
 
* Move or copy the VDrift data to a directory named data within the root VDrift directory. This can be done in a few different ways, depending on how you obtained the VDrift data. You could check it out directly here, or you could check it out in another place and use TortoiseSVN to export it to this location. If you downloaded a VDrift data archive you can extract it here, or extract it elsewhere and then move or copy the necessary files to runtime. In the end, just make sure you have a directory structure with paths like '''VDrift/data/cars/''', '''VDrift/data/tracks/''', etc.
* Now, to run VDrift, you just need to double-click on the file '''vdrift.exe''' within the root VDrift directory.
 
  
 
[[Category:Development]]
 
[[Category:Development]]
 
[[Category:Review]]
 
[[Category:Review]]
 +
[[Category:Operating Systems:FreeBSD]]
 
[[Category:Operating Systems:Linux]]
 
[[Category:Operating Systems:Linux]]
[[Category:Operating Systems:FreeBSD]]
+
[[Category:Operating Systems:Mac OS X]]
 
[[Category:Operating Systems:Windows]]
 
[[Category:Operating Systems:Windows]]
[[Category:Operating Systems:Mac OS X]]
 

Revision as of 21:05, 12 December 2011

Compiling VDrift depends upon the build environment beeing set up correctly. See Getting VDrift.

Compiling VDrift makes it possible to Installing VDrift.

Compiling VDrift is different depending on the operating system on which it is compiled. So follow the applicable passage.

Compiling on FreeBSD

To compile VDrift on FreeBSD, use the ports system.

Latest Release

If you downloaded a release, simply run make on the vdrift port:

 cd /usr/ports/games/vdrift && make install clean clean-depends

Development Version

If you Downloaded the development version, copy the vdrift and vdrift-data ports to vdrift-devel and vdrift-data-devel:

 cd /usr/ports/games && cp -rf vdrift vdrift-devel && cp -rf vdrift-data vdrift-data-devel

To compile, run make on the newly-created vdrift-devel port:

 cd /usr/ports/games/vdrift-devel && make install clean clean-depends

Compiling on Linux

Prerequisites

The required build tools include:

  • g++ - The GNU C++ compiler
  • scons - A replacement for Make

The required libraries include:

  • libsdl - Simple Direct Media Layer
  • libglew - OpenGL extension utilities
  • sdl-gfx - Graphics drawing primitives library for SDL
  • sdl-image - Image file loading library for SDL
  • vorbisfile - File loading library for the ogg vorbis format
  • libvorbis - The Vorbis General Audio Compression Codec
  • libbullet - Bullet Physics Library
  • libcurl - the multiprotocol file transfer library
  • libarchive - library for reading and writing archive formats
  • Boost C++ Libraries (header-file-only)
  • ASIO C++ Libraries (header-file-only)

Make sure you have all the required libraries and build tools. Make sure you also have the development files for each of the libraries. Your Linux distribution may have different package names and/or bundled differently. The list above should give enough information to search for applicable packages within your distribution's package manager.

Bullet

For the 2009-02-15 release, the only step required is to expand the Bullet source archive:

tar zxvf bullet-2.73-sp1.tgz
Note: For older versions of VDrift, you will need to follow the Old Method of Compiling Bullet.

Ubuntu does not include a libbullet package, but getdeb does. To add the getdeb-repository to your sources-list.d:

   wget -q -O - http://archive.getdeb.net/getdeb-archive.key | sudo apt-key add - 
   sudo sh -c 'echo "deb http://archive.getdeb.net/ubuntu natty-getdeb games" > /etc/apt/sources.list.d/getdeb.list'
   sudo apt-get update

LibGLEW

Note: VDrift requires libglew version greater than 1.5.3.

Ubuntu 11.04 (Natty Narwhal) does contain libglew1.5, only. To install libglew1.6 and its development headers:

   wget http://archive.ubuntu.com/ubuntu/pool/universe/g/glew/libglew1.6_1.6.0-3_amd64.deb
   sudo dpkg -i libglew1.6_1.6.0-3_amd64.deb
   rm libglew1.6_1.6.0-3_amd64.deb
   
   wget http://archive.ubuntu.com/ubuntu/pool/universe/g/glew/libglew1.6-dev_1.6.0-3_amd64.deb
   sudo dpkg -i libglew1.6-dev_1.6.0-3_amd64.deb
   rm libglew1.6-dev_1.6.0-3_amd64.deb

Ubuntu 8.04

For Ubuntu 8.04 you additionally need:

sudo apt-get install libboost-date-time-dev libboost-regex-dev

SCons

As of the 2005-10-02 release, VDrift no longer uses ./configure, make, etc. (autotools). Now the project is built with SCons. You may want to read a little about Using SCons.

There are two ways to use SCons. The first way is to install scons on your system through your package manager, then you can use it simply by the name of the program, "scons". If you followed the directions for installing prerequisites for Ubuntu above, then you're done and can continue on to the next section. The second way is to use the scons-local package (included with VDrift) which will do the same thing but doesn't require that you install scons on your system. To do this, you must move the scons-local-0.96.95.tar.gz archive from tools to the root vdrift folder, un-tar the archive, and then use the ./scons.py command instead of scons.

All other Packages

All other required packages can be installed using this command:

   sudo apt-get install g++ libarchive-dev libarchive-dev libasio-dev \
                        libboost-dev libcurl4-gnutls-dev libdrm-dev \
                        libgl1-mesa-dev libglu1-mesa-dev libkms1 \
                        mesa-common-dev libsdl-gfx1.2-dev libsdl-image1.2-dev \
                        libsdl-net1.2-dev libvorbis-dev freeglut3 libbullet0 \
                        libbullet-dev scons

Optional: Using scons-local instead of installing SCons

If you have decided not to install SCons on your system, you can use scons-local. To set it up, do the following:

tar zxvf tools/scons-local-0.96.1.tar.gz
Note: Some of the following steps refer to the scons command, you should now replace that with ./scons.py.

Compiling

To compile VDrift, just use the scons command.

scons

Optional: Compile Options

You can use one or more compile options. To compile with optimization for a certain platform, you can use the arch option.

scons arch=a64

Compiling VDrift in release mode will turn off debugging options, and enable more compiler optimizations. VDrift runs much more quickly in release mode.

scons release=1

To enable force feedback, use this option:

scons force_feedback=1

You can get a list of all compile time options with:

scons --help
Note: These options are probably best left off the first time you compile. If you have problems compiling or running VDrift, it is easier to debug with them off. Once you verify that VDrift is compiling, then recompile with these optimizations to improve performance.

Installing

VDrift does not need to be installed to work and you can run it from the folder where you compiled it. If you do want to install, use the SCons build target install. This command must be run as root.

sudo scons install
Note: The scons install process was broken for several releases including the 2009-02-15 release and may fail to install needed datafiles. If you have release 2009-02-15 or earlier, run "sudo scons install" as noted above and then manually re-copy the data files to the installed destination folder:
sudo cp -r data/* /usr/share/games/vdrift/data

Optional: Installation Location

You can change the installation prefix. For example, if you want VDrift to go in /usr/local/share/games/vdrift, you can change the prefix setting.

scons install prefix=/usr/local
Note: There are many more build and install options, see the Using SCons page for more information.

Compiling on Mac OS

Prerequisites

The VDrift Mac OS X project requires Xcode 3.2 or later. The latest version, Xcode 4.1 is free on the Mac App Store.

Get the VDrift source code, either from the latest source release on the VDrift downloads page, or the development version.

Building

Open tools/osx/vdrift.xcodeproj and in Xcode 4 or higher click "Build" in the "Product" menu, otherwise hit "Build" from XCode's "Build" menu.

Error fixing

If when building, you get some errors, it is most likely because the Xcode project is out of date (it often is as we don't have an active Mac OS X developer). To fix it:

  • Remove files from Xcode that are in the project but not in the repository anymore.
  • Add new files to Xcode that are in the repository, but have not yet been added to the project.

Compiling on Windows

Prerequisites

Building with Code::Blocks/MinGW

  • Download latest MinGW. When asked to select components for install, you only need the base system and the g++ compiler.
  • Your PATH Environment Variable should contain the MinGW bin path(e.g. C:\MinGW\bin;).
  • Download Code::Blocks nightly
  • Run "vdrift-win\premake4 codeblocks" command line from vdrift directory to generate the solution.

Building with MSVC

  • Run "vdrift-win\premake4 vs2008" or "vdrift-win\premake4 vs2010" command line from vdrift directory to generate the appropriate solution.

Building with Scons(broken)

Note: SCons will prefer the MSVC tools over the MinGW. So if you have Microsoft Visual Studio installed, you might have problems building VDrift with Scons.
  • Download latest MinGW. When asked to select components for install, you only need the base system and the g++ compiler.
  • Your PATH Environment Variable should contain the MinGW bin path(e.g. C:\MinGW\bin;).
  • Download Python 2.6.4
  • Run the installer and accept all the defaults.
  • Download SCons 1.20
  • Run the installer. It should find your Python installation, accept all defaults.
  • Your PATH Environment Variable should contain the Python and Python scripts paths(e.g. C:\Python26;C:\Python26\Scripts;).
  • Open a new CMD prompt by choosing START, RUN, cmd, OK.
  • Change directories to the spot where you checked VDrift out.
  • Now, to build VDrift, run the command:
tools/win/bin/build_vdrift.bat

Installing VDrift Data

  • Move or copy the VDrift data to a directory named data within the root VDrift directory. This can be done in a few different ways, depending on how you obtained the VDrift data. You could check it out directly here, or you could check it out in another place and use TortoiseSVN to export it to this location. If you downloaded a VDrift data archive you can extract it here, or extract it elsewhere and then move or copy the necessary files to runtime. In the end, just make sure you have a directory structure with paths like VDrift/data/cars/, VDrift/data/tracks/, etc.