Skip to content

Commit 9520fc2

Browse files
Issue-58 : MacOS VulkanSDK Install Instructions. (#59)
* update macos install language * update macos image xcode paths and sdk install * try reverting spaces * try reverting spaces * try reverting spaces * try reverting spaces * try reverting spaces * try reverting spaces
1 parent 680b1e9 commit 9520fc2

File tree

3 files changed

+28
-9
lines changed

3 files changed

+28
-9
lines changed

en/02_Development_environment.adoc

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -445,15 +445,20 @@ The SDK version for MacOS internally uses link:https://github.com/KhronosGroup/M
445445
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.
446446
With this you can take advantage of debugging and performance benefits of Apple's Metal framework.
447447

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.
450455
Run the `vkcube` executable and you will see the following:
451456

452457
image::/images/cube_demo_mac.png[]
453458

454459
=== GLFW
455460

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.
457462
We'll use the https://www.glfw.org/[GLFW library] to create a window, which supports Windows, Linux and MacOS.
458463
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.
459464

@@ -536,11 +541,23 @@ Keep in mind you are not required to understand all this code is doing yet, we a
536541

537542
Xcode should already be showing some errors such as libraries it cannot find.
538543
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+
539552
On the _Project Navigator_ panel select your project.
540553
Open the _Build Settings_ tab and then:
541554

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`.
544561

545562
It should look like so (obviously, paths will be different depending on where you placed on your files):
546563

@@ -549,10 +566,12 @@ image::/images/xcode_paths.png[]
549566
Now, in the _Build Phases_ tab, on *Link Binary With Libraries* we will add both the `glfw3` and the `vulkan` frameworks.
550567
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).
551568

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.
554571
* 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.
556575

557576
After adding those libraries, in the same tab on *Copy Files* change `Destination` to "Frameworks", clear the subpath and deselect "Copy only when installing".
558577
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
567586
* VK_ICD_FILENAMES = `vulkansdk/macOS/share/vulkan/icd.d/MoltenVK_icd.json`
568587
* VK_LAYER_PATH = `vulkansdk/macOS/share/vulkan/explicit_layer.d`
569588

570-
It should look like so:
589+
Uncheck 'shared'. It should look like so:
571590

572591
image::/images/xcode_variables.png[]
573592

images/sdk_install_mac.png

122 KB
Loading

images/xcode_paths.png

162 KB
Loading

0 commit comments

Comments
 (0)