Build System for Sublime Text

I've updated the build setup for Sublime Text and have split it in two variations:

Simple Build Setup If you work only with lua
Playdate-Simple.sublime-build.zip (725 Bytes)

  • It will build the first folder that is in the side bar. If no folder is setup in the sidebar it will compile the folder of the active file (so you can just open main.lua and build the project)
  • The pdx will be created in the parent folder.

CMake Build Setup If you work with C and lua
Playdate-CMake.sublime-build.zip (1.0 KB)

  • This setup requires a project with a specific structure. The main folder should contain the CMakeLists.txt, a Source folder (which contains lua source file, pdxinfo, assets), a src folder (with all the C source files), the .sublime-project file.
  • You should run CMake All first (it will create buildDevice and buildSimulator folders). When developing, use the build for the simulator. If you need to run your game on the device, use the Device build.

Screenshot 2021-12-27 at 22.45.17


Original Message

Here is the build setup I use for Sublime Text.
Playdate.sublime-build.zip (578 Bytes)

I've updated it since I work a bit with C now.

It requires to have all the files for the game in a "Source" folder on the level of the project file.
For lua project, simply use the default build.
For C projects, you should use CMake All first and after build for the Simulator or the Device.

Error reporting should work both for C and lua.

7 Likes

For others, this needs to go at:

~/Library/Application Support/Sublime Text 3/Packages/User/Playdate.sublime-build

1 Like

I’ve cleaned up my build setup. I updated the top message but here is the setup I used

Simple Build Setup

{
	"working_dir": "${folder:${file_path}}",
	"shell_cmd": "pdc \".\" \"../${project_base_name:build}.pdx\" && open \"../${project_base_name:build}.pdx\"",
	"file_regex": "^(?:[Ee]rror: )?(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
}

CMake Build Setup

{
	"working_dir": "$project_path",
	"shell_cmd": "pdc \"Source/\" \"$project_base_name.pdx\" && open \"$project_base_name.pdx\"",
	"file_regex": "^(?:[Ee]rror: )?(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",

	"variants": [
		{
			"name": "PDC and launch simulator",
			"shell_cmd": "pdc \"Source/\" \"$project_base_name.pdx\" && open \"$project_base_name.pdx\""
		},
		{
			"name": "With C for Simulator",
			"shell_cmd": "make -C \"buildSimulator\" && pdc \"Source/\" \"$project_base_name.pdx\" && open \"$project_base_name.pdx\"",
		},
		{
			"name": "With C for Device",
			"shell_cmd": "make -C \"buildDevice\" && pdc \"Source/\" \"$project_base_name.pdx\"",
		},
		{
			"name": "Clean All",
			"shell_cmd": "make clean -C \"buildDevice\" && make clean -C \"buildSimulator\""
		},
		{
			"name": "CMake All",
			"shell_cmd": "mkdir -p \"buildDevice/\" && mkdir -p \"buildSimulator/\" && cmake -DCMAKE_BUILD_TYPE=Debug -B \"buildSimulator/\" -S \"./\" && cmake -DCMAKE_TOOLCHAIN_FILE=~/Developer/PlaydateSDK/C_API/buildsupport/arm.cmake -B \"buildDevice/\" -S \"./\""
		},
	]
}