Building¶
This guide covers building VulkanW3DViewer from source.
Quick Build¶
The fastest way to build is using the provided build scripts:
Build Presets¶
The project uses CMake presets for different build configurations:
| Preset | Description | Output Directory |
|---|---|---|
debug |
Debug build with symbols, no optimization | build/debug/ |
release |
Optimized release build | build/release/ |
test |
Debug build with testing enabled | build/test/ |
Manual Build¶
If you prefer manual control over the build process:
Configure¶
# Debug build
cmake --preset debug
# Release build
cmake --preset release
# Test build
cmake --preset test
Build¶
# Build debug
cmake --build --preset debug
# Build release
cmake --build --preset release
# Build tests
cmake --build --preset test
Run¶
Running Tests¶
Build and run the test suite:
# Configure and build tests
cmake --preset test
cmake --build --preset test
# Run tests
ctest --preset test
Build Options¶
Compiler Flags¶
The project uses strict compiler settings:
-Werror- Treat warnings as errors-Wall -Wextra- Enable comprehensive warnings-std=c++20- C++20 standard
Shader Compilation¶
Shaders are automatically compiled to SPIR-V during the build process using glslc from the Vulkan SDK. The compiled shaders are embedded into the executable.
Troubleshooting¶
Common Issues¶
Vulkan SDK not found
Ensure the VULKAN_SDK environment variable is set:
Submodules not initialized
Initialize submodules if dependencies are missing:
Clean Build¶
If you encounter issues, try a clean build:
# Remove build directory
rm -rf build/
# Rebuild from scratch
cmake --preset release
cmake --build --preset release
IDE Integration¶
Visual Studio Code¶
- Install the CMake Tools extension
- Open the project folder
- Select the build preset from the CMake Tools panel
- Build using Ctrl+Shift+B
CLion¶
- Open the project folder
- CLion will auto-detect CMake configuration
- Select the desired preset from the build configuration dropdown
Next Steps¶
After building successfully, learn how to use the viewer!