Handmade Hero»Forums»Code
Matt Gilene
1 posts
Sublime Text Build System
For anyone using Sublime Text as their editor here is a build system that should automatically build the entire project just like you would from the command window.

**NOTE - If you run Sublime text from the command line this will not work. You need to run it from the Shortcut.

How to use

-Go to Tools->Build Systems->New Build System
-Copy the following into the file and save it accordingly
1
2
3
4
5
6
{
"cmd": ["${file_path}/build.bat", "${file}"],
"file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
"working_dir": "w:/build",
"selector": "source.c, source.cpp, source.c++"
}

-Select the new build system
-To build simply press F7
22 posts
Sublime Text Build System
Thanks for the tip. It didn't quite work for me, maybe because I'm still just on day 004 and something changed later.

I got something else to work, which I will post in case it's useful to anyone.

I saved the build config as part of a sublime project config, so the equivalent portion to the OP is just the "build_system" part.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
{
	"folders":
	[
		{
			"path": "."
		}
	],
	"build_systems": [
		{
			"name": "Build Handmade Hero",
			"shell_cmd": "\"C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/Common7/Tools/VsDevCmd.bat\" -no_logo & cd \"C:/FULL/PATH/TO/handmade-hero/handmade/code/\" & \"build.bat\"",
			"selector": "source.c, source.cpp, source.c++"
		}
	]
}


Sorry for the really long line. :)

Note the part where you have to replace "FULL/PATH/TO" ... also, I'm not currently using the "W:" drive with "subst", but you might have to add something to get the shell to switch to the "W:" drive in that case.
117 posts
Code hacker/developer
Sublime Text Build System
Nice. Sublime is my fav editor now. Anyone else got any other tips for Sublime?
Simon Anciaux
1337 posts
Sublime Text Build System
I don't use sublime so I may be wrong but it looks like this line is calling vsdevcmd.bat each time you compile, which will take some unnecessary time.
1
"shell_cmd": "\"C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/Common7/Tools/VsDevCmd.bat\" -no_logo & cd \"C:/FULL/PATH/TO/handmade-hero/handmade/code/\" & \"build.bat\"",

A solution would be to launch sublime from a command line window which as already called vsdevcmd.bat so you don't need to call it when you compile.