migueldeicaza / SwiftGodotKit

Embed Godot into Swift apps
229 stars 28 forks source link

Linux support #24

Closed pcbeard closed 9 months ago

pcbeard commented 9 months ago

Provides a way to build SwiftGodotKit applications on Linux. Tested on SteamDeck.

pcbeard commented 9 months ago

If you want to try this out, here are the build instructions:

On a SteamDeck (or probably any Linux system that supports Godot):

  1. Create a distrobox container to install a swift toolchain:
# create container
DBX_CONTAINER_HOME_PREFIX="/home/deck/dbx" distrobox create --image swift --name swift

# enter container
distrobox enter swift
  1. Install scons:
sudo apt install scons
  1. Pull and build my PR branch of libgodot:
git clone git@github.com:ARPGLTD/libgodot.git
git checkout Fix_godot_main
scons target=template_debug dev_build=yes library_type=shared_library debug_symbols=yes use_llvm=yes
cd bin
sudo cp libgodot.linuxbsd.template_debug.dev.x86_64.llvm.so /usr/lib
ln -s /usr/lib/libgodot.linuxbsd.template_debug.dev.x86_64.llvm.so /usr/lib/libgodot.so

Now that /usr/lib contains the shared libraries, you should be able to build this PR branch of SwiftGodotKit and run some example code.

migueldeicaza commented 9 months ago

Question, why do we need the Godot header files in this package?

I did not see any new calls to it.

pcbeard commented 9 months ago

Question, why do we need the Godot header files in this package?

These are the same header files included in the .xcframework, declaring C functions and types used by existing code in SwiftGodoKit.

migueldeicaza commented 9 months ago

Oh got it!

EstevanBR commented 8 months ago

I've been using this happily on two different ubuntu instances. Thank you for this PR. 🙏🏻