Skip to content

Commit c3feda6

Browse files
authored
Add Playdate SDK include path to examples for Xcode module scanning (#156)
1 parent 068030c commit c3feda6

File tree

3 files changed

+24
-3
lines changed

3 files changed

+24
-3
lines changed

Examples/FlappySwift/Package.swift

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@ import PackageDescription
88
/// Xcode gains toolset.json support.
99
let xcode = (Context.environment["XPC_SERVICE_NAME"]?.count ?? 0) > 2
1010

11+
let playdateSDKPath: String = if let path = Context.environment["PLAYDATE_SDK_PATH"] {
12+
path
13+
} else {
14+
"\(Context.environment["HOME"]!)/Developer/PlaydateSDK/"
15+
}
16+
1117
let package = Package(
1218
name: "FlappySwift",
1319
platforms: [.macOS(.v14)],
@@ -28,7 +34,8 @@ let package = Package(
2834
"-Xfrontend", "-disable-stack-protector",
2935
"-Xfrontend", "-function-sections",
3036
"-Xfrontend", "-gline-tables-only",
31-
"-Xcc", "-DTARGET_EXTENSION"
37+
"-Xcc", "-DTARGET_EXTENSION",
38+
"-Xcc", "-I", "-Xcc", "\(playdateSDKPath)/C_API",
3239
]),
3340
],
3441
)

Examples/Pong/Package.swift

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@ import PackageDescription
88
/// Xcode gains toolset.json support.
99
let xcode = (Context.environment["XPC_SERVICE_NAME"]?.count ?? 0) > 2
1010

11+
let playdateSDKPath: String = if let path = Context.environment["PLAYDATE_SDK_PATH"] {
12+
path
13+
} else {
14+
"\(Context.environment["HOME"]!)/Developer/PlaydateSDK/"
15+
}
16+
1117
let package = Package(
1218
name: "Pong",
1319
platforms: [.macOS(.v14)],
@@ -28,7 +34,8 @@ let package = Package(
2834
"-Xfrontend", "-disable-stack-protector",
2935
"-Xfrontend", "-function-sections",
3036
"-Xfrontend", "-gline-tables-only",
31-
"-Xcc", "-DTARGET_EXTENSION"
37+
"-Xcc", "-DTARGET_EXTENSION",
38+
"-Xcc", "-I", "-Xcc", "\(playdateSDKPath)/C_API",
3239
]),
3340
],
3441
)

Examples/Xkpd/Package.swift

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@ import PackageDescription
88
/// Xcode gains toolset.json support.
99
let xcode = (Context.environment["XPC_SERVICE_NAME"]?.count ?? 0) > 2
1010

11+
let playdateSDKPath: String = if let path = Context.environment["PLAYDATE_SDK_PATH"] {
12+
path
13+
} else {
14+
"\(Context.environment["HOME"]!)/Developer/PlaydateSDK/"
15+
}
16+
1117
let armSysrootPath: String = if let path = Context.environment["ARM_NONE_EABI_SYSROOT_PATH"] {
1218
path
1319
} else {
@@ -44,7 +50,8 @@ let package = Package(
4450
"-Xfrontend", "-disable-stack-protector",
4551
"-Xfrontend", "-function-sections",
4652
"-Xfrontend", "-gline-tables-only",
47-
"-Xcc", "-DTARGET_EXTENSION"
53+
"-Xcc", "-DTARGET_EXTENSION",
54+
"-Xcc", "-I", "-Xcc", "\(playdateSDKPath)/C_API",
4855
]),
4956
],
5057
),

0 commit comments

Comments
 (0)