BNBT:Documentation:Compiling

From Depthstrike Entertainment
Jump to: navigation, search

Compiling

Compiling on Windows

If you want to run BNBT 'as is' without making any changes to the source code, then you don't need to compile anything; precompiled binaries have been provided for you (BNBT.exe and BNBTMySQL.exe). If you want to make changes to the source code, you will need a compiler such as Microsoft Visual C++ .NET (recommended) or MinGW (which comes with Dev-C++, an excellent IDE). You will also need zlib 1.2.1 or newer and if you wish to compile a binary with MySQL support you will also need MySQL 4.0 or newer.

Step 1 (install zlib)

To install zlib, simply download zlib 1.2.1 or newer, compiled DLL distribution and extract it to any folder (for example, C:\zlib - I will call this zlibdir). You will add this folder to your compiler's search paths later.

Step 2 (install MySQL)

You only need to install MySQL if you wish to compile a binary with MySQL support. To install MySQL, simply download MySQL 4.0 or newer, Windows distribution and extract it to any folder (for example, C:\MySQL - I will call this mysqldir). You will add this folder to your compiler's search paths later.

Visual

Visual Studio/C++ .Net 2002/2003

Microsoft Visual C++ .NET is the recommended compiler for BNBT (the precompiled binaries were compiled with Microsoft Visual C++ .NET). If you haven't already setup your search paths, you should do so now,

Step 3 for MSVC++ .NET (setup include search paths)

Click on the 'Tools' menu and select the 'Options' item. Click on the 'Projects' folder and select the 'VC++ Directories' item. Choose 'Include files' from the dropdown menu and click the 'New Line' icon (it looks like a folder) or double click on the first empty line. Type zlibdir\include (where zlibdir is the folder referenced in step 1) and press enter. If you wish to compile a binary with MySQL support, add another line and type mysqldir\include (where mysqldir is the folder referenced in step 2) and press enter.

http://bnbt.depthstrike.com/doc/include_paths_windows.png

Step 4 for MSVC++ .NET (setup library search paths)

Click on the 'Tools' menu and select the 'Options' item. Click on the 'Projects' folder and select the 'VC++ Directories' item. Choose 'Library files' from the dropdown menu and click the 'New Line' icon (it looks like a folder) or double click on the first empty line. Type zlibdir\lib (where zlibdir is the folder referenced in step 1) and press enter. If you wish to compile a binary with MySQL support, add another line and type mysqldir\lib\opt (where mysqldir is the folder referenced in step 2) and press enter.

http://bnbt.depthstrike.com/doc/library_paths_windows.png

Step 5 for MSVC++ .NET (compile)

To compile BNBT, simply open the BNBT.sln solution file in the bnbtdir\src folder (where bnbtdir is the folder you extracted BNBT to). If you wish to compile a release binary, make sure the 'Release' target is selected as shown below. If you wish to compile a debug binary, make sure the 'Debug' target is selected. If you wish to compile a binary with MySQL support, select the desired MySQL target.

http://bnbt.depthstrike.com/doc/release.png

Once you've selected a target, click on the 'Build Solution' button or click on the 'Build' menu and select the 'Build Solution' item. Microsoft Visual C++ .NET will compile a BNBT.exe or BNBTMySQL.exe binary in the bnbtdir\src folder.

Dev

Dev C++

Currently no documentation, since the Dev C++ project file has become obsolete.

Compiling on Others

BNBT should compile on Linux, Unix, OS X, BSD, Sun Solaris, and possibly other systems. You will need a compiler such as GCC (most systems should already have this) and a GNU compatible make such as GNU Make (most systems should already have this). You will also need zlib 1.2.1 or newer and if you wish to compile a binary with MySQL support you will also need MySQL 4.0 or newer. If you are compiling BNBT with an old version of GCC (older than version 3) you will also need STLport.

Step 1 (install zlib): If you already have zlib 1.2.1 or newer, skip this step. To install zlib, simply download zlib 1.2.1 or newer, source distribution and extract it to any folder (for example, ~/zlib - I will call this zlibdir).

  • If you have root access you should install zlib as a shared library for the system. Change to zlibdir and type ./configure --shared --prefix=/usr then type make install (on BSD systems, type gmake install).
  • If you don't have root access you should install zlib as a static library for BNBT only. Change to zlibdir and type make (on BSD systems, type gmake) then copy libz.a to bnbtdir/src (where bnbtdir is the directory you extracted BNBT to).

Step 2 (install MySQL): If you already have MySQL 4.0 or newer, skip this step. You only need to install MySQL if you wish to compile a binary with MySQL support. To install MySQL, go to http://www.mysql.org/ and follow the instructions. You don't need to install the source distribution (the binary distribution or the RPM distribution should work fine).

Step 3 (Sun Solaris users only): If you are running Sun Solaris and your system is little endian (e.g. Intel) you should remove the indicated lines near the top of bnbt.h and sha1.h.

Step 4 (install STLport): If you are compiling BNBT with GCC version 3 or newer (check with g++ --version), skip this step. To install STLport, go to http://www.stlport.org/ and follow the instructions. TODO - MAKEFILE INSTRUCTIONS.

Step 5 (compile): If you wish to compile a release binary, simply change to the bnbtdir/src directory and type make bnbt (on BSD systems, type gmake bnbt). If you wish to compile a release binary with MySQL support, simply change to the bnbtdir/src directory and type make bnbtmysql (on BSD systems, type gmake bnbtmysql). A bnbt or bnbtmysql binary will be compiled in the bnbtdir/src directory. If you wish to remove all files created during compilation, type make clean (on BSD systems, type gmake clean).