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

Remove unsafeFlags from Package.swift #177

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
98 changes: 47 additions & 51 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -1,33 +1,27 @@
// swift-tools-version: 5.9
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription
import CompilerPluginSupport

var linkerSettings: [LinkerSetting] = []
#if os(macOS)
linkerSettings.append(.unsafeFlags([
"-Xlinker", "-undefined",
"-Xlinker", "dynamic_lookup",
]))
#endif
import PackageDescription

// Products define the executables and libraries a package produces, and make them visible to other packages.
var products: [Product] = [
.library(
name: "SwiftGodot",
type: .dynamic,
targets: ["SwiftGodot"]),
targets: ["SwiftGodot"]
),
.plugin(name: "CodeGeneratorPlugin", targets: ["CodeGeneratorPlugin"]),
]

// Macros aren't supported on Windows yet and this sample uses them
#if !os(Windows)
products.append(
.library(
name: "SimpleExtension",
type: .dynamic,
targets: ["SimpleExtension"]))
products.append(
.library(
name: "SimpleExtension",
type: .dynamic,
targets: ["SimpleExtension"]
))
#endif

var targets: [Target] = [
Expand All @@ -37,16 +31,17 @@ var targets: [Target] = [
name: "Generator",
dependencies: ["XMLCoder"],
path: "Generator",
exclude: ["README.md"]),

exclude: ["README.md"]
),

// This is a build-time plugin that invokes the generator and produces
// the bindings that are compiled into SwiftGodot
.plugin(
name: "CodeGeneratorPlugin",
capability: .buildTool(),
dependencies: ["Generator"]
),
.plugin(
name: "CodeGeneratorPlugin",
capability: .buildTool(),
dependencies: ["Generator"]
),

// This allows the Swift code to call into the Godot bridge API (GDExtension)
.target(
name: "GDExtension"),
Expand All @@ -56,31 +51,31 @@ var swiftGodotPlugins: [Target.PluginUsage] = ["CodeGeneratorPlugin"]

// Macros aren't supported on Windows yet
#if !os(Windows)
targets.append(contentsOf: [
// These are macros that can be used by third parties to simplify their
// SwiftGodot development experience, these are used at compile time by
// third party projects
.macro(name: "SwiftGodotMacroLibrary",
dependencies: [
.product(name: "SwiftSyntaxMacros", package: "swift-syntax"),
.product(name: "SwiftSyntax", package: "swift-syntax"),
.product(name: "SwiftCompilerPlugin", package: "swift-syntax")
]),
// This contains sample code showing how to use the SwiftGodot API
.target(
name: "SimpleExtension",
dependencies: ["SwiftGodot"],
exclude: ["SwiftSprite.gdextension", "README.md"],
linkerSettings: linkerSettings),
// Idea: -mark_dead_strippable_dylib
.testTarget(name: "SwiftGodotMacroTests",
dependencies: [
"SwiftGodotMacroLibrary",
"SwiftGodot",
.product(name: "SwiftSyntaxMacrosTestSupport", package: "swift-syntax")
])
])
swiftGodotPlugins.append("SwiftGodotMacroLibrary")
targets.append(contentsOf: [
// These are macros that can be used by third parties to simplify their
// SwiftGodot development experience, these are used at compile time by
// third party projects
.macro(name: "SwiftGodotMacroLibrary",
dependencies: [
.product(name: "SwiftSyntaxMacros", package: "swift-syntax"),
.product(name: "SwiftSyntax", package: "swift-syntax"),
.product(name: "SwiftCompilerPlugin", package: "swift-syntax"),
]),
// This contains sample code showing how to use the SwiftGodot API
.target(
name: "SimpleExtension",
dependencies: ["SwiftGodot"],
exclude: ["SwiftSprite.gdextension", "README.md"]
),
// Idea: -mark_dead_strippable_dylib
.testTarget(name: "SwiftGodotMacroTests",
dependencies: [
"SwiftGodotMacroLibrary",
"SwiftGodot",
.product(name: "SwiftSyntaxMacrosTestSupport", package: "swift-syntax"),
]),
])
swiftGodotPlugins.append("SwiftGodotMacroLibrary")
#endif

targets.append(
Expand All @@ -91,14 +86,15 @@ targets.append(
name: "SwiftGodot",
dependencies: ["GDExtension"],
exclude: ["extension_api.json"],
linkerSettings: linkerSettings,
plugins: swiftGodotPlugins))
plugins: swiftGodotPlugins
)
)

let package = Package(
name: "SwiftGodot",
platforms: [
.macOS(.v13),
.iOS ("16.0")
.iOS("16.0"),
],
products: products,
dependencies: [
Expand Down
8 changes: 1 addition & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,8 @@ let package = Package(
targets: [
.target(
name: "MyFirstGame",
dependencies: ["SwiftGodot"],
swiftSettings: [.unsafeFlags(["-suppress-warnings"])],
linkerSettings: [.unsafeFlags(
["-Xlinker", "-undefined",
"-Xlinker", "dynamic_lookup"]
)]
dependencies: ["SwiftGodot"]
)

]
)
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,7 @@ let package = Package(
name: "SimpleRunnerDriver",
dependencies: [
"SwiftGodot",
],
swiftSettings: [.unsafeFlags(["-suppress-warnings"])],
linkerSettings: [.unsafeFlags(
["-Xlinker", "-undefined",
"-Xlinker", "dynamic_lookup"]
)]
]
),
.testTarget(
name: "SimpleRunnerDriverTests",
Expand Down