Building mixed C/Lua projects on multiple platforms (Windows/Mac)

Hey guys! So, I’m making a PD game with a bunch of great people, and I’m looking for best practices when it comes to mixed code (C and Lua) and mixed dev platforms (Windows and Mac).

So, our programmer uses Windows + Visual Studio 2022 for C development, and VSCode for Lua. I’m more of a design / UI / narrative guy, and I’m on a Mac, so I use Nova to build Lua projects, and I obviously have Xcode, but looking at the relevant section in “Inside Playdate with C“ I’m like “uhhhh, what’s my situation here?“ Make, CMake? What’s the difference? I can cobble together a half-decent Lua script, and I can do some command line stuff, but I’m not a seasoned programmer, so I’m kind of puzzled how to I build a C-project-with-Lua on a Mac. Our Windows guy doesn’t have a recent Mac machine nearby, so…

I’d be grateful for any insights and ideas here.

How does your developer compile? If he is using CMake, I recommend that you stick to the same toolchain to avoid discrepancies in builds.

CMake is something like a Makefile generator. It will create a Makefile for your computer (or an Xcode project) and you will have to use Make (or an other tool) to build.

Here is a walkthrough using the CMake UI to build the "Array" example (it is also using C and Lua code):

Select the game folder in "where is the source code" and add "/build" to the same path in the "where to build the binaires" field:

Press "configure", click "Yes" in the popup asking you if you want to create the build folder and select what you will use to build the project (choose "Unix Makefile" if you are not sure):

Now click on "Generate" to create the Makefile:

You can then build the project by calling "make" in the "build" folder:

The PDX is created in the parent folder:

2 Likes

Thanks, Raphaël. That was very instructive, and compiled for me all right. I guess that was the missing step for me, now I see how I can compile it either manually, or set up in Nova.

1 Like