Difference between revisions of "Compiling VDrift"

From VDrift
Jump to: navigation, search
(Moved to Compiling)
 
(61 intermediate revisions by 3 users not shown)
Line 1: Line 1:
Compiling VDrift is different depending on the operating system on which it is compiled.
+
#REDIRECT [[Compiling]]
 
 
==Linux==
 
===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.
 
 
 
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
 
* sdl-net - Low-level network library for SDL
 
* vorbisfile - File loading library for the ogg vorbis format
 
* libvorbis-dev - The Vorbis General Audio Compression Codec
 
* libtool - A generic library support script
 
* freeglut3-dev - OpenGL Utility Toolkit development files
 
 
 
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 the packages required are:
 
libsdl-gfx1.2
 
libsdl-gfx1.2-dev
 
libsdl-image1.2
 
libsdl-image1.2-dev
 
libsdl-net1.2
 
libsdl-net1.2-dev
 
libtool
 
libvorbisfile3
 
bjam
 
jam
 
ftjam
 
libvorbis-dev
 
libglew-dev
 
freeglut3-dev
 
 
 
====Bullet====
 
As of SVN R2321 on 2/1/2009, bullet source is now built by the normal VDrift build method.  The only step required is to un-tar the bullet source files (replace the X with whatever bullet version is included with the VDrift source distribution):
 
* tar zxvf bullet-X.tgz
 
Directions for building bullet for older VDrift versions is shown below.  You can skip this.
 
 
 
====Bullet (old directions)====
 
The Bullet physics library is required to be built on versions of VDrift prior to SVN R2321 and with releases up to and including the 8/5/08 release.  A preferred version of the library is included with the VDrift source distribution as a .tgz file.
 
On linux, bullet can be compiled like this (replace the X with whatever bullet version is included with the VDrift source distribution):
 
* tar zxvf bullet-X.tgz
 
* cd bullet-X
 
Then, proceed as below using either jam or cmake as your build tool:
 
=====Using Jam=====
 
* ./autogen.sh
 
* ./configure
 
* jam bulletcollision bulletmath
 
=====Using CMake=====
 
* cmake .
 
* make
 
=====Using autotools=====
 
* ./autogen.sh
 
* ./configure
 
* make
 
 
 
These steps should put the bullet libraries into a spot in the bullet-X tree that the VDrift build files are expecting.
 
 
 
{{note|It is not necessary to install the bullet library on your system.  In fact, installed versions of bullet may conflict with the version included with VDrift.}}
 
 
 
====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". 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===
 
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 2005-10-02.
 
 
 
Unpack the archive.
 
 
 
tar jxvf vdrift-2005-10-02-src.tar.bz2
 
 
 
=====Data=====
 
You must choose a data package to install, as the source package does not come with any data (not even the minimal set). Make sure to get a data set that is in a tarball (.tar.gz file) and not one of the other kinds of packages available for download on the [http://sourceforge.net/project/showfiles.php?group_id=137283 VDrift downloads page]. The filename will be something like "vdrift-VERSION-data-full.tar.bz2" (full data set - all cars and tracks) or "vdrift-VERSION-data-minimal.tar.bz2" (minimal data set - small download size).
 
 
 
Before you can install VDrift, you must unpack the data so that it's in the source directory. If you downloaded the correct package, the data can be unpacked in the same place that the source package was unpacked.
 
 
 
tar jxvf vdrift-2005-10-02-data-full.tar.bz2
 
 
 
=====Enter directory=====
 
Now change directories into the location of your newly created VDrift source tree.
 
cd vdrift-2005-10-02-src
 
 
 
====Development version====
 
You can [[Getting the development version#Linux.2FUnix|check out the development version]] of VDrift from our Subversion repository.
 
 
 
Once you've checked out the code, enter the directory Subversion created.
 
cd vdrift
 
 
 
====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 <code>scons</code> command, you should now replace that with <code>./scons.py</code>.}}
 
 
 
===Compiling===
 
To compile VDrift, just use the <code>scons</code> command.
 
scons
 
 
 
====Options====
 
You may need to 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
 
{{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 add these 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.
 
scons install
 
{{note|The <code>scons install</code> process hasn't been maintained for several releases and may fail to install needed datafiles.  If scons install doesn't result in a working installation, manually re-copy the data files to the installed destination folder.}}
 
 
 
====Installation Options====
 
You can change the installation prefix. By default, VDrift is installed to <code>/usr/share/games/vdrift</code>, but if you wanted it to go in <code>/usr/local/share/games/vdrift</code>, 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.}}
 
 
 
==Mac OS X==
 
===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]].
 
 
 
===Build===
 
Finally open ''tools/osx/vdrift.xcodeproj'' and hit "Build" from XCode's "Build" menu.
 
 
 
==Windows==
 
In order to build VDrift for Windows, you must set up the tools to build the software, build Bullet and VDrift, and then install VDrift into a runtime folder.
 
 
 
===Install and Configure Build Tools===
 
To build VDrift on Windows you'll need working installations of [http://www.mingw.org/ MinGW], [http://www.mingw.org/msys.shtml MSYS and MSYS-DTK], [http://www.python.org/ Python], and [http://www.scons.org/ SCons].
 
{{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====
 
* [http://downloads.sourceforge.net/mingw/MinGW-5.1.3.exe?modtime=1168811236&big_mirror=1 Download MinGW 5.1.3]
 
* Run the installer.
 
* When asked to select components for install, you only need the base system and the g++ compiler.
 
* Choose the default install location.
 
====MSYS====
 
* [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.
 
====MSYS DTK====
 
* [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.
 
====Python====
 
* [http://www.python.org/ftp/python/2.5.1/python-2.5.1.msi Download Python 2.5.1]
 
* Run the installer and accept all the defaults.
 
====SCons====
 
* [http://www.scons.org/ SCons 0.97]
 
* Run the installer. It should find your Python installation, accept all defaults.
 
 
 
===Download VDrift Source and Data===
 
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]].
 
 
 
{{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.}}
 
 
 
===Building===
 
To build VDrift you must use the MSYS terminal, compile the Bullet library, and compile VDrift itself.
 
* 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 there is a handy script that sets up the VDrift/Bullet development environment for you. Once you have changed directories to the place where you checked out VDrift, run this:
 
sh tools/win/setup-win32-dev-environment.sh
 
{{note|This only needs to be run once, the first time you set up VDrift. The only case where it may need to be run again is if the script itself is updated, or the build scripts are updated.}}
 
* Now everything is ready to go, and will be every time you start up MSYS from now on.
 
{{note|If the build_bullet.sh and/or build_vdrift.sh scripts fail immediately after running the setup script for the first time, try restarting MSYS.}}
 
====Bullet====
 
* To build Bullet, simply run the command:
 
build_bullet.sh
 
{{note|This may take a while, and you may see many errors. Ignore them...}}
 
{{note|Bullet only needs to be compiled once, or whenever Bullet is updated in the VDrift sources. In this case, the setup script will be updated and you should run it again before running build_bullet.sh again.}}
 
====VDrift====
 
* Now, to build VDrift, run the command:
 
build_vdrift.sh
 
 
 
===Run VDrift===
 
* Copy build/vdrift.exe, and all the necessary libraries to the root VDrift directory.
 
cp build/vdrift.exe tools/win/dll/*.dll tools/win/dll/*.a "$VDRIFT_DIR"
 
* 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.
 
===Running===
 
Now, to run VDrift, you just need to double-click on the file '''vdrift.exe''' within the root VDrift directory.
 

Latest revision as of 12:52, 26 August 2012

Redirect to: