Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Swift 6, SwiftUnicodeDataTables, Other Improvements #106

Merged
merged 35 commits into from
Dec 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
f02b1a1
Require Swift 6 and tools v6
STREGA Nov 22, 2024
f59cc8c
Fix build error
STREGA Nov 22, 2024
1b9a1cd
Remove pdc flag skip-unown
STREGA Nov 22, 2024
b218c21
Add build flag for linking swiftUnicodeDataTables
STREGA Nov 22, 2024
5487962
Improve swift toolchain lookup
STREGA Nov 22, 2024
3da4f21
Use clang in swift toolchain
STREGA Nov 22, 2024
308950f
Improve product module lookup
STREGA Nov 22, 2024
c7507ce
Add documentation
STREGA Nov 22, 2024
7d668b3
Fix build errors
STREGA Nov 22, 2024
71deeab
Merge branch 'main' into pr-106
STREGA Nov 22, 2024
ff65025
Chip away at deprecations
STREGA Nov 22, 2024
d06f150
Remove merge conflict junk
STREGA Nov 22, 2024
284285c
Add hack for SwiftUnicodeDataTables
STREGA Nov 23, 2024
8f09d95
Use chosen Playdate SDK
STREGA Nov 23, 2024
161c980
Show built pdx path in build output
STREGA Nov 23, 2024
e7ecb21
Improve build output
STREGA Nov 23, 2024
f010184
Add swiftUnicodeDataTables source as a module
STREGA Nov 24, 2024
02ec121
Export so symbols are available
STREGA Nov 24, 2024
e36411f
Remove linking hacks
STREGA Nov 24, 2024
03ba34d
Fix deprecations
STREGA Dec 2, 2024
7ef11ad
Add support for C/C++ modules
STREGA Dec 5, 2024
3400681
Fix deprecation
STREGA Dec 5, 2024
40d706f
Link compiled Clang libraries
STREGA Dec 5, 2024
1002f1a
Continue Add support for C/C++ modules
STREGA Dec 6, 2024
7000f69
Remove unused var
STREGA Dec 6, 2024
14e885d
Use Task
STREGA Dec 6, 2024
93a99ac
Remove explicit cxx language mode
STREGA Dec 10, 2024
9294bd3
Remove debug symbols from pdx
STREGA Dec 10, 2024
3691abc
Verify file exists first
STREGA Dec 10, 2024
02825fa
Fix flag order
STREGA Dec 10, 2024
924e684
Increase output clarity
STREGA Dec 10, 2024
f54bbfb
Remove trailing slash
STREGA Dec 10, 2024
88efbcd
Remove tmp debug output
STREGA Dec 10, 2024
196db71
Revert fix flag order
STREGA Dec 10, 2024
f15263f
Add output note
STREGA Dec 10, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
95 changes: 59 additions & 36 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -1,16 +1,7 @@
// swift-tools-version: 5.10
// swift-tools-version: 6.0

import PackageDescription

let gccIncludePrefix =
"/usr/local/playdate/gcc-arm-none-eabi-9-2019-q4-major/lib/gcc/arm-none-eabi/9.2.1"

let playdateSDKPath: String = if let path = Context.environment["PLAYDATE_SDK_PATH"] {
path
} else {
"\(Context.environment["HOME"]!)/Developer/PlaydateSDK/"
}

let package = Package(
name: "PlaydateKit",
platforms: [.macOS(.v14)],
Expand All @@ -19,32 +10,64 @@ let package = Package(
.plugin(name: "PDCPlugin", targets: ["PDCPlugin"])
],
targets: [
.target(name: "PlaydateKit", dependencies: ["CPlaydate"], swiftSettings: [
.enableExperimentalFeature("Embedded"),
.unsafeFlags([
"-Xfrontend", "-disable-objc-interop",
"-Xfrontend", "-disable-stack-protector",
"-Xfrontend", "-function-sections",
"-Xfrontend", "-gline-tables-only",
"-Xcc", "-DTARGET_EXTENSION",
"-Xcc", "-I", "-Xcc", "\(gccIncludePrefix)/include",
"-Xcc", "-I", "-Xcc", "\(gccIncludePrefix)/include-fixed",
"-Xcc", "-I", "-Xcc", "\(gccIncludePrefix)/../../../../arm-none-eabi/include",
"-I", "\(playdateSDKPath)/C_API"
]),
]),
.target(name: "CPlaydate", cSettings: [
.unsafeFlags([
"-DTARGET_EXTENSION",
"-I", "\(gccIncludePrefix)/include",
"-I", "\(gccIncludePrefix)/include-fixed",
"-I", "\(gccIncludePrefix)/../../../../arm-none-eabi/include",
"-I", "\(playdateSDKPath)/C_API"
])
]),
.target(
name: "PlaydateKit",
dependencies: ["CPlaydate", "SwiftUnicodeDataTables"],
swiftSettings: swiftSettings
),
.target(
name: "CPlaydate",
cSettings: [
.unsafeFlags([
"-DTARGET_EXTENSION",
"-I", "\(gccIncludePrefix)/include",
"-I", "\(gccIncludePrefix)/include-fixed",
"-I", "\(gccIncludePrefix)/../../../../arm-none-eabi/include",
"-I", "\(playdateSDKPath)/C_API"
])
]
),
.target(
name: "SwiftUnicodeDataTables",
cxxSettings: [
.define("SWIFT_STDLIB_ENABLE_UNICODE_DATA")
]
),
.plugin(
name: "PDCPlugin",
capability: .command(intent: .custom(verb: "pdc", description: "Runs the Playdate compiler"))
)
]
capability: .command(intent:
.custom(verb: "pdc", description: "Runs the Playdate compiler")
)
),
],
swiftLanguageModes: [.v6]
)


// MARK: - Helper Variables
// note: These must be computed variables when beneath the `let package =` declaration.

var swiftSettings: [SwiftSetting] {[
.enableExperimentalFeature("Embedded"),
.unsafeFlags([
"-whole-module-optimization",
"-Xfrontend", "-disable-objc-interop",
"-Xfrontend", "-disable-stack-protector",
"-Xfrontend", "-function-sections",
"-Xfrontend", "-gline-tables-only",
"-Xcc", "-DTARGET_EXTENSION",
"-Xcc", "-I", "-Xcc", "\(gccIncludePrefix)/include",
"-Xcc", "-I", "-Xcc", "\(gccIncludePrefix)/include-fixed",
"-Xcc", "-I", "-Xcc", "\(gccIncludePrefix)/../../../../arm-none-eabi/include",
"-I", "\(playdateSDKPath)/C_API"
]),
]}
var gccIncludePrefix: String {
"/usr/local/playdate/gcc-arm-none-eabi-9-2019-q4-major/lib/gcc/arm-none-eabi/9.2.1"
}
var playdateSDKPath: String {
if let path = Context.environment["PLAYDATE_SDK_PATH"] {
return path
}
return "\(Context.environment["HOME"]!)/Developer/PlaydateSDK/"
}
Loading
Loading