I've been trying to figure out how to use Swift and Metal without Xcode. I cannot figure out SwiftPM. I've tried everything I can think of, and am just going round in circles.
This is my (current) manifest (I've tried many variations):
// swift-tools-version: 6.0
import PackageDescription
let package = Package(
name: "BaseMetal",
platforms: [.macOS(.v14)],
products: [.executable(name: "BaseMetal", targets: ["BaseMetal"])],
targets: [
.executableTarget(name: "BaseMetal"),
.target(
name: "Shaders",
resources: [.process(".")]
),
]
)
My tree looks like this:
.
├── Package.swift
└── Sources
├── BaseMetal
│ ├── Main.swift
│ ├── Metalic.swift
│ └── Renderer.swift
└── Shaders
├── Canvas.metal
└── Shader.metal
The same error message comes up under various circumstances, but always when the paths are correct (oddly):
❯ swift run
error: 'basemetal': public headers ("include") directory path for 'Shaders' is invalid or not contained in the target
That error message also confused a few people (in the Apple Developer Forum), but they never got a response there.
Any pointers would be greatly appreciated (while I still have some hair). Thanks for taking the time to look at it.