henrybetts / swift-webgpu

Swift bindings for WebGPU
MIT License
89 stars 4 forks source link

Integration problem #6

Closed SpectralDragon closed 4 months ago

SpectralDragon commented 1 year ago

Hi! Thanks for that amazing work! I want to use this library in my project (SPM), but it looks like currently I should run it only under terminal. Can you explain to me how to link this package to a spm project and run it under Xcode? I know that for vulkan I should create a pkg-config file with all header search paths and linker flags, will it work? Also I’ve no idea how to build lib for different architectures (ios/macos/window/linux).

Thanks!

henrybetts commented 1 year ago

I haven't actually had much success with getting Xcode / SPM integration to work nicely.

Currently you have to manually provide the include paths for the dawn headers, as well as the path to dawn.json (for source code generation). This is possible through the command line, but unfortunately I haven't yet found away to set these when building within Xcode (which has been frustrating...).

A pkg-config file could be a partial solution - I'll have a play with that to see if I can get anything working.

SpectralDragon commented 1 year ago

I used this article to run Vulkan using SPM with pkg-config:

original (currently doesn't load for me) - https://blog.spencerkohan.com/vulkan-swift-linking-moltenvk-using-swift-package-manager

webarch - https://web.archive.org/web/20220823104733/https://blog.spencerkohan.com/vulkan-swift-linking-moltenvk-using-swift-package-manager