I developed games for the Playdate for almost 2 years in Lua, and last year I decided to quit and learn graphics programming, as it was my passion and I also wanted to pursue a career in it. I worked in C++ and C, and now I’m more familiar with those languages than Lua. I know have a great idea for a Playdate game, and thought it would be a great time to come back and develop for this device again, but this time I wanted to do it in C.
Now here comes the actual problem: I develop in CLion, it’s my favorite IDE, and I would definitely like to stick to it during development. The SDK documentation has a segment for setting up a project in CLion, but it has this line:
”Open your project folder in CLion. It will detect the names of the Simulator and device targets automatically.”
I do that, and to my surprise it does not detect any profiles. I opened the Hello World example provided under the C_API/Examples folder. It contains a CMakeLists.txt, yet it still detects no profile to run.
I’m on Linux, but I’m unsure how that would be a setback, from my experience C and C++ are generally easier to run and debug on Linux distributions.
I’ve been stuck on this issue for 2 days now, any help would be appreciated.
Okay, I’m happy to say I have solved this by just manually adding the simulator CMake profile. Turns out all I have to do is to set it to debug (which I’m pretty sure is optional, but I didn’t check), and I don’t have to set the toolchain file, the CMakeLists.txt handles everything else. The .pdx files looked so empty compared to what I used to have in my Lua days that I thought that they weren’t being generated completely, but turns they were generating correctly.
I tried setting a c prohect as well, even used existing templates, but could get it to work. Can you say something to the type c-compiler thingy for arm. I think I downloaded the correct one, but I don’t think I could get it to be used in vscode... Since I have one idea about cmake, I not sure if that was the issue or something else.
There’s the Hello World project in the C examples, which has a perfectly working CMakeLists.txt. The documentation details the creation of the “Device” cmake profile very well, and the simulator profile is basically the same, you just have to remove the toolchain path from it.
I’m unsure if I understand your issue correctly, but if I do, then the most important thing you have to do, is to actually provide the toolchain file to the cmake profile for compilation (detailed in the SDK), and also set the executable to the Playdate Simulator, so it actually runs.
I hope this helped.
Also, this post is not about the VSCode configuration, rather the CLion one. I recommend you look somewhere else if you want to set up a project in VSCode.