Setting up Vulkan on MacOS
Setting up Vulkan development environment on MacOS using Xcode.
Download the latest SDK from the LunarG website
Extract the downloaded file and install SDK. Remember your installed path.
Install GLFW
1
brew install glfw
Install GLM
1
brew install glm
Configure Xcode
Start a new project and choose Command Line Tool. For the language, select C++. Add the following code example to main.cpp
.
1 |
|
You will see a lot of error messages at the beginning. We need to configure the project. Select the project and go to Build Settings. Find Header Search Paths and Library Search Paths.
- For Header Search Paths, add links:
/usr/local/include [your_vk_location]/macOS/include
- For Library Search Paths, add links:
/usr/local/lib [your_vk_location]/macOS/lib
Then go to Build Phases tab and add glfw3
and vulkan
dynamic libraries.
After adding these libraries, in the same tab, open Copy Files, change Destination to “Frameworks”, clear the subpath and uncheck “Copy only when installing”. Click “+” and add all the three libraries here.
- Run demo
Run the project and you should see a Vulkan window displaying on your screen.
Reference
Setting up Vulkan on MacOS