Can't run new project from Template in Swift

Hi! I downloaded the PlayDate project from Apple GitHub with examples and a template
Examples work correctly, I can try the games, but I decided to write my project in Swift and do everything step by step by Documentation, but I got the error after tried to use make

maksimbezdrobnoi@dhcp-20-134 MyGame % make
detected_OS is "Darwin"
make: *** No rule to make target `/Users/maksimbezdrobnoi/Developer/swift-playdate-examples/Sources/CPlaydate/posix_memalign.c', needed by `build//Users/maksimbezdrobnoi/Developer/swift-playdate-examples/Sources/CPlaydate/posix_memalign.o'.  Stop.

Does anybody know how to solve it?
I use Mac, Xcode 15.3

Did you copy the file CPlaydate/posix_memalign.c from the example into your project ?

In example we have playdate.c


Here the CPlaydate from Github

I dont know who wrote the documentation and created a Template... Everything is broken. Here the correct Entry.swift file

#if swift(>=6.0)
public import Playdate
#else
import Playdate
#endif

nonisolated(unsafe) var game = Game()

@_cdecl("update")
func update(pointer: UnsafeMutableRawPointer?) -> Int32 {
  game.updateGame()
  return 1
}

@_cdecl("eventHandler")
public func eventHandler(
  pointer: UnsafeMutableRawPointer!,
  event: PDSystemEvent,
  arg: UInt32
) -> Int32 {
  initializePlaydateAPI(with: pointer)
  if event == .initialize {
    game = Game()
    System.setUpdateCallback(update: update, userdata: nil)
  }
  return 0
}

And correct header for Template Makefile

REPO_ROOT := $(shell git rev-parse --show-toplevel)
PRODUCT := {{Game name}}.pdx
SRC += $(REPO_ROOT)/Sources/CPlaydate/playdate.c        <<<---- Correct path
1 Like