Compiling Zandronum with Visual Studio: Difference between revisions

Rename thg section to just Mercurial; point to mercurial-scm.org as it tends to be more up to date than the thg site
No edit summary
(Rename thg section to just Mercurial; point to mercurial-scm.org as it tends to be more up to date than the thg site)
Tag: Source edit
 
(20 intermediate revisions by 2 users not shown)
Line 1: Line 1:
= Prerequisites =
= Prerequisites =
== Visual Studio ==
== Visual Studio ==
You will require Visual Studio to compile Zandronum.
Zandronum requires the Visual Studio 2015 toolchain to be built. Microsoft no longer offers 2015 for (easy) download, but forunately, modern versions of Visual Studio can use older toolchains.
In this guide, Visual Studio 2013 will be used, however it is recommended Visual Studio 2015 is used instead (the instructions are the same).
 
<ol>
<li>Download [https://visualstudio.microsoft.com/downloads/ Visual Studio 2022 Community].</li>
 
<li>In the installer, select the '''Desktop development with C++''' workload.
[[File:Vs2022 cppdevel.png|none]]</li>
 
<li>On the '''Individual components''' tab, scroll down to the '''Compilers, build tools, and runtimes''' section, and select the '''MSVC v140 - VS 2015 C++ build tools (v14.00)''' and '''C++ Windows XP Support for VS 2017 (v141) tools''' components.</li>
 
<li>Proceed with the installation.</li>
</ol>


== CMake ==
== CMake ==
Line 10: Line 20:
http://www.nasm.us/
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/nasm-2.11.08.zip Version 2.11.08].
For Visual Studio 2015 or newer, the latest nasm version is required. Currently, this is [http://www.nasm.us/pub/nasm/releasebuilds/2.11.08/nasm-2.11.08.zip Version 2.11.08].


== FMOD Ex ==
== FMOD Ex ==
Line 22: Line 32:
<!-- IGNORE THIS FOR NOW :x64 platforms use this: https://zdoom.org/files/fmod/fmodapi42416win64-installer.exe -->
<!-- IGNORE THIS FOR NOW :x64 platforms use this: https://zdoom.org/files/fmod/fmodapi42416win64-installer.exe -->


== TortoiseHg ==
== Mercurial ==
https://tortoisehg.bitbucket.io/download/index.html
Download the latest version of TortoiseHg for Windows from [https://www.mercurial-scm.org/ the Mercurial website]. This bundle includes Mercurial itself and the TortoiseHg graphical user interface.


Used for downloading the soruce and fetching the Mercurial revision ID when compiling the build.
Used for downloading the source code and fetching the Mercurial revision ID when compiling the build.
 
If you wish to build a specific topic, you must enable the <tt>topic</tt> and <tt>evolve</tt> Mercurial extensions. To do so, either:
* Open TortoiseHg Workbench, go to the File menu -> Settings, open the global settings tab, open the Extensions section, and select the <tt>topic</tt> and <tt>evolve</tt> extensions, then completely exit TortoiseHg Workbench.
* or, manually add the following to <tt>mercurial.ini</tt> in your user directory:
  <syntaxhighlight lang="ini">
[extensions]
topic =
evolve =
</syntaxhighlight>


== DirectX SDK ==
== DirectX SDK ==
http://www.microsoft.com/en-us/download/details.aspx?id=10084
https://wiki.zandronum.com/files/DXSDK_Feb10.exe


Zandronum depends on DirectDraw for software rendering on Windows, so the February 2010 SDK release is required.
Zandronum depends on DirectDraw for software rendering on Windows, so the February 2010 SDK release is required.
Line 44: Line 63:
OpenSSL is necessary in order for Zandronum to communicate securely with the account authentication server.
OpenSSL is necessary in order for Zandronum to communicate securely with the account authentication server.


Precompiled binaries for Windows are available from [https://slproweb.com/products/Win32OpenSSL.html 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.
Precompiled binaries for Windows are available from [https://slproweb.com/products/Win32OpenSSL.html Shining Light Productions].  You will want the latest '''non-light''' edition of OpenSSL (both 3.x.x and 1.x.x are known to work) - 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.


=== Building OpenSSL ===
=== Building OpenSSL ===
Line 74: Line 93:


Version 3.5 or newer is required.
Version 3.5 or newer is required.
== Opus ==
The Opus audio codec is required for voice chat support.
Download the latest libopus archive from [https://opus-codec.org/downloads/ the Opus website]. Extract the archive, then open the <tt>win32\VS2015\opus.sln</tt> solution (allow Visual Studio to upgrade the projects if necessary). Build the <tt>Release</tt> configuration for the same platform you will build Zandronum for (Win32 or x64).
After building, you will have a static library built under your libopus directory at <tt>win32\VS2015\Win32\Release\opus.lib</tt> or <tt>win32\VS2015\x64\Release\opus.lib</tt>. Pass the full path to the relevant library as the <tt>OPUS_LIBRARIES</tt> variable when it comes time to run CMake. Additionally, pass the libopus <tt>include</tt> folder as <tt>OPUS_INCLUDE_DIR</tt>.


== Zandronum Source Code ==  
== Zandronum Source Code ==  
Line 80: Line 107:


In the directory where you want to download the source, right-click on empty space, and go to <code>TortoiseHg &rarr; Clone</code>.
In the directory where you want to download the source, right-click on empty space, and go to <code>TortoiseHg &rarr; Clone</code>.
Enter <code>https://bitbucket.org/Torr_Samaho/zandronum</code> as the source.
Enter <code>https://foss.heptapod.net/zandronum/zandronum-stable</code> 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.
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 <code>ZA_2.1.2</code>.
For example, if you wanted to download [[Version history/{{LatestVersion}}|Zandronum {{LatestVersion}}]]'s source, you'd enter <code>ZA_{{LatestVersion}}</code>.


== Optional prerequisites ==
== Optional prerequisites ==
Line 90: Line 117:
Only available with the keyboard drivers from [http://www.logitech.com/ Logitech] hardware.
Only available with the keyboard drivers from [http://www.logitech.com/ Logitech] hardware.


= Build using Visual Studio 2015 or higher =
= Build using Visual Studio =
== Generate Projects ==
== Generate Projects ==
[[File:Vs2022 cmake.PNG|thumb|right]]
Open CMake (<code>cmake-gui</code>) 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.
Open CMake (<code>cmake-gui</code>) 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.
Click ''Configure'' and a dialog will pop up.
 
* Set the generator to '''Visual Studio 17 2022'''.
* Set the platform to '''Win32''' for a 32-bit build or '''x64''' for a 64-bit build.
* Set the toolset to '''v140_xp'''.


If it says there was an error, ignore it as we will solve it now.
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.
Make sure you set up all prerequisites correctly, and point CMake to the location of any missing paths. Select the '''Advanced''' and '''Grouped''' checkboxes to reveal and group all options.


Then click ''Configure'' again, and point CMake to missing paths.
Then click ''Configure'' again, and point CMake to missing paths.
Line 102: Line 135:
YASM is unneeded as we already have NASM.
YASM is unneeded as we already have NASM.


[[Image:PSVSGuide_CMake_Complete.png|thumb|left|Your CMake should look like this]]
[[File:PSVSGuide CMake Complete.png|none|thumb|300x300px|Your CMake should look like this]]
 
Click ''Configure'' again and your CMake should look like the image on the left.
Click ''Configure'' again and your CMake should look like the image on the left.
Now click ''Generate''. This will generate the project files.
Now click ''Generate''. This will generate the project files.


== Build Zandronum ==
== Build Zandronum ==
[[Image:PSVSGuide_Open_Zansln.png|thumb|right]]
Now go to where you generated the project files and open <code>Zandronum.sln</code>.
Now go to where you generated the project files and open <code>Zandronum.sln</code>.


Line 127: Line 160:


== error LNK1281: Unable to generate SAFESEH image ==
== error LNK1281: Unable to generate SAFESEH image ==
When using VC++ 2015, update to the latest nasm version.
When using Visual Studio 2015 or newer, update to the latest nasm version.


[[Image:PSVSBuild_Safesehno.png|thumb|right]]
[[Image:PSVSBuild_Safesehno.png|thumb|right]]