This wiki was in read-only mode for many years, but can now be edited again. A lot of information will need to be updated.

Compiling: Difference between revisions

From BZFlagWiki
Jump to navigation Jump to search
tobylane - from help from irc right now and experience.
Zehra (talk | contribs)
we got official documentation covering it
 
(34 intermediate revisions by 11 users not shown)
Line 1: Line 1:
==Overview==
BZFlag is well supported on 3 major operating systems. (Please consult with other platform specific readme's, if available, otherwise consult general build instructions.)
Compiling BZFlag is the act of taking the raw source codes for the game and using tools to build an executable application(s) for a target system.


==Source Code==
{|{{Prettytable}}
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_SVN]] server.
|-
| {{Hl3}} |'''Operating System:'''
|-
| [https://www.bzflag.org/documentation/developer/compiling/windows/ Windows]
|-
| [https://www.bzflag.org/documentation/developer/compiling/linux/ Linux]
|-
| [https://www.bzflag.org/documentation/developer/compiling/macos/ macOS]
|-
|}


==Readme Files==
=Compiling Misc:=
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.
==Simple plugin compiling==
Simple bash script which can sometimes simplify writing very basic plugins.


==Compilers==
'''plugin.sh'''
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.
#!/bin/bash
compiler="g++"
options="-I "
headers="/path/to/bzflag/include"
options2="-fPIC -shared -o"
$compiler $options $headers $options2 $1.so $1.cpp
Compile a plugin with:
./plugin.sh myPlugin.cpp


Linux computers, use the GCC compiler.
==Simple [[Modeltool|modeltool]] compiling==
Macintosh Computers use the XCode compiler
This usual covers building modeltool on recent releases:
Windows Computers can use the Visual C++ compiler, or the MinGW compiler (based on GCC)
g++ -o modeltool modeltool.cxx -include SimpleTextUtils.h model.h wavefrontOBJ.h Q3BSP.h Q3BSP.cxx wavefrontOBJ.cxx SimpleTextUtils.cxx
 
===GCC===
The GCC build as a number of requirements;
* Automake X.XX
* Autoconf X.XX
* Autotools X.XX
* SDL Development libraries 1.2.10 or greater (2.99 + from svn requires SDL 1.3 which is also only in SVN, make and make install SDL, then install BZflag again from ./autogen.sh.)
* OpenGL Development libraries 1.1 or greater
 
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 Mac you can either run make to find any problems, or xcodebuild (after ./configure) to make an .app that is useable.
 
===XCode===
Launch XCode and open the '''bzflag/BZFlag.xcodeproj''' project. Note that XCode should have '''BZFlag''' selected as the active target and '''Development''' as the active build configuration. Click on '''Targets''' then click the '''Build''' icon. When this process completes, your application will be in '''bzflag/build/Development'''. You can then move it wherever you like.
 
===Visual C++===
 
==== 2.0.x ====
 
'''Compiler'''<br>
In order to compile, you need to have Visual C++ 2003 or higher (Express version works just fine).<br>
To get the latest Express version of Visual C++, visit [http://www.microsoft.com/express/vc/ http://www.microsoft.com/express/vc/]<br>
 
'''Dependencies'''
 
In order to compile you need '''ALL''' of the following:<br>
[http://www.microsoft.com/downloads/details.aspx?FamilyID=86cf7fa2-e953-475c-abde-f016e4f7b61a&DisplayLang=en Microsoft DirectX SDK April 2007] (Only the Headers and Libraries)<br>
[http://www.microsoft.com/downloads/details.aspx?familyid=A55B6B43-E24F-4EA3-A93E-40C0EC4F68E5&displaylang=en Windows Platform SDK] (This is not required for Visual C++ 2008) <br>
[http://curl.haxx.se/download/libcurl-7.18.0-win32-msvc.zip LibCURL]<br>
[http://sourceforge.net/project/downloading.php?group_id=67586&use_mirror=superb-east&filename=glew-1.5.1-win32.zip&1970168 GLEW] <br>
[http://sourceforge.net/project/downloading.php?group_id=30480&use_mirror=superb-west&filename=pdc34dll.zip&38017788 PDCurses] <br>
 
You then need to add them to your VC++ Directories, both include and lib folders.
 
==== 2.99.x =====
 
'''Compiler'''<br>
In order to compile, you need to have Visual C++ 2008 or higher (Express version works just fine).<br>
To get the latest Express version of Visual C++, visit [http://www.microsoft.com/express/vc/ http://www.microsoft.com/express/vc/]<br>
 
'''Dependencies'''<br>
 
[http://www.microsoft.com/downloads/details.aspx?FamilyId=5493F76A-6D37-478D-BA17-28B1CCA4865A&displaylang=en Microsoft DirectX SDK November 2008]<br>
[http://sourceforge.net/project/downloading.php?group_id=30480&use_mirror=superb-west&filename=pdc34dll.zip&38017788 PDCurses] <br>
 
You then need to add them to your VC++ Directories, both include and lib folders.
 
===Other build systems===
Other build systems may be supported in the various readme files (minGW, IRIX, SOLARIS,etc..)





Latest revision as of 02:07, 10 November 2025

BZFlag is well supported on 3 major operating systems. (Please consult with other platform specific readme's, if available, otherwise consult general build instructions.)

Operating System:
Windows
Linux
macOS

Compiling Misc:

Simple plugin compiling

Simple bash script which can sometimes simplify writing very basic plugins.

plugin.sh

#!/bin/bash
compiler="g++"
options="-I "
headers="/path/to/bzflag/include"
options2="-fPIC -shared -o"
$compiler $options $headers $options2 $1.so $1.cpp

Compile a plugin with:

./plugin.sh myPlugin.cpp

Simple modeltool compiling

This usual covers building modeltool on recent releases:

g++ -o modeltool modeltool.cxx -include SimpleTextUtils.h model.h wavefrontOBJ.h Q3BSP.h Q3BSP.cxx wavefrontOBJ.cxx SimpleTextUtils.cxx