diff --git a/Package.swift b/Package.swift index 268fd77..c0526e7 100644 --- a/Package.swift +++ b/Package.swift @@ -13,17 +13,31 @@ let package = Package( .target( name: "PlaydateKit", dependencies: ["CPlaydate", "SwiftUnicodeDataTables"], - swiftSettings: swiftSettings + swiftSettings: [ + .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", "/usr/local/playdate/gcc-arm-none-eabi-9-2019-q4-major/lib/gcc/arm-none-eabi/9.2.1/include", + "-Xcc", "-I", "-Xcc", "/usr/local/playdate/gcc-arm-none-eabi-9-2019-q4-major/lib/gcc/arm-none-eabi/9.2.1/include-fixed", + "-Xcc", "-I", "-Xcc", "/usr/local/playdate/gcc-arm-none-eabi-9-2019-q4-major/lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/include", + "-I", "\(Context.environment["PLAYDATE_SDK_PATH"] ?? "\(Context.environment["HOME"]!)/Developer/PlaydateSDK/")/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" + "-I", "/usr/local/playdate/gcc-arm-none-eabi-9-2019-q4-major/lib/gcc/arm-none-eabi/9.2.1/include", + "-I", "/usr/local/playdate/gcc-arm-none-eabi-9-2019-q4-major/lib/gcc/arm-none-eabi/9.2.1/include-fixed", + "-I", "/usr/local/playdate/gcc-arm-none-eabi-9-2019-q4-major/lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/include", + "-I", "\(Context.environment["PLAYDATE_SDK_PATH"] ?? "\(Context.environment["HOME"]!)/Developer/PlaydateSDK/")/C_API" ]) ] ), @@ -42,33 +56,3 @@ let package = Package( ], 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/" -}