* Fix clang Objective-C++ flags for macOS command line builds * Fix getAssetPath() and getShaderBasePath() for macOS command line builds * Protect debugUtilsMessageCallback() from failing when pMessageIdName is NULL * Fix a few clang function override and mismatched type warnings * Fix validation layer warnings on exit for computeraytracing example * Fix regression in text visibility toggle for textOverlay example * Support VK_USE_PLATFORM_METAL_EXT vs. deprecated VK_USE_PLATFORM_MACOS_MVK / DVK_USE_PLATFORM_IOS_MVK * Check dynamic state features before enabling capabilities in dynamicstate example * Fix vkCmdDraw() vertexCount argument (PARTICLE_COUNT) in particlesystem example * Update examples list and restore benchmarking script (to top level) * Fix validation warning in descriptorindexing example * Fix device max recursion depth validation warnings in ray tracing examples * Fix OpenMP build settings for texture3d example on all platforms * Update and simplify build instructions for macOS * Update CI script with correct library path for libomp on macOS x86_64 * Update CI scipt to install libomp prior to macOS builds * Trying one more time to get the CI script working for macOS libomp * Fix vertexCount argument using calculated size in particlesystem example * Fix combined image descriptor offset calculation in descriptorbuffer example * macOS: Support non-system level Vulkan SDK installs, with fallback to MoltenVK library
74 lines
3.5 KiB
Markdown
74 lines
3.5 KiB
Markdown
# Building
|
|
|
|
The repository contains everything required to compile and build the examples on Windows, Linux, Android and MacOS using a C++ compiler that supports at least C++11. All required dependencies are included. The project uses [CMake](https://cmake.org/) as the build system.
|
|
|
|
## General CMake options
|
|
|
|
### Asset path setup
|
|
|
|
Asset (and shader) paths used by the samples can be adjusted using CMake options. By default, paths are absolute and are based on the top level of the current CMake source tree. The following arguments can be used to adjust this:
|
|
|
|
- ```RESOURCE_INSTALL_DIR```: Set an absolute path for assets and shaders to which they are installed and from which they are loaded
|
|
- ```USE_RELATIVE_ASSET_PATH```: Use a fixed relative (to the binary) path for loading assets and shaders
|
|
|
|
## Platform specific build instructions
|
|
|
|
### <img src="./images/windowslogo.png" alt="" height="32px"> Windows
|
|
Use the provided CMakeLists.txt with [CMake](https://cmake.org) to generate a build configuration for your favorite IDE or compiler, e.g.:
|
|
|
|
```
|
|
cmake -G "Visual Studio 16 2019" -A x64
|
|
```
|
|
|
|
### <img src="./images/linuxlogo.png" alt="" height="32px"> Linux
|
|
|
|
Use the provided CMakeLists.txt with [CMake](https://cmake.org) to generate a build configuration for your favorite IDE or compiler.
|
|
|
|
##### [Window system integration](https://www.khronos.org/registry/vulkan/specs/1.0-wsi_extensions/html/vkspec.html#wsi)
|
|
- **XCB**: Default WSI (if no cmake option is specified)
|
|
- **Wayland**: Use cmake option ```USE_WAYLAND_WSI``` (```-DUSE_WAYLAND_WSI=ON```)
|
|
- **DirectFB**: Use cmake option ```USE_DIRECTFB_WSI``` (```-DUSE_DIRECTFB_WSI=ON```)
|
|
- **DirectToDisplay**: Use cmake option ```USE_D2D_WSI``` (```-DUSE_D2D_WSI=ON```)
|
|
|
|
### <img src="./images/androidlogo.png" alt="" height="32px"> [Android](android/)
|
|
|
|
Building on Android is done using the [Gradle Build Tool](https://gradle.org/):
|
|
|
|
If you want to build it through command line, set Android SDK/NDK by environment variable `ANDROID_SDK_ROOT`/`ANDROID_NDK_HOME`.
|
|
|
|
On Linux execute:
|
|
|
|
```
|
|
cd android
|
|
./gradlew assembleDebug
|
|
```
|
|
This will download gradle locally, build all samples and output the apks to ```android/examples/bin```.
|
|
|
|
On Windows execute ```gradlew.bat assembleDebug```.
|
|
|
|
If you want to build and install on a connected device or emulator image, run ```gradle installDebug``` instead.
|
|
|
|
If you want to build it through [Android Studio](https://developer.android.com/studio), open project folder ```android``` in Android Studio.
|
|
|
|
### <img src="./images/applelogo.png" alt="" height="32px"> macOS and iOS
|
|
|
|
**Note:** Running these examples on macOS and iOS requires [**MoltenVK**](https://github.com/KhronosGroup/MoltenVK) and a device that supports the *Metal* api.
|
|
|
|
#### macOS
|
|
Download the most recent Vulkan SDK using:
|
|
```curl -O https://sdk.lunarg.com/sdk/download/latest/mac/vulkan_sdk.dmg```
|
|
|
|
Open **vulkan_sdk.dmg** and install the Vulkan SDK with *System Global Installation* selected.
|
|
|
|
Install **libomp** from [homebrew](https://brew.sh) using:
|
|
```brew install libomp```
|
|
|
|
Find the **libomp** path prefix using:
|
|
```brew --prefix libomp```
|
|
|
|
Use the **libomp** path prefix to adjust the path for ```-DOpenMP_omp_LIBRARY=``` in the cmake command below.
|
|
|
|
Use [CMake](https://cmake.org) to generate a build configuration for Xcode or your preferred build method (e.g. Unix Makefiles or Ninja).
|
|
|
|
Example of cmake generating for Xcode with **libomp** path defined for homebrew on Apple Silicon:
|
|
```cmake -G "Xcode" -DOpenMP_omp_LIBRARY=/opt/homebrew/opt/libomp/lib/libomp.dylib```
|