Register
Handmade Hero»Forums»Code»A fully-featured Visual Studio setup using CMake (No MSBuild and no solution file)
26 posts
A fully-featured Visual Studio setup using CMake (No MSBuild and no solution file)
1 month, 2 weeks ago Edited by Arnon on Feb. 23, 2020, 1:25 a.m.
Hi everyone,

I just joined this awesome community, and wouls like to make this modest contribution here :)
I've been kind of frustrated to discover that there was no working setup for visual studio available.
I just recently started leaning CMake, so I thought I'd use this project to learn how to set-up a build system.
Took me a few days to get it all working, but it now build exacly the way as the .bat file.

It's pretty amazing how brain-dead simple it is to replicate with the recent release(s) of visual studio.
All you need to do is just put 3 small text files in a folder, and just open the folder itself in visual studio - it does the rest automagically(!)
There's no changes needed to the codebase whatsoever, and it doesn't modify anything,
so you can still have it in a repo and just pull each day there's an update.


Here's how it looks:




You can build and/or debug each component individually, or all at once:




Here's the repo: HandmadeCMakeVS

Note: Only the first file is actually needed (the others are just the result of doing a few more steps in VS).
Because it's just a CMake file it can be used from a command-line without ever opening visual studio at all.
It can also be extended to be cross-platform and usable outside of VS to compile in Linux or MacOS.

Hope people find it useful.

nJoy :)
19 posts
A fully-featured Visual Studio setup using CMake (No MSBuild and no solution file)
1 month, 2 weeks ago Edited by echu on Feb. 22, 2020, 7:37 p.m.
https://github.com/HandmadeHero/cpp linked on your repo’s Readme leads to a 404 page, just letting you know. I would really appreciate it if you could fix it!
Mārtiņš Možeiko
2040 posts / 1 project
A fully-featured Visual Studio setup using CMake (No MSBuild and no solution file)
1 month, 2 weeks ago Edited by Mārtiņš Možeiko on Feb. 22, 2020, 9:21 p.m.
You need to link your github account to sendowl purchase before you can see HandmadeHero cpp repository. Instructions are on your SendOwl purchase page for HandmadeHero. If you have not yet purchased HH, you can do that on https://handmadehero.org/ page.
26 posts
A fully-featured Visual Studio setup using CMake (No MSBuild and no solution file)
1 month, 2 weeks ago Edited by Arnon on Feb. 22, 2020, 11:28 p.m.
This is for people who have the source code and can build the game with the .bat file, but want to use Visual Studio instead of a text editor.
If you can't get to Casey's instructions in the link, that means you don't have access to the source code,
at which point I should ask: How are you even able to build the game with the .bat file?

EDIT: If you just downloaded the archive files after you purchased, then that could explain how.
In that case, you can also read Casey's instructions already locally.
The link just points to the readme.txt file in the handmade codebase.
So, you have it already.
The link is just for convinience.
I can make that clearer in my readme.

UPDATE: Done :)