on discord i explained how i do it for one person so i'm pasting it here also it might help you to get it going
- Download visual studio 2022 community edition & install it
- Download cmake from here Download CMake (use the zip version)
- Download arm-gnu-toolchain-12.3.rel1-mingw-w64-i686-arm-none-eabi.zip (take latest version if newer) from https://developer.arm.com/downloads/-/arm-gnu-toolchain-downloads
- extract cmake and the arm gnu tool chain somewhere for example in c:\playdate (i have my playdatesdk in c:\playdate\playdatesdk and in c:\playdate i also have cmake and the arm toolchain
- for any new project you want to start, copy PlaydateSDK\C_API\Examples\Hello World to a new folder
- Edit CMakeList and change these 2 lines to your game name set(PLAYDATE_GAME_NAME hello_world) set(PLAYDATE_GAME_DEVICE hello_world_DEVICE) the part you need to change is "hello_world"
- save this as a playdateenvironment.bat (not playdateenvironment.bat.txt !!!) somewhere and adapt the paths to your environment / install
SET PLAYDATE_SDK_PATH=C:\playdate\PlaydateSDK
SET PATH=C:\playdate\gcc-arm-11.2-2022.02-mingw-w64-i686-arm-none-eabi\bin;C:\playdate\CMAKE\bin;%PATH%
%comspec% /k "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars64.bat"
- double click the playdatenvironment.bat file and it will open a cmd prompt
- "cd" to your directory that contains your (renamed) copy of "Hello World" c api example
- inside that directory create 2 new subdirs (can use mkdir command) named build_device and build_simulator
- first cd in the build_simulator directory and now type
cmake ..(..referes to previous / one dir up and in that one dir up the cmakelists file should exist). This will generate solution files which you can open in visual studio 2022, once you open them set the middle project (the game itself) as startup project rebuild the solution & press the run / play button. You have the game now working for simulator. if you want to add new .c or .h files add them to the src directory where main.c is and drag them to the solution explorer in visual studio, don't use file-> new in visual studio as it will save the files in build_simulator directory which is wrong or erase build_simulator after adding the .c .h files to correct directories and restart thecmake ..command to regenerate the solution files. normally you only need todo this once to generate the solution files and you can continue working with visual studio 2022 - to compile for the playdate device itself cd build_device
- run
cmake .. -G "NMake Makefiles" --toolchain=<path to SDK>/C_API/buildsupport/arm.cmakeadapt<path to sdk>in this command to where your playdate sdk is installed and verify you target the arm.cmake file correctly. - now you can run
nmakecommand to build for the playdate if you want to recompile or so donmake cleanfollowed bynmakeagain - building optimized Release version for playdate cd to build_device again when having done the above cmake command at least once then type
cmake -DCMAKE_BUILD_TYPE=Release ..this will change the build target to release and will compile your game with -O3 etc optimizations level
in all cases your build files will be in NameOfGame.pdx directory and you should always put your sources in src dir and your assets in Source dir. If you want to use subfolders to add source codes under src. you need to modify cmakelist.txt and add a multiple source lines for example like so :
file(GLOB SOURCES
"src/*.c"
"src/gameobjects/*.c"
"src/gamestates/*.c"
)
you can see an example of this in the edited default cmakelist i use to make it find all C files easier here is an example : https://github.com/joyrider3774/formula1_playdate/blob/main/CMakeLists.txt