[WINDOWS] Compiling GZDoom with CMake GUI, Visual Studio and vcpkg

Handy guides on how to do things, written by users for users.

Moderators: GZDoom Developers, Raze Developers

Forum rules
Please don't start threads here asking for help. This forum is not for requesting guides, only for posting them. If you need help, the Editing forum is for you.
User avatar
Nash
 
 
Posts: 17394
Joined: Mon Oct 27, 2003 12:07 am
Location: Kuala Lumpur, Malaysia

[WINDOWS] Compiling GZDoom with CMake GUI, Visual Studio and vcpkg

Post by Nash »

Moving forward GZDoom will be utilizing vcpkg to help reduce the amount of dependencies that its source code is bundled with. Here's a rundown on how to build GZDoom with the new system.

Step 1: Use Git or TortoiseGit to clone vcpkg to any location on your hard disk. This is no different than cloning GZDoom from before.

Step 2: Inside the newly-cloned vcpkg folder, run bootstrap-vcpkg.bat (Windows) or bootstrap-vcpkg.sh (other OSes). It should finish fairly quickly. That's fine.

Step 3: Run CMake GUI. If you have a previous CMake build of the source code, you should nuke it entirely. We'll have to do this from scratch.

Step 4: Input the source code and build directories as usual here; if you've built GZDoom before, this step hasn't changed. Now press Configure.



Step 5: Choose whichever version of Visual Studio you want to use (here for me, I only have VS 2022 installed, so that's what it defaults to) and then select "Specifiy toolchain for cross-compiling". It's important to select this, otherwise you won't be able to proceed.



Step 6: In the next dialog, navigate to scripts/buildsystems/vcpkg.cmake that's contained inside the vcpkg folder you cloned earlier. Proceed by clicking on "Finish".



That's it! Sit back and let CMake do its thing. It might take a while because it will download and build stuff for you.

After this point, everything should be the same as pre-vcpkg. Set whatever options you need, and then hit Generate and you'll get your .sln file.

Last edited by Nash on Wed Aug 23, 2023 6:12 pm, edited 1 time in total.
User avatar
Rachael
Posts: 13393
Joined: Tue Jan 13, 2004 1:31 pm
Preferred Pronouns: She/Her

Re: Compiling GZDoom with CMake GUI, Visual Studio and vcpkg

Post by Rachael »

Thank you for doing this Nash. You turned my technical babblespeak into something everyone could use. And you also were the one to figure out that the only piece of the puzzle that was missing was the toolchain file thing - it was my mistake to not think of that, first.
Iluin
Posts: 3
Joined: Tue Aug 22, 2023 6:05 am

Re: Compiling GZDoom with CMake GUI, Visual Studio and vcpkg

Post by Iluin »

> Step 2: Inside the newly-cloned vcpkg folder, run bootstrap-vcpkg.bat (Windows) or bootstrap-vcpkg.sh (other OSes). It should finish fairly quickly. That's fine.

That step is not required in manifest mode. vcpkg should be able to bootstrap itself.
User avatar
MartinHowe
Posts: 2014
Joined: Mon Aug 11, 2003 1:50 pm
Location: Waveney, United Kingdom

Re: Compiling GZDoom with CMake GUI, Visual Studio and vcpkg

Post by MartinHowe »

This is good for the GUI crowd, but what about terminal only building? I have a set of scripts that "just work" for building GZDoom and would hate to see them require user input during the process :( Presumably it will still be possible on Linux to build entirely from terminal commands?
User avatar
JPL
 
 
Posts: 523
Joined: Mon Apr 09, 2012 12:27 pm

Re: Compiling GZDoom with CMake GUI, Visual Studio and vcpkg

Post by JPL »

Might be worth appending "in Windows" to the title of this thread to preempt people coming into this thread to ask about support for other build methods / OSes. Likewise a separate "compiling the new way in Linux" might be able to collect what would otherwise be lots of smaller more isolated support requests.
User avatar
RicardoLuis0
 
 
Posts: 55
Joined: Tue Aug 21, 2018 9:31 pm
Preferred Pronouns: He/Him
Graphics Processor: nVidia (Modern GZDoom)
Location: Brazil

Re: Compiling GZDoom with CMake GUI, Visual Studio and vcpkg

Post by RicardoLuis0 »

JPL wrote: Wed Aug 23, 2023 2:05 pm "compiling the new way in Linux"
The "old" way isn't really going away, what this update is doing is adding vcpkg support and removing the bundled windows dependencies -- ex. on Linux you'll be free to continue using the system package manager, use vcpkg, or get the dependencies you need any other method (basically, the build method for non-windows platfoms hasn't changed at all)
User avatar
Nash
 
 
Posts: 17394
Joined: Mon Oct 27, 2003 12:07 am
Location: Kuala Lumpur, Malaysia

Re: Compiling GZDoom with CMake GUI, Visual Studio and vcpkg

Post by Nash »

JPL wrote: Wed Aug 23, 2023 2:05 pm Might be worth appending "in Windows" to the title of this thread to preempt people coming into this thread to ask about support for other build methods / OSes. Likewise a separate "compiling the new way in Linux" might be able to collect what would otherwise be lots of smaller more isolated support requests.
Done.
MartinHowe wrote: Wed Aug 23, 2023 11:02 am This is good for the GUI crowd, but what about terminal only building? I have a set of scripts that "just work" for building GZDoom and would hate to see them require user input during the process :( Presumably it will still be possible on Linux to build entirely from terminal commands?
Yeah sorry this thread is only for the GUI crowd, for command lines, only new thing you need to add to your CMake call is the -DCMAKE_TOOLCHAIN_FILE=<path to vcpkg.cmake> parameter. I won't be covering it though, someone else may feel free to take care of that. :D
User avatar
Rachael
Posts: 13393
Joined: Tue Jan 13, 2004 1:31 pm
Preferred Pronouns: She/Her

Re: [WINDOWS] Compiling GZDoom with CMake GUI, Visual Studio and vcpkg

Post by Rachael »

It's basically the same for other OS's, and Cmake-GUI is available on all platforms, so saying "for windows" is really a bit misleading.

The command line is indeed just simply using -DCMAKE_TOOLCHAIN_FILE to point to your vcpkg installation with the script inside, it requires a very specific file but it should be pretty clear which one if you follow the instructions here.
User avatar
MartinHowe
Posts: 2014
Joined: Mon Aug 11, 2003 1:50 pm
Location: Waveney, United Kingdom

Re: [WINDOWS] Compiling GZDoom with CMake GUI, Visual Studio and vcpkg

Post by MartinHowe »

Thanks everyone, I'll look into this next time I need to build it. Hopefully the Wiki for it will be updated eventually.

Return to “Tutorials”