-
-
Notifications
You must be signed in to change notification settings - Fork 1
Description
% xcodebuild -version
Xcode 14.2
Build version 14C18
A couple of build issues.
Firstly, assumption that Vulkan is installed in /usr/local
but brew
installs them into /opt/homebrew
. This is probably related to the fact that the setup-vulkan-macOS
Makefile target (in SwiftVulkan) doesn't work because the apenngrace/vulkan/vulkan-sdk
cask cannot be found. Instead I used the regular Homebrew install, which didn't even seem to compile (not all headers were installed, had to hand-edit vulkan_core.h
to remove H264/5 dependencies).
Then I ran into an issue where SDL_KeyCode
couldn't be used as a dictionary key in virtualKeyMap
.
diff --git a/Sources/FirebladePAL/Platform/SDL/SDLKeys.swift b/Sources/FirebladePAL/Platform/SDL/SDLKeys.swift
index ee13545..717f611 100644
--- a/Sources/FirebladePAL/Platform/SDL/SDLKeys.swift
+++ b/Sources/FirebladePAL/Platform/SDL/SDLKeys.swift
@@ -9,6 +9,8 @@
@_implementationOnly import SDL2
+ extension SDL_KeyCode: Hashable {}
+
extension KeyCode {
public init?(scancode: UInt) {
guard let keyCode = Self.physicalKeyMap[SDL_Scancode(rawValue: SDL_Scancode.RawValue(scancode))] else {
fixed it.
Then building a package that depends on it, I got:
Building for debugging...
ld: warning: Could not find or use auto-linked library 'vulkan'
Undefined symbols for architecture arm64:
"_vkCreateInstance", referenced from:
_$s12FirebladePAL19SDLVLKWindowSurfaceC14createInstance6layers10extensionss13OpaquePointerVSaySSG_AItKFZAHSRySPys4Int8VGSgGKXEfU_AhNKXEfU_ in SDLVLKWindowSurface.swift.o
"_vkDestroySurfaceKHR", referenced from:
_$s12FirebladePAL19SDLVLKWindowSurfaceC7destroyyyF in SDLVLKWindowSurface.swift.o
ld: symbol(s) not found for architecture arm64
ld: warning: Could not find or use auto-linked library 'vulkan'
Undefined symbols for architecture arm64:
"_vkCreateInstance", referenced from:
_$s12FirebladePAL19SDLVLKWindowSurfaceC14createInstance6layers10extensionss13OpaquePointerVSaySSG_AItKFZAHSRySPys4Int8VGSgGKXEfU_AhNKXEfU_ in SDLVLKWindowSurface.swift.o
"_vkDestroySurfaceKHR", referenced from:
_$s12FirebladePAL19SDLVLKWindowSurfaceC7destroyyyF in SDLVLKWindowSurface.swift.o
ld: symbol(s) not found for architecture arm64
even after sym-linking libvulkan.dylib
from /opt/homebrew/lib
into /usr/local/lib
.
diff --git a/Package.swift b/Package.swift
index 16ae1a4..3654af0 100644
--- a/Package.swift
+++ b/Package.swift
@@ -122,7 +122,8 @@ let package = Package(
.vulkan,
.nfd,
],
- swiftSettings: swiftSettings
+ swiftSettings: swiftSettings,
+ linkerSettings: [.unsafeFlags(["-L/opt/homebrew/lib","-lvulkan"])]
),
.target(
name: "CPUBackendDemoApp",
fixed that.
Finally, I also needed to make the SDL dependency on SDL
instead of SDL2
.
After all of this, it builds and tests pass, although VulkanBackendDemoApp
does trap with:
FirebladePAL/SDLWindow.swift:79: Fatal error: vkInstanceCreationFailed(__C.VkResult(rawValue: -6))