finnvoor / PlaydateKit

Create games for Playdate using Swift.
https://finnvoor.github.io/PlaydateKit/documentation/playdatekit
Creative Commons Zero v1.0 Universal
198 stars 21 forks source link

Error on build when running swift build -c release on 15.1 #102

Open jrschumacher opened 6 days ago

jrschumacher commented 6 days ago

When following the guide the error module 'Swift' cannot be imported in embedded Swift mode

> TOOLCHAINS="org.swift.61202411141a" swift build -c release
Building for production...
<unknown>:0: error: module 'Swift' cannot be imported in embedded Swift mode
/Users/ryan/Projects/swift-playdate-examples/Sources/Playdate/Graphics.swift:42:29: warning: result of call to function returning 'LCDBitmapDrawMode' is unused
 40 |   /// displayed as well.
 41 |   public static func setDrawMode(mode: LCDBitmapDrawMode) {
 42 |     graphicsAPI.setDrawMode.unsafelyUnwrapped(mode)
    |                             `- warning: result of call to function returning 'LCDBitmapDrawMode' is unused
 43 |   }
 44 | 

OS: 15.1 Toolchain: 2024-11-14 from trunk

Toolchains

> find /Library/Developer/Toolchains ~/Library/Developer/Toolchains -depth 1 -print 2>/dev/null
/Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2024-11-14-a.xctoolchain
/Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2024-10-30-a.xctoolchain
/Library/Developer/Toolchains/swift-latest.xctoolchain
finnvoor commented 1 day ago

PlaydateKit has a plugin for building projects, swift package pdc (see here for instructions). Just using swift build won't set all the required flags. I'm assuming you were trying to follow the swift-playdate-examples guide instead, which is slightly different, but if the PlaydateKit docs say to use swift build somewhere please let me know as that is incorrect.