bvle-voxels/CMakeLists.txt
Samuel Bouchet 5f346bb14a Phase 2: GPU-driven voxel rendering pipeline
Mega-buffer architecture replacing per-chunk GPU buffers:
- Single StructuredBuffer<PackedQuad> for all chunks (2M quads, 16 MB)
- StructuredBuffer<GPUChunkInfo> with per-chunk metadata (position, quad offsets, face groups)
- VS reads chunk info via push constants (b999) for driver-safe chunk indexing
- CPU frustum culling with wi::primitive::Frustum + AABB per chunk
- Quads sorted by face direction in greedy mesher (faceOffsets/faceCounts)
- GPU frustum + backface cull compute shader (voxelCullCS.hlsl)
- GPU binary mesher compute shader baseline (voxelMeshCS.hlsl)
- Indirect draw buffers and timestamp query infrastructure
- README with build instructions and project architecture
2026-03-25 14:24:05 +01:00

51 lines
2.2 KiB
CMake

cmake_minimum_required(VERSION 3.19)
project(BVLEVoxels LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
# Wicked Engine options - disable what we don't need
set(WICKED_EDITOR OFF CACHE BOOL "" FORCE)
set(WICKED_TESTS OFF CACHE BOOL "" FORCE)
set(WICKED_IMGUI_EXAMPLE OFF CACHE BOOL "" FORCE)
set(WICKED_WINDOWS_TEMPLATE OFF CACHE BOOL "" FORCE)
set(WICKED_LINUX_TEMPLATE OFF CACHE BOOL "" FORCE)
set(WICKED_ENABLE_SYMLINKS OFF CACHE BOOL "" FORCE)
add_subdirectory(engine)
# ── Voxel Engine Library ──────────────────────────────────────────
file(GLOB_RECURSE VOXEL_SOURCES src/voxel/*.cpp src/voxel/*.h)
add_library(VoxelEngine STATIC ${VOXEL_SOURCES})
target_include_directories(VoxelEngine PUBLIC src)
target_link_libraries(VoxelEngine PUBLIC WickedEngine)
# ── Main Application ─────────────────────────────────────────────
file(GLOB APP_SOURCES src/app/*.cpp src/app/*.h)
add_executable(BVLEVoxels WIN32 ${APP_SOURCES})
target_link_libraries(BVLEVoxels PRIVATE VoxelEngine WickedEngine)
# Copy Content directory (shaders, etc.) to build output
add_custom_command(TARGET BVLEVoxels POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory
${CMAKE_SOURCE_DIR}/engine/Content
$<TARGET_FILE_DIR:BVLEVoxels>/Content
)
# Copy DXC shader compiler DLL next to the exe (required for runtime shader compilation)
add_custom_command(TARGET BVLEVoxels POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
${CMAKE_SOURCE_DIR}/engine/WickedEngine/dxcompiler.dll
$<TARGET_FILE_DIR:BVLEVoxels>/dxcompiler.dll
COMMENT "Copying DXC shader compiler DLL"
)
# Copy our custom shader sources into Wicked's shader source tree
# so LoadShader can find and compile them as "voxel/voxelVS.cso"
add_custom_command(TARGET BVLEVoxels POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory
${CMAKE_SOURCE_DIR}/shaders
${CMAKE_SOURCE_DIR}/engine/WickedEngine/shaders/voxel
COMMENT "Copying voxel shaders to Wicked Engine shader source directory"
)