Before we build PvPGN from source on Windows make sure you have the following tools installed . Git and cmake should also be in your system PATH.
- Visual Studio 2010 (or any other version you like)
- mysql C connector (if you want to use some other database backend feel free to)
1. Building zlib Edit
1. Download and unpack the zlib source from the link above. For the sake of simplicity, let's unpack to
2. Now open cmd, cd to the zlib directory and run
cmake -G "Visual Studio 10"
3. Cmake should now generate zlib.sln. Open it with Visual Studio and change the build configuration to Release. Then right click on project
zlib->Project only->Build only zlib
4. The libraries (zlib.lib and zlib.dll) will be built in C:/zlib/Release. Remember this for the time being.
2. Getting PvPGN source Edit
1. Open cmd or Git bash and change directory to where you would like to have the PvPGN source code, ex:
2. Now let's clone the git repository:
git clone https://github.com/d1zzy/pvpgn.git pvpgn
3. Go to C:/pvpgn/pvpgn and create new folder called zlib
4. Copy both zlib libraries from C:/zlib/Release into this folder
5. Also copy zlib.h and zconf.h from C:/zlib into this new folder
3. Configuring Cmake Edit
1. Open C:/pvpgn/pvpgn/cmake/Modules/FindMySQL.cmake. We need to edit the INCLUDE and LIB paths a little bit so cmake can find the mysql headers and libs.
Under MYSQL_INCLUDE_DIR add your mysql include directory which contains mysql.h. It will be something like
"C:\\Program Files (x86)\\MySQL\\MySQL Connector C 6.1\\include"
do not forget double backslash and quotes! reh
Do the same for MYSQL_SEARCH_LIB_PATHS. This is the path that contains libmysql.lib. It should be something like
"C:\\Program Files (x86)\\MySQL\\MySQL Connector C 6.1\lib"
2. Now open C:/pvpgn/pvpgn/CmakeLists.cmake and turn ON the MySQL support:
option(WITH_MYSQL "include MySQL user accounts support" ON)
You can also disable the GUI if you want to run bnetd from console.
3. In c:/pvpgn/pvpgn run
cmake -G "Visual Studio 10"
4. Cmake should now generate pvpgn.sln. If it complains about not finding ZLIB or MySQL then you have made a mistake in some previous step of the tutorial.
4. Building PvPGN Edit
1. Open pvpgn.sln, Build->Configuration Manager->Tick all projects for building, including INSTALL. Then Build solution for Release.
Possible error when compiling bnetd project: If you get a ZLIB linker error in anongames_infos.obj when compiling bnetd project, open bnetd->anongames_info.cpp and comment the line 32: # define ZLIB_WINAPI
So it should look like this:
Zlib library is by default built with C calling convention but ZLIB_WINAPI changes that to std calling convention (Windows default). There is no easy way to build ZLIB with stdcall so we will simply not use the ZLIB_WINAPI flag.
2.Download PvPGN Support files 1.2 from http://pvpgn.berlios.de/index.php?page=files
3. Extract them into C:/Program Files (x86)/pvpgn/var/files
4. Your executable is in C:/Program Files (x86)/pvpgn/sbin/bnetd.exe. You might have to copy zlib.dll and libmysql.dll into the same folder before starting the server. If you want to avoid that you should build and link zlib and mysql libraries statically but this is beyond the scope of this tutorial.
Before starting the server you have to configure a few settings first. Read the configuration and setup guides on this wiki to learn about that.