You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: en/02_Development_environment.adoc
+28-9Lines changed: 28 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -445,15 +445,20 @@ The SDK version for MacOS internally uses link:https://github.com/KhronosGroup/M
445
445
There is no native support for Vulkan on MacOS, so what MoltenVK does is actually act as a layer that translates Vulkan API calls to Apple's Metal graphics framework.
446
446
With this you can take advantage of debugging and performance benefits of Apple's Metal framework.
447
447
448
-
After downloading it, simply extract the contents to a folder of your choice (keep in mind you will need to reference it when creating your projects on Xcode).
449
-
Inside the extracted folder, in the `Applications` folder you should have some executable files that will run a few demos using the SDK.
448
+
After downloading the installer for MacOS, double-click the installer and follow the prompts. Keep a note of the installation location during the "Installation Folder" step. You will need to reference it when creating your projects in Xcode.
449
+
450
+
image::/images/sdk_install_mac.png[]
451
+
452
+
**Note**: In this tutorial, `vulkansdk` will refer to the path where you intalled the VulkanSDK.
453
+
454
+
Within the `vulkansdk/Applications` folder you should have some executable files that will run a few demos using the SDK.
450
455
Run the `vkcube` executable and you will see the following:
451
456
452
457
image::/images/cube_demo_mac.png[]
453
458
454
459
=== GLFW
455
460
456
-
As mentioned before, Vulkan by itself is a platform agnostic API and does not include tools for creation a window to display the rendered results.
461
+
As mentioned before, Vulkan by itself is a platform agnostic API and does not include tools for creating a window to display the rendered results.
457
462
We'll use the https://www.glfw.org/[GLFW library] to create a window, which supports Windows, Linux and MacOS.
458
463
There are other libraries available for this purpose, like https://www.libsdl.org/[SDL], but the advantage of GLFW is that it also abstracts away some of the other platform-specific things in Vulkan besides just window creation.
459
464
@@ -536,11 +541,23 @@ Keep in mind you are not required to understand all this code is doing yet, we a
536
541
537
542
Xcode should already be showing some errors such as libraries it cannot find.
538
543
We will now start configuring the project to get rid of those errors.
544
+
545
+
To do this, you will need the install location of glfw and glm. The default homebrew folder varies if you are on an Intel Mac `/usr/local` or Apple Silicon Mac `/opt/homebrew`. You can determine your homebrew install location using `--prefix`:
546
+
547
+
[,bash]
548
+
----
549
+
brew --prefix
550
+
----
551
+
539
552
On the _Project Navigator_ panel select your project.
540
553
Open the _Build Settings_ tab and then:
541
554
542
-
* Find the *Header Search Paths* field and add a link to `/usr/local/include` (this is where Homebrew installs headers, so the glm and glfw3 header files should be there) and a link to `vulkansdk/macOS/include` for the Vulkan headers.
543
-
* Find the *Library Search Paths* field and add a link to `/usr/local/lib` (again, this is where Homebrew installs libraries, so the glm and glfw3 lib files should be there) and a link to `vulkansdk/macOS/lib`.
555
+
* Find the *Header Search Paths* field.
556
+
- Add a link to `/opt/homebrew/include` (or `/usr/local/include` for Intel Mac). The glm and glfw3 header files should be in this directory.
557
+
- Add a link to `vulkansdk/macOS/include` for the Vulkan headers.
558
+
* Find the *Library Search Paths* field.
559
+
- Add a link to `/opt/homebrew/lib` (again, `/usr/local/lib` for Intel Mac)
560
+
- Add a link to `vulkansdk/macOS/lib`.
544
561
545
562
It should look like so (obviously, paths will be different depending on where you placed on your files):
Now, in the _Build Phases_ tab, on *Link Binary With Libraries* we will add both the `glfw3` and the `vulkan` frameworks.
550
567
To make things easier we will be adding the dynamic libraries in the project (you can check the documentation of these libraries if you want to use the static frameworks).
551
568
552
-
* For glfw open the folder `/usr/local/lib` and there you will find a file name like `libglfw.3.x.dylib` ("x" is the library's version number, it might be different depending on when you downloaded the package from Homebrew).
553
-
Simply drag that file to the Linked Frameworks and Libraries tab on Xcode.
569
+
* For glfw open the folder `/opt/homebrew/lib` and there you will find a file name like `libglfw.3.x.dylib` ("x" is the library's version number, it might be different depending on when you downloaded the package from Homebrew).
570
+
Simply drag that file to the Link Binary With Libraries section on Xcode.
554
571
* For vulkan, go to `vulkansdk/macOS/lib`.
555
-
Do the same for the both files `libvulkan.1.dylib` and `libvulkan.1.x.xx.dylib` (where "x" will be the version number of the the SDK you downloaded).
572
+
Once open in Finder, look for `libvulkan.1.dylib` and `libvulkan.1.x.xxx.dylib` (where "x" will be the version number of the the SDK you downloaded). Select both files and drag them together into the Link Binary With Libraries section as well.
573
+
574
+
*Note:* If you drag the vulkan files in separately, the dynamic libraries may be incorrectly associated at runtime.
556
575
557
576
After adding those libraries, in the same tab on *Copy Files* change `Destination` to "Frameworks", clear the subpath and deselect "Copy only when installing".
558
577
Click on the "+" sign and add all those three frameworks here aswell.
@@ -567,7 +586,7 @@ On Xcode toolbar go to `Product` > `Scheme` > `+Edit Scheme...+`, and in the `Ar
0 commit comments