Skip to content

Commit

Permalink
Merge pull request #147 from tishin/macos-linker-settings
Browse files Browse the repository at this point in the history
Adjust linker settings since dynamic_lookup is macOS-specific
  • Loading branch information
migueldeicaza authored Oct 2, 2023
2 parents ace14dc + 2680f3f commit c416b4e
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@
import PackageDescription
import CompilerPluginSupport

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

let package = Package(
name: "SwiftGodot",
platforms: [
Expand Down Expand Up @@ -61,12 +69,8 @@ let package = Package(
name: "SwiftGodot",
dependencies: ["GDExtension"],
swiftSettings: [.unsafeFlags (["-suppress-warnings"])],
linkerSettings: [
.unsafeFlags (
["-Xlinker", "-undefined",
"-Xlinker", "dynamic_lookup",
])
], plugins: ["CodeGeneratorPlugin"]),
linkerSettings: linkerSettings,
plugins: ["CodeGeneratorPlugin"]),

// These are macros that can be used by third parties to simplify their
// SwiftGodot development experience, these are used at compile time by
Expand All @@ -88,10 +92,7 @@ let package = Package(
name: "SimpleExtension",
dependencies: ["SwiftGodotMacros"],
swiftSettings: [.unsafeFlags (["-suppress-warnings"])],
linkerSettings: [
.unsafeFlags (
["-Xlinker", "-undefined",
"-Xlinker", "dynamic_lookup"])]),
linkerSettings: linkerSettings),
// Idea: -mark_dead_strippable_dylib
.testTarget(name: "SwiftGodotMacroTests",
dependencies: [
Expand Down

0 comments on commit c416b4e

Please sign in to comment.