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

pre-built SwiftGodot package not work #610

Open
waci11 opened this issue Nov 17, 2024 · 2 comments
Open

pre-built SwiftGodot package not work #610

waci11 opened this issue Nov 17, 2024 · 2 comments

Comments

@waci11
Copy link

waci11 commented Nov 17, 2024

I follow this guide:
https://migueldeicaza.github.io/SwiftGodotDocs/tutorials/swiftgodot/your-first-extension
But I am not do step3.

Instead of step 3 , I download the xcframework form:
https://github.com/migueldeicaza/SwiftGodot/releases/download/0.45/SwiftGodot.xcframework.zip
Then i copy it to my project root.

my package.swift:

import PackageDescription
let package = Package(
    name: "MyPlugin",
    platforms: [.iOS(.v15)],
    products: [
        .library(
            name: "MyPlugin",
            type: .dynamic,
            targets: ["MyPlugin"]),
    ],
    targets: [
        .binaryTarget(name:"SwiftGodot",path:"SwiftGodot.xcframework" ),
        .target(
            name: "MyPlugin",
            dependencies: ["SwiftGodot",],
            swiftSettings: [.unsafeFlags(["-suppress-warnings"])]
        ),
        
        .testTarget(
            name: "MyPluginTests",
            dependencies: ["MyPlugin"]),
    ]
)

but I got error :
External macro implementation type 'SwiftGodotMacroLibrary.GodotMacro' could not be found for macro 'Godot'
in

import SwiftGodot
@Godot
class ARcamera:Camera3D{}

and error :
External macro implementation type 'SwiftGodotMacroLibrary.InitSwiftExtensionMacro' could not be found for macro 'initSwiftExtension(cdecl:types:)'
in:

import SwiftGodot
#initSwiftExtension(cdecl: "swift_entry_point", types: [ARcamera.self])

then , I copy SwiftGodotMacroLibrary and SwiftGodotMacro to my project from SwiftGodotBinary(https://github.com/migueldeicaza/SwiftGodotBinary)
the error disappear , but get new error:No such module 'SwiftCompilerPlugin'

I want to build a IOS plugin ,but I am not good at programing , So I spent a lot of time repeatedly building and trying .
I think use the pre-built SwiftGodot package should be faster then source code .
But I couldn't find any helpful documentation or tutorials, and I can not successfully build it .
I hope someone can tell me where the problem is.

Mac OS 14.7.1 Xcode 15.4

@compufox
Copy link

you need to add the SwiftGodotBinary repo to your dependencies instead of adding it as a target.

let package = Package(
  name: "TestPlugin",
  products: [
    .library(name: "TestPlugin", type: .dynamic, targets: ["TestPlugin"])
  ],
  dependencies: [
    .package(url: "https://github.com/migueldeicaza/SwiftGodotBinary", from: "0.4.6")
  ],
  targets: [
    .target(
      name: "TestPlugin",
      dependencies: [
        .product(name: "SwiftGodot", package: "swiftgodotbinary")
      ]
    )
  ]
)

hope this helps!

@waci11
Copy link
Author

waci11 commented Nov 27, 2024

you need to add the SwiftGodotBinary repo to your dependencies instead of adding it as a target.

let package = Package(
  name: "TestPlugin",
  products: [
    .library(name: "TestPlugin", type: .dynamic, targets: ["TestPlugin"])
  ],
  dependencies: [
    .package(url: "https://github.com/migueldeicaza/SwiftGodotBinary", from: "0.4.6")
  ],
  targets: [
    .target(
      name: "TestPlugin",
      dependencies: [
        .product(name: "SwiftGodot", package: "swiftgodotbinary")
      ]
    )
  ]
)

hope this helps!

Thanks for your reply .
but it do not work for me .
The problem is the same as import "SwiftGodot.xcframework"" as binaryTarget

I download all package to local because my connect to GitHub is bad , the download in xcode is always failed .
so i change the code
from:
.package(url: "https://github.com/migueldeicaza/SwiftGodotBinary", from: "0.4.6")
to:
.package(path:“path/to/SwiftGodotBinay”)

i also download and copy "SwiftGodot.xcframework" to SwiftGodotBinay and change the code in SwiftGodotBinay/package.swift
from :

.binaryTarget(
            name: "SwiftGodot",
            url: "https://github.com/migueldeicaza/SwiftGodot/releases/download/0.46/SwiftGodot.xcframework.zip",
            checksum: "e75a1524390c118cbdd81bf6e21b3cd6cba0fd5ca8993964af6eb985dfebdebc"),

to :

.binaryTarget(
            name: "SwiftGodot",
            path:"SwiftGodot.xcframework" )

did i miss some step?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants