cengiz-pz / godot-ios-plugin-template

MIT License
1 stars 0 forks source link

How to Compile Swift with Scons? #1

Open BraveEvidence opened 4 weeks ago

BraveEvidence commented 4 weeks ago

I have cloned your repo and made the necessary changes like changing the plugin name, I have added a Swift file, and calling the swift file from objective-c. Here is my updated repo. I have removed the Godot source code as it was too big for Github. When I run scons target=release_debug arch=arm64 target_name=arithematic version=4.2 I get error saying

arithematic/arithematic_implementation.mm:10:9:{10:9-10:30}: fatal error: 'arithematic-Swift.h' file not found [1]
 #import "arithematic-Swift.h"
         ^~~~~~~~~~~~~~~~~~~~~
1 error generated.

I have added my Swift file to SConstruct like this

sources.append(Glob(f'{plugin_name}/**/*.swift'))

How do I make scons aware about the Bridging-Header. I also tried looking into your in-app-review-plugin where you use a Swift file but I could not find SConstruct for it

Any help would be appreciated

cengiz-pz commented 2 weeks ago

I have removed the Godot source code as it was too big for Github.

Godot repo is configured as a git submodule, so it shouldn't be a problem.

How do I make scons aware about the Bridging-Header. I also tried looking into your in-app-review-plugin where you use a Swift file but I could not find SConstruct for it

The in-app-review-plugin doesn't use scons; it uses Xcode project settings and xcodebuild CLI to build the plugin. Whereas, this repo uses scons, but is not configured to work with Swift. I haven't yet had the time to look into configuring scons for a Swift-based plugin.

BraveEvidence commented 2 weeks ago

Thanks for your reply, I did try it but faced issue. Can you quickly go through this and check if you're able to quickly figure out what am I doing wrong