This wiki is archived and useful information is being migrated to the main bzflag.org website

Difference between revisions of "Compiling"

From BZFlagWiki
Jump to: navigation, search
(Visual C++: remove extra use of the word "compiler")
m (Obtaining sources: fixed links)
 
(4 intermediate revisions by 4 users not shown)
Line 1: Line 1:
 
==Overview==
 
==Overview==
Compiling BZFlag is the act of building executable applications for a target system using the raw source code. This is usually not necessary to [[Installing|install the game]].
+
Compiling BZFlag is the act of building executable applications for a target system using the raw source code..
  
 
==Obtaining sources==
 
==Obtaining sources==
In order to compile a user must have his or her own copy of the [[BZFlag_Source|Source Code]]. The code can be obtained from a source archive from the [[Download]] page, or from the BZFlag [[BZFlag_SVN|Subversion]] server.
+
In order to compile a user must have his or her own copy of the [[BZFlag Source|Source Code]]. The code can be obtained from a source archive from the [http://bzflag.org/downloads download] page, or from [[BZFlag Git|Git]].
  
 
==README files==
 
==README files==
Line 12: Line 12:
  
 
* Windows computers can use the Visual C++ compiler, or the MinGW compiler (based on GCC). Windows is the most popular client OS and nearly all clients are built with the Visual C++ compiler, including the official binaries.
 
* Windows computers can use the Visual C++ compiler, or the MinGW compiler (based on GCC). Windows is the most popular client OS and nearly all clients are built with the Visual C++ compiler, including the official binaries.
* Macintosh OSX computers use the XCode compiler (or optionally gcc, see notes). OSX is the second most popular client OS, official builds are built with Xcode, not GCC.
+
* Macintosh OS X computers use the Xcode compiler (or optionally gcc, see notes). OS X is the second most popular client OS, official builds are built with Xcode, not GCC.
 
* Linux and BSD computers use the GCC compiler. Linux is the third most common client OS and packages for distributions are built using GCC.
 
* Linux and BSD computers use the GCC compiler. Linux is the third most common client OS and packages for distributions are built using GCC.
 
  
 
===Visual C++===
 
===Visual C++===
Line 28: Line 27:
 
   make install
 
   make install
  
Please note that depending on permissions levels the '''make install''' command may need to be run as an administrator or root.
+
Please note that depending on permissions levels the '''make install''' command may need to be run as an administrator or root. On Macintosh OS X, do not run make install when building with GCC. Run the program from the source directory or install it manually as desired instead.
On Macintosh OSX the user can either run make to find any problems, or xcodebuild (after ./configure) to make an .app that is useable.
+
  
===XCode===
+
===Xcode===
The XCode system uses the  '''bzflag/BZFlag.xcodeproj''' project.  
+
The Xcode system uses the  '''Xcode/BZFlag.xcodeproj''' project. Building is fairly straightforward. Follow the instructions in the README.MacOSX file.
Steps to build;
+
 
+
* Select'''BZFlag''' as the active target.
+
* Select '''Development''' as the active build configuration.
+
* Click on '''Targets''' then click the '''Build''' icon.
+
 
+
When this process is complete, the  application will be in '''bzflag/build/Development'''. The application can be run from any location.
+
 
+
====Building on Snow Leopard====
+
Snow Leopard defaults to 64-bit binaries, which isn't compatible with MacDisplay.cxx due to Carbon.framework not implementing a lot of functionality in 64-bit mode.  To compile on Snow Leopard, the build must be 32-bit.
+
  
 
==Dependencies==
 
==Dependencies==
Line 67: Line 55:
 
* mesa development libraries
 
* mesa development libraries
  
====Required Libraries====
+
====Optional Libraries====
 
These libraries are included with the source tree but users may have better results using ones included with a Linux distribution.
 
These libraries are included with the source tree but users may have better results using ones included with a Linux distribution.
  
Line 75: Line 63:
 
* zlib development libraries
 
* zlib development libraries
  
===Macintosh OSX (XCode or GCC)===
+
===Macintosh OS X (Xcode or GCC)===
 
====Required Libraries====
 
====Required Libraries====
 
* SDL framework 1.2 (1.3 may not work on all versions of OSX)
 
* SDL framework 1.2 (1.3 may not work on all versions of OSX)
  
 
==Other build systems==
 
==Other build systems==
Other build systems may be supported in the various readme files (minGW, IRIX, SOLARIS,etc..) see[[Solaris_Notes]] for more info.
+
Other build systems may be supported in the various readme files (minGW, IRIX, SOLARIS,etc..) see the [[Compiling/Solaris_Notes]] page for more info.
  
 
[[Category:Development]]
 
[[Category:Development]]
 
[[Category:Compiling]]
 
[[Category:Compiling]]
 
[[Category:Tutorials]]
 
[[Category:Tutorials]]

Latest revision as of 01:44, 22 November 2016

Overview[edit]

Compiling BZFlag is the act of building executable applications for a target system using the raw source code..

Obtaining sources[edit]

In order to compile a user must have his or her own copy of the Source Code. The code can be obtained from a source archive from the download page, or from Git.

README files[edit]

Users should always read the README files for the appropriate operating system. These files are located in the root directory of the source code tree.

Compilers[edit]

BZFlag is capable of being built on a number of compilers. The compiler used will depend in some way on the operating system of the computer doing the build.

  • Windows computers can use the Visual C++ compiler, or the MinGW compiler (based on GCC). Windows is the most popular client OS and nearly all clients are built with the Visual C++ compiler, including the official binaries.
  • Macintosh OS X computers use the Xcode compiler (or optionally gcc, see notes). OS X is the second most popular client OS, official builds are built with Xcode, not GCC.
  • Linux and BSD computers use the GCC compiler. Linux is the third most common client OS and packages for distributions are built using GCC.

Visual C++[edit]

The most common way to build on windows to to use the Visual C++ 2010 compiler (Both Express and Retail versions are supported). The current free Express version of Visual C++ can be found at http://www.microsoft.com/express/vc/

GCC[edit]

If the required dependencies are installed, the user must then run the following commands from at root level of the source tree

 ./autogen.sh
 ./configure
 make
 make install

Please note that depending on permissions levels the make install command may need to be run as an administrator or root. On Macintosh OS X, do not run make install when building with GCC. Run the program from the source directory or install it manually as desired instead.

Xcode[edit]

The Xcode system uses the Xcode/BZFlag.xcodeproj project. Building is fairly straightforward. Follow the instructions in the README.MacOSX file.

Dependencies[edit]

In order to compile BZFlag, some third party libraries may be required depending on the operating system being built for. The readme file for each OS will contain the current dependencies for each OS and should be consulted before attempting any build.

The following is a general dependency list for version 2.4.

Windows (Visual Studio)[edit]

The only third party dependency required to build the client is the DirectX SDK that is available from Microsoft. A download is available at http://www.microsoft.com/en-us/download/details.aspx?id=6812.

If a user wishes to build a full set of windows installers, they will need to install the NSIS installer system, available from http://nsis.sourceforge.net.

All other dependencies are included.

Linux (GCC)[edit]

Required Libraries[edit]

  • SDL development libraries (1.2.10 or greater)
  • SDL-sound development libraries (1.2.10 or greater)
  • libtool
  • automake
  • autoconf
  • g++
  • mesa development libraries (gl, and glu)
  • mesa development libraries

Optional Libraries[edit]

These libraries are included with the source tree but users may have better results using ones included with a Linux distribution.

  • curl development libraries
  • c-ares development libraries
  • glew development libraries
  • zlib development libraries

Macintosh OS X (Xcode or GCC)[edit]

Required Libraries[edit]

  • SDL framework 1.2 (1.3 may not work on all versions of OSX)

Other build systems[edit]

Other build systems may be supported in the various readme files (minGW, IRIX, SOLARIS,etc..) see the Compiling/Solaris_Notes page for more info.