Cmake tutorial c8/19/2023 ![]() Your first C project for Playdate is now setup! This could be a task but I’ve been using VS Code as long as I’ve been hammering it to work for PlaydateĪfter all that is said and done, run the CMake Clean task (again, Ctrl+Shift+P and start typing cmake clean and the task should pop up) and open up CMakeLists.txt and change the project name to something other than c_template. You should now see a “c_template.pdx” folder in the workspace directory! You can install this using pdutil.exe, via pdutil install c_template.pdx. Anyways, the build should finish pretty quickly and show no errors if everything is setup properly. There are also CMake Clean/Rebuild/Configure/etc tasks under the command palette. All we need to do now is to try a build F7 is a shortcut for CMake Build but it is a task you can run under the command palette using Ctrl+Shift+P. If everything is working, there should be no errors in the output window (this is a warning popup from VS Code itself but it seems safe to ignore). You should see at least one available called “Playdate Device”, select that.Īfter the kit has been selected, cmake-tools will invoke CMake to configure the project for us. ![]() This is where we select our kit, meaning our tool chain. Hit “Yes”, and at the top a drop down will open. Once VS Code opens up, the cmake-tools extension will detect the CMakeLists.txt file, and will ask if you want to configure it. Again, when we open VS Code, it has to have the environment variables setup as above. After that, we open VS Code with that copied folder as our workspace. PLAYDATE_ARM_GCC: Another new environment variable, this time the path defined to where you’ve unpacked the ARM GCC toolchain.ĭon’t forget to escape your back slashes (or use forward slashes) in your paths!! Once that’s done, make a copy of the “c_template” folder and rename it to whatever you’d like.PLAYDATE_SDK: This will be a new one, the path define should point to your SDK directory where bin is a child directory.PATH: For the PATH environment variable, you need to add the path to wherever Ninja was unpacked.You can set it up under your user’s environment variable or setup some command prompt shell that has the environment variables setup for that shell window (you can open a workspace folder in VS Code from prompt via “vscode. ![]() I’m using environment variables for this, and you can set these up however you like, as long as they’ll be defined in an environment that VS Code executes in. Once CMake, Visual Studio Code + Extensions are setup and everything is unpacked to where they’re supposed to be, we need to setup an environment with which that would allow our setup to work. This essentially defines our toolchain to cmake. There is also the “arm_patched.cmake” file, place that in (Playdate SDK)/C_API/buildsupport. This zip holds a template workspace folder called “c_template”, which is already setup to be working with VSCode when your environment is setup properly. Again, this will be going into its own environment variable.Īddtional Helper Files vscode_helpers_v2.zip (3.8 KB) If you haven’t already unpacked this, go on and do it! Be sure to note the path where “bin” is a child directory. We will save the path in a new environment variable later. C:/playdate_dev/arm_toolchain) and note the path. This would be done so CMake Tools would be able to use it.Īs we did with Ninja, unpack the zip into some directory (for ex. Remember where you put it, we’re gonna need to add it to our PATH environment variable later. Just unpack this in some directory (for ex. We use CMake because Panic has provided some helper CMake files that help generate/compile our project, and Visual Studio Code as it has extensions to interact with CMake.įirst half of our build system this will configure and generate Ninja build files for us to build our project with.ĭon’t forget the extensions! They help us get Visual Studio Code to a decently functioning IDE for our project. This will setup a simple C project using Visual Studio Code and CMake. Also, none of this is really Windows only, the modified bits are fixed up to also support Windows properly as well as allow user defined paths for the SDK and toolchain using environment variables. The SDK for Windows is a little anemic, so I figured this might be useful to anyone trying to figure out how to program in C on Windows. ![]()
0 Comments
Leave a Reply.AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |