[Tutorial] Compiling the GZDoom source code with CMake

Discuss anything ZDoom-related that doesn't fall into one of the other categories.
User avatar
The Zombie Killer
Posts: 1528
Joined: Thu Jul 14, 2011 12:06 am
Location: Gold Coast, Queensland, Australia

[Tutorial] Compiling the GZDoom source code with CMake

Post by The Zombie Killer »

I recently (a few seconds ago as of this writing) compiled the GZDoom source code, and thought I'd write up a tutorial as the wiki page seemed a little outdated.

It uses some stuff from the wiki page, and Delyon's ModDB tutorial
It's probably pretty messy since I'm not very good at making tutorials.

Things that will be required (just dump it all into a folder somewhere)
NASM v2.0+ (2.11 linked)
FMOD Ex v4.26.36
Platform SDK
February 2010 DirectX SDK
CMake
Visual Studio Express 2013 for Windows Desktop
The GZDoom source code (put it in some directory like C:\GZDoomSrc\source)

1. Install Visual Studio Express 2013
2. Install NASM
3. Install FMOD Ex
4. Install the Platform SDK, but when prompted to choose what to install, ONLY choose the following (image from Delyon's tutorial):
Image
5. Install the DirectX SDK
6. Install and run CMake
7. In the box labeled "Where is the source code:" point it to the directory where you put the source code. (eg C:\GZDoomSrc\source)
8. In the box labeled "Where to build the binaries:" create a subdirectory in the path to the source code to contain the build files (eg C:\GZDoomSrc\source\Release)
9. Click the Configure button at the bottom of the window. If the build directory does not exist, it will ask to create it. Let it.
10. When asked which generator to use, pick "Visual Studio 12"
11. After it has finished configuring, most of it should be correct/already filled in, but some stuff might require changing:

Code: Select all

 CMAKE_BUILD_TYPE: This defaults to Debug. You probably want to change it to Release.
 DYN_FLUIDSYNTH: If you want support for fluidsynth.dll, check this.
 FMOD_INCLUDE_DIR: Make sure this points to *Where you installed FMOD*/api/inc
 FMOD_LIBRARY: Make sure this points to *Where you installed FMOD*/api/lib/libfmodex.a
12. If you changed any of the above items, click Configure again
13. Now press "Generate" and wait for it to complete.
14. Browse to "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include" and open up "intrin.h" in notepad.
15. Change the following two lines:

Code: Select all

__MACHINEI(unsigned char _interlockedbittestandset(long volatile *a, long b))
__MACHINEI(unsigned char _interlockedbittestandreset(long volatile *a, long b))
into:

Code: Select all

//__MACHINEI(unsigned char _interlockedbittestandset(long volatile *a, long b))
//__MACHINEI(unsigned char _interlockedbittestandreset(long volatile *a, long b))
16. Open up Visual Studio Express 2013, and open up "GZDoom.sln" which can be found in "C:\GZDoomSrc\Release" (do not use the one in C:\GZDoomSrc!)
17. Hit "F7" and wait for GZDoom to build. When it's done, the compiled binary should be located in "C:\GZDoomSrc\Release\Release"
Last edited by The Zombie Killer on Sat Jan 25, 2014 6:50 am, edited 9 times in total.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49071
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: [Tutorial] Compiling the GZDoom source code with CMake

Post by Graf Zahl »

You can scrap the glheaders step. Those files are part of the GZDoom repo - they have been for some time now.

More importantly. do NOT(!!!) change the project settings in Visual Studio if it isn't absolutely necessary. Those will be reset each time CMake rebuilds them.
I also recommend against using VS 2010. I found it's by far the most inefficient compiler since 2005. Either use 2005 or 2013, those seem to generate the fastest code.
User avatar
The Zombie Killer
Posts: 1528
Joined: Thu Jul 14, 2011 12:06 am
Location: Gold Coast, Queensland, Australia

Re: [Tutorial] Compiling the GZDoom source code with CMake

Post by The Zombie Killer »

Graf Zahl wrote:You can scrap the glheaders step. Those files are part of the GZDoom repo - they have been for some time now.
Thanks for the tip, I didn't know they had been put into the repo (well, obviously since I included that in the tutorial)
The wiki should probably be updated to reflect this.
Graf Zahl wrote:More importantly. do NOT(!!!) change the project settings in Visual Studio if it isn't absolutely necessary. Those will be reset each time CMake rebuilds them.
Again, thanks for the info
Graf Zahl wrote:I also recommend against using VS 2010. I found it's by far the most inefficient compiler since 2005. Either use 2005 or 2013, those seem to generate the fastest code.
In that case, I'll install 2013 and update the tutorial once I have it all set up for it.
EDIT: It appears that I need Windows 8 for VS2013. I'll stick with VS2010/2005 for now I guess.
EDIT2: It appears that CMake doesn't seem to like VS2005 on my PC, so to be on the safe side I've reverted the tutorial to use VS2010
User avatar
Siberian Tiger
Posts: 476
Joined: Fri Jun 12, 2009 11:23 pm
Preferred Pronouns: He/Him
Operating System Version (Optional): Windows 10 Pro. 22H2
Graphics Processor: nVidia (Modern GZDoom)
Location: United States
Contact:

Re: [Tutorial] Compiling the GZDoom source code with CMake

Post by Siberian Tiger »

The Zombie Killer wrote:I recently (a few seconds ago as of this writing) compiled the GZDoom source code, and thought I'd write up a tutorial as the wiki page seemed a little outdated.
Why not update the article instead of making a forum topic - which will be outdated in a short time? I never understood why people think that making tutorials on the forums is the best alternative, - - when infact the Wiki provides better functionality for an article to be 'alive' for generations. When your forum post becomes obsolete, then more users will create a new topic on how to compile GZDoom, which will add more redundancy within the forum database and your post will still overlap other tutorials during searches - making it harder to know what is current and what is outdated.

Please consider updating the wiki article.
User avatar
The Zombie Killer
Posts: 1528
Joined: Thu Jul 14, 2011 12:06 am
Location: Gold Coast, Queensland, Australia

Re: [Tutorial] Compiling the GZDoom source code with CMake

Post by The Zombie Killer »

I actually tried updating the article, but for some reason the wiki hates me and it won't actually change the page.
The forums were actually my last resort :p
User avatar
edward850
Posts: 5886
Joined: Tue Jul 19, 2005 9:06 pm
Location: New Zealand
Contact:

Re: [Tutorial] Compiling the GZDoom source code with CMake

Post by edward850 »

The Zombie Killer wrote:EDIT: It appears that I need Windows 8 for VS2013. I'll stick with VS2010/2005 for now I guess.
Huh?
Express 2013 for Windows Desktop wrote:System Requirements:
Supported operating systems
Windows 7 SP1 (x86 and x64)
User avatar
The Zombie Killer
Posts: 1528
Joined: Thu Jul 14, 2011 12:06 am
Location: Gold Coast, Queensland, Australia

Re: [Tutorial] Compiling the GZDoom source code with CMake

Post by The Zombie Killer »

Strangely enough, I have Windows 7 SP1 (x64), and when I tried to install it, it told me that it requires a newer version of Windows.
EDIT: I'm dumb. I was trying to get "For Windows" instead of "For Windows Desktop"
User avatar
edward850
Posts: 5886
Joined: Tue Jul 19, 2005 9:06 pm
Location: New Zealand
Contact:

Re: [Tutorial] Compiling the GZDoom source code with CMake

Post by edward850 »

There is actually a difference between "Visual Studio Express 2013 for Windows" and "Visual Studio Express 2013 for Windows Desktop". The non-desktop one (which ironically still runs on the desktop) has additional Metro development tools.
Edit: And I see you found out yourself. :P
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49071
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: [Tutorial] Compiling the GZDoom source code with CMake

Post by Graf Zahl »

edward850 wrote:There is actually a difference between "Visual Studio Express 2013 for Windows" and "Visual Studio Express 2013 for Windows Desktop". The non-desktop one (which ironically still runs on the desktop) has additional Metro development tools.
Edit: And I see you found out yourself. :P
Make that: "Visual Studio Express 2013 for Windows" is for Metro only. It not only requires Windows 8, it's also for Windows 8 toy apps only.
User avatar
edward850
Posts: 5886
Joined: Tue Jul 19, 2005 9:06 pm
Location: New Zealand
Contact:

Re: [Tutorial] Compiling the GZDoom source code with CMake

Post by edward850 »

Really? Huh. I didn't think that would have been different between Express and Ultimate.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49071
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: [Tutorial] Compiling the GZDoom source code with CMake

Post by Graf Zahl »

There's two 2013 Express versions:

The useless one: Visual Studio Express 2013 for Windows

The good one: Visual Studio Express 2013 for Windows for desktop
imed
Posts: 4
Joined: Fri Jul 05, 2013 3:35 pm

Re: [Tutorial] Compiling the GZDoom source code with CMake

Post by imed »

A little question here.

I have Windows Xp sp 3, and it seems like Visual Studio Express 2013 is not compatible.
¿Any compatible alternative?
mallo
Posts: 1112
Joined: Sat May 22, 2010 12:49 pm

Re: [Tutorial] Compiling the GZDoom source code with CMake

Post by mallo »

VS2010 I believe
User avatar
jpalomo
Posts: 771
Joined: Mon May 17, 2010 9:45 am

Re: [Tutorial] Compiling the GZDoom source code with CMake

Post by jpalomo »

You will need an older program. I recommend VS 2005, since it can still compile ZDoom with the solution file included with the source. The link for 2005 should still be on the zdoom wiki page for [wiki=Compile_ZDoom_on_Windows]compiling on Windows[/wiki].
User avatar
phantombeta
Posts: 2089
Joined: Thu May 02, 2013 1:27 am
Operating System Version (Optional): Windows 10
Graphics Processor: nVidia with Vulkan support
Location: Brazil

Re: [Tutorial] Compiling the GZDoom source code with CMake

Post by phantombeta »

What about VS2008?
I use it and it's pretty good IMO.
Post Reply

Return to “General”