2018-03-28 15:09:29 +02:00
# Building
The repository contains everything required to compile and build the examples on Windows, Linux and Android using a C++ compiler that supports C++11. All required dependencies are included.
## <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.:
2022-06-04 22:57:28 +02:00
2018-03-28 15:09:29 +02:00
```
2022-06-04 22:57:28 +02:00
cmake -G "Visual Studio 16 2019" -A x64
2018-03-28 15:09:29 +02:00
```
## <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` ``)
2020-09-13 10:12:33 +02:00
- **DirectFB**: Use cmake option ```USE_DIRECTFB_WSI` `` (` ``-DUSE_DIRECTFB_WSI=ON` ``)
2018-03-28 15:09:29 +02:00
- **DirectToDisplay**: Use cmake option ```USE_D2D_WSI` `` (` ``-DUSE_D2D_WSI=ON` ``)
## <img src="./images/androidlogo.png" alt="" height="32px"> [Android](android/)
2020-11-26 07:34:43 +01:00
Building on Android is done using the [Gradle Build Tool ](https://gradle.org/ ):
2019-09-06 20:42:05 +02:00
2023-06-09 13:22:48 +08:00
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:
2023-04-18 11:27:19 +08:00
2019-09-06 20:42:05 +02:00
```
cd android
2020-11-26 07:34:43 +01:00
./gradlew assembleDebug
2019-09-06 20:42:05 +02:00
```
2023-06-09 13:22:48 +08:00
This will download gradle locally, build all samples and output the apks to ```android/examples/bin` ``.
2020-11-26 07:34:43 +01:00
2023-06-09 13:22:48 +08:00
On Windows execute ```gradlew.bat assembleDebug` ``.
2019-09-06 20:42:05 +02:00
If you want to build and install on a connected device or emulator image, run ```gradle installDebug` `` instead.
2018-03-28 15:09:29 +02:00
2023-06-09 13:22:48 +08:00
If you want to build it through [Android Studio ](https://developer.android.com/studio ), open project folder ```android` `` in Android Studio.
2023-04-18 11:27:19 +08:00
2018-03-28 15:09:29 +02:00
## <img src="./images/applelogo.png" alt="" height="32px"> [iOS and macOS](xcode/)
2020-09-12 03:19:28 +09:00
Building for *iOS* and *macOS* is done using the [examples ](xcode/examples.xcodeproj ) *Xcode* project found in the [xcode ](xcode ) directory. These examples use the [**MoltenVK** ](https://moltengl.com/moltenvk ) Vulkan driver to provide Vulkan support on *iOS* and *macOS* , and require an *iOS* or *macOS* device that supports *Metal* . Please see the [MoltenVK Examples readme ](xcode/README_MoltenVK_Examples.md ) for more info on acquiring **MoltenVK** and building and deploying the examples on *iOS* and *macOS* .
##### MacOS
2023-07-15 10:44:22 +01:00
Install Libomp with:
-brew install libomp
find the path
-brew --prefix libomp
use the path from the above command to populate the path in the -DOpenMP_C_FLAGS, -DOpenMP_omp_LIBRARY & -DOpenMP_CXX_FOUND statement below
2023-07-16 17:57:22 +01:00
Download Vulkan SDK and install it note the path as this will need to be configure in Xcode
curl -O https://sdk.lunarg.com/sdk/download/latest/mac/vulkan_sdk.dmg
Open vulkan_sdk.dmg and install Vulkan SDK
Navigate to the Vulkan SDK folder and run 'python install_vulkan.py'
2023-07-15 10:44:22 +01:00
2020-09-12 03:19:28 +09:00
Use the provided CMakeLists.txt with [CMake ](https://cmake.org ) to generate a build configuration for your favorite IDE or compiler, e.g.:
```
2023-07-16 17:57:22 +01:00
Example of cmake with libraries defined
cmake -G "Xcode" -DOpenMP_C_FLAGS=/usr/local/opt/libomp -DOpenMP_omp_LIBRARY=/usr/local/opt/libomp -DOpenMP_CXX_FOUND=/usr/local/opt/libomp
```
In Xcode configure the search path for the folder where the glm folder is in the Vulkan SDK