Compiling Zandronum with Visual Studio: Difference between revisions
DrinkyBird (talk | contribs) (Created page with "= Prerequisites = == NASM == http://www.nasm.us/ For VC++ 2015, the latest nasm version is required. Currently, this is [http://www.nasm.us/pub/nasm/releasebuilds/2.11.08/nas...") |
DrinkyBird (talk | contribs) m (Sean moved page Compiling Zandronum on Visual Studio to Compiling Zandronum with Visual Studio) |
||
(No difference)
|
Revision as of 15:02, 28 August 2016
Prerequisites
NASM
For VC++ 2015, the latest nasm version is required. Currently, this is Version 2.11.08.
For VC++ 2005, Version 2.00 (no older nor newer) is required.
FMOD Ex
http://www.fmod.org/browse-fmod-ex-api/
- Version 4.24.x is required, version 4.24.16 recommended
- Used for multimedia
- Quick Windows link: http://www.fmod.org/download/fmodex/api/Win/fmodapi42416win32-installer.exe
TortoiseHg
http://tortoisehg.bitbucket.org/download/index.html
Used for downloading the soruce and fetching the Mercurial revision ID when compiling the build.
Windows Platform SDK
http://www.microsoft.com/en-us/download/details.aspx?id=18950
Version 7.0 or older is required. IMPORTANT: If you are on x64, get the GRMSDKX version, the ones without the X will not work.
DirectX SDK
http://www.microsoft.com/en-us/download/details.aspx?id=10084
Version 9.28.1886 Used for compiling the DirectX code within ZDoom.
OpenGL Header Files
- OpenGL 1.2 and above compatibility profile and extension interfaces: glext.h
- WGL Extension interfaces: wglext.h
Note that you may need to put the glext.h and wglext.h into your C:\Program Files\Microsoft SDKs\Windows\v6.1\includes\gl folder. To resolve compiling issues under 'gl_clock.cpp' with _interlockedbittestandset and _interlockedbittestandreset, refer here
OpenSSL
Precompiled versions of OpenSSL for Windows are available from Shining Light Productions. You will want the latest non-light edition of OpenSSL 1.0.2 - the description of the correct package mentions "software developers". You should have a choice between 32-bit and 64-bit versions - you will most likely need the 32-bit version unless you are using CMake and select the 64-bit compiler when generating your build files.
Wait, why do we need this huge library?
The authentication protocol needs OpenSSL for "Big Integer" math, a cryptographically secure random number generator, and the SHA256 hash function.
Building OpenSSL
If the above packages don't work for you for some weird reason, you can try compiling OpenSSL yourself. This is going to be a huge pain in the neck, so be sure that the Shining Light distributions of OpenSSL definitely don't work before you try this.
Perl is necessary to build OpenSSL. If you don't have Perl installed already, install ActiveState Perl.
- NASM executable directory must be in the host system's Environment Variables. Meaning, that NASM must be in the system's $PATH (or %PATH%).
- Download and decompress the latest source of OpenSSL. In the openssl source directory call
perl Configure VC-WIN32 --prefix=c:\Tools\Util\openssl ms\do_nasm
- Replace "c:\Tools\Util\openssl" with the path where you want OpenSSL to be installed. Then, in the same directory, but within a VC++ command prompt, call
nmake -f ms\nt.mak nmake -f ms\nt.mak test nmake -f ms\nt.mak install
NOTE: If an error message 'WinSock32.h does not exist!' is displayed (or the like), you'll need to add these two lines to your console's temporary environment:
SET INCLUDE=%INCLUDE%;c:\Program Files\Microsoft SDKs\Windows\v7.0\Include\
SET LIB=%LIB%;c:\Program Files\Microsoft SDKs\Windows\v7.0\Lib\
Python
https://www.python.org/downloads/
Version 3.5 or newer is required.
Zandronum Source Code
And of course, you will require the Zandronum source code to build Zandronum! You must clone the source with Mercurial to create a build that is compatible with servers.
In the directory where you want to download the source, right-click on empty space, and go to TortoiseHg → Clone
.
Enter https://bitbucket.org/Torr_Samaho/zandronum
as the source.
If you want to clone a specific revision, expand Options, check Clone to revision, and enter the revision you want to clone.
For example, if you wanted to download Zandronum 2.1.2's source, you'd enter ZA_2.1.2
.
Optional prerequisites
Logitech G-Series LCD SDK
Only available with the keyboard drivers from Logitech hardware.
Using Visual Studio 2005 - 2015
Prerequisites
Visual Studio
You will require Visual Studio to compile Zandronum. In this guide, Visual Studio 2013 will be used, however it is recommended Visual Studio 2015 is used instead (the instructions are the same).
CMake
Download the latest version of CMake from cmake.org. We will use this to generate the projects.
Generate Projects
Open CMake (cmake-gui
) and set the Where is the source code textbox to where you downloaded the Zandronum source code. Set Where to build the binaries to wherever you want the project files to be generated.
Click Configure and select what you want to generate projects for.
If it says there was an error, ignore it as we will solve it now. Make sure you set up all prerequisites correctly, and point CMake to the location of any missing paths.
Then click Configure again, and point CMake to missing paths.
LIB_EAY
and SSL_EAY
are OpenSSL libraries.
YASM is unneeded as we already have NASM.
Click Configure again and your CMake should look like the image on the left. Now click Generate. This will generate the project files.
Build Zandronum
Now go to where you generated the project files and open Zandronum.sln
.
At the top, there will be a Build menu. Click it and click Build Solution.
Now wait for Zandronum to build. It is a large project and will take time to build.
If you encounter an error, see Troubleshooting below.
Once successfully compiled, zandronum.exe
will be in the Debug
folder in the project directory.
zandronum.pk3
will be in the project directory.
Using Visual Studio 2005
Prerequisites
Microsoft Visual Studio C++ 2005 Express Edition
Download: http://go.microsoft.com/fwlink/?linkid=57034
Version 2005 is recommended, including the necessary updates. The easiest way to install is to extract the VC.iso file using 7-zip to a directory and run setup.exe.
On Windows Vista and older:
- VS C++ 2005 (Express Editions) - Service Pack 1
- VS 2005 Service Pack 1 Update for Windows 6 Foundation(Vista/Windows7/etc.)
It is possible to compile the project using more recent versions of Visual Studio, but these binaries may not be compatible with older Windows systems.
SQLite
Download the ZIP archive containing the amalgamation of SQLite version 3.8.10.1 here, extract the files sqlite3.c
, sqlite3.h
and sqlite3ext.h
from the archive and put them into the sqlite directory of the Zandronum source.
Configuring Visual Studio
In order to compile the Zandronum project, we must first include several items of dependencies. Go to VC++ Directories settings, and do the following:
Executable Files
Add the following executables:
NASM
- Typically the same location that the archive file was extracted from. For example: C:\NASM\
Includes
Add the following to the Includes:
$(DXSDK_DIR)Include
- This is the DirectX SDK. The code above translates to an Environment Variable.
FMOD Ex
- FMOD Ex can typically be located at:
C:\Program Files\FMOD SoundSystem\FMOD Programmers API Win32\api\inc\
OpenGL Header files
- This can be located at any directory placed.
OpenSSL
- Within the OpenSSL directory (where the contents were extracted and installed), the 'include' directory will be needed.
- Example:
C:\OpenSSL\Include
- Example:
Library Files
Add the following to the 'Library' list:
$(DXSDK_DIR)Lib\x86
- This, again, is the DirectX SDK environment variable with a location directory included.
FMOD Ex Library
- This is typically located at:
C:\Program Files\FMOD SoundSystem\FMOD Programmers API Win32\api\lib
Logitech LCD SDK
- This is typically located in archive file (if G15 drivers installed):
C:\Program Files\Logitech Gaming Software\LCDSDK\LCDSDK_(VERSION).zip
- If installed without the drivers, place the correct path to 'lglcd.lib' in the path.
OpenSSL
- Within the OpenSSL directory (where the contents were extracted and installed), the 'lib' directory will be needed.
- Example:
C:\OpenSSL\lib
- Example:
Compiling the Project
Before you compile the project make sure you do not have Debug DLL selected near the top middle of the main screen of Visual C++ 2005. It should be set to Release. This is in a dropdown menu most likely beneath the 'Community' and 'Windows' tab at the top.
To compile the project, go to: Build and then Build Solution
Troubleshooting
Cannot find Windows.h or WinSock2.h (and probably many more errors)
Sometimes upon installation of the SDK, it will not properly update the path that VC 2005+ automatically comes with. Therefore you have to manually add the fix in your VC++ Directories under "Includes" by manually adding the path to the Windows include folder. This is an example of what you may have to add to fix the problem:
C:\Program Files\Microsoft SDKs\Windows\v7.0\Include
Cannot find gdi32.lib (or [name].lib)
Like the above, sometimes upon installation of the SDK... it will not properly update the path that VC 2005+ automatically comes with. Therefore you have to manually add the fix in your VC++ Directories under "Libraries" by manually adding the path to the Windows library folder.
This is an example of what you may have to add to fix the problem:
C:\Program Files\Microsoft SDKs\Windows\v7.0\Lib
OpenGL (_interlockedbittestandset) Issue
You will want to comment out the lines at intrin.h, it's location can be found most likely at this location:
C:\Program Files\Microsoft Visual Studio 8\VC\include
The code would look as follows (add the slashes before to fix the problem):
... //__MACHINEI(unsigned char _interlockedbittestandset(long *a, long b)) //__MACHINEI(unsigned char _interlockedbittestandreset(long *a, long b)) ...
Cannot find GL/glext.h
That means you have to place your GL files in your SDK directory like so:
C:\Program Files\Microsoft SDKs\Windows\v7.0\Include\gl
'Cr0NpxState' : is not a member of _FLOATING_SAVE_AREA
Just comment out the line that calls this, according to zdoom devs, it is only there to give info and doesn't actually affect the project.
error LNK1281: Unable to generate SAFESEH image
When using VC++ 2015, update to the latest nasm version.
Set `/SAFESEH:NO` by going into the properties of the `zdoom` project and navigating to Configuration Properties → Linker → Advanced
and changing Image Has Safe Exception Handlers
to No (/SAFESEH:NO)
.