Skip to content
Snippets Groups Projects
Verified Commit 867b73ca authored by Tobias Frisch's avatar Tobias Frisch
Browse files

Merge branch 'develop' into 43-multi-threading

parents 60755124 a9250ba2
No related branches found
No related tags found
1 merge request!55Draft: Resolve "Multi-Threading"
Showing with 747 additions and 296 deletions
BasedOnStyle: WebKit
IndentWidth: 4
ColumnLimit: 100
Language: Cpp
Standard: c++20
DerivePointerAlignment: false
PointerAlignment: Left
ReferenceAlignment: Right
SortIncludes: CaseSensitive
AccessModifierOffset: -4
AlignAfterOpenBracket: true
AlignArrayOfStructures: Left
AlignConsecutiveAssignments: None
AlignConsecutiveBitFields: None
AlignConsecutiveDeclarations: None
AlignConsecutiveMacros: None
AlignEscapedNewlines: Left
AlignOperands: AlignAfterOperator
AlignTrailingComments: true
BreakBeforeBinaryOperators: NonAssignment
BreakBeforeBraces: Attach
BreakBeforeConceptDeclarations: true
BreakBeforeTernaryOperators: false
BreakConstructorInitializers: AfterColon
BreakInheritanceList: AfterColon
BreakStringLiterals: true
AllowAllArgumentsOnNextLine: false
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortBlocksOnASingleLine: Empty
AllowShortCaseLabelsOnASingleLine: false
AllowShortEnumsOnASingleLine: false
AllowShortFunctionsOnASingleLine: Empty
AllowShortIfStatementsOnASingleLine: false
AllowShortLambdasOnASingleLine: Empty
AllowShortLoopsOnASingleLine: false
AlwaysBreakTemplateDeclarations: Yes
EmptyLineBeforeAccessModifier: Always
BinPackParameters: true
ReflowComments: true
ShortNamespaceLines: 0
NamespaceIndentation: All
FixNamespaceComments: true
SpaceBeforeRangeBasedForLoopColon: true
SpaceBeforeSquareBrackets: true
SpaceInEmptyBlock: false
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: Leave
SpacesInConditionalStatement: false
SpacesInContainerLiterals: true
SpacesInLineCommentPrefix:
Minimum: 1
Maximum: -1
SpacesInParentheses: false
TabWidth: 4
UseTab: ForContinuationAndIndentation
UseCRLF: false
......@@ -7,6 +7,7 @@
.editorconfig
# build directories
bin/
build/
cmake-build-debug/
cmake-build-release/
......@@ -18,3 +19,11 @@ cmake-build-release/
# GUI configuration files
imgui.ini
# Generated source and header files for shaders
*.hxx
*.cxx
# Cache for different tasks like source code indexing
.cache/
variables:
RUN:
value: "all"
description: "The tests that should run. Possible values: ubuntu, win, all."
GIT_DEPTH: 1
stages:
- build
- deploy
build_ubuntu_gcc:
only:
variables:
- $RUN =~ /\bubuntu.*/i || $RUN =~ /\ball.*/i
stage: build
tags:
- ubuntu-gcc-cached
variables:
GIT_SUBMODULE_STRATEGY: recursive
timeout: 10m
retry: 1
script:
- mkdir debug
- cd debug
- cmake -DCMAKE_BUILD_TYPE=Debug ..
- cmake --build .
artifacts:
name: "Documentation - $CI_PIPELINE_ID"
paths:
- doc/html
- doc/latex
expire_in: never
build_win10_msvc:
only:
variables:
- $RUN =~ /\bwin.*/i || $RUN =~ /\ball.*/i
stage: build
tags:
- win10-msvc-cached
variables:
GIT_SUBMODULE_STRATEGY: recursive
timeout: 10m
retry: 0
script:
- cd 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\Tools\'
- .\Launch-VsDevShell.ps1
- cd $CI_PROJECT_DIR
- mkdir debug
- cd debug
- cmake -DCMAKE_BUILD_TYPE=Debug ..
- cmake --build .
deploy_doc_develop:
only:
variables:
- $RUN =~ /\bubuntu.*/i || $RUN =~ /\ball.*/i
refs:
- develop
stage: deploy
needs: ["build_ubuntu_gcc"]
dependencies:
- build_ubuntu_gcc
tags:
- webserver
variables:
GIT_STRATEGY: none
script:
- rsync -avh doc/html/ /var/www/html/develop --delete
- echo "Check it out at https://vkcv.de/develop"
deploy_doc_branch:
only:
variables:
- $RUN =~ /\bubuntu.*/i || $RUN =~ /\ball.*/i
except:
refs:
- develop
stage: deploy
needs: ["build_ubuntu_gcc"]
dependencies:
- build_ubuntu_gcc
tags:
- webserver
variables:
GIT_STRATEGY: none
script:
- rsync -avh doc/html/ /var/www/html/branch/$CI_COMMIT_BRANCH --delete
- echo "Check it out at https://vkcv.de/branch/$CI_COMMIT_BRANCH"
\ No newline at end of file
......@@ -14,7 +14,7 @@
path = modules/asset_loader/lib/stb
url = https://github.com/nothings/stb.git
[submodule "modules/camera/lib/glm"]
path = modules/camera/lib/glm
path = modules/geometry/lib/glm
url = https://github.com/g-truc/glm.git
[submodule "modules/shader_compiler/lib/glslang"]
path = modules/shader_compiler/lib/glslang
......@@ -22,3 +22,21 @@
[submodule "modules/gui/lib/imgui"]
path = modules/gui/lib/imgui
url = https://github.com/ocornut/imgui.git
[submodule "modules/upscaling/lib/FidelityFX-FSR"]
path = modules/upscaling/lib/FidelityFX-FSR
url = https://github.com/GPUOpen-Effects/FidelityFX-FSR.git
[submodule "lib/Vulkan-Headers"]
path = lib/Vulkan-Headers
url = https://github.com/KhronosGroup/Vulkan-Headers.git
[submodule "lib/Vulkan-Hpp"]
path = lib/Vulkan-Hpp
url = https://github.com/KhronosGroup/Vulkan-Hpp
[submodule "modules/upscaling/lib/NVIDIAImageScaling"]
path = modules/upscaling/lib/NVIDIAImageScaling
url = https://github.com/NVIDIAGameWorks/NVIDIAImageScaling.git
[submodule "lib/VulkanMemoryAllocator-Hpp"]
path = lib/VulkanMemoryAllocator-Hpp
url = https://github.com/YaaZ/VulkanMemoryAllocator-Hpp.git
[submodule "modules/algorithm/lib/FidelityFX-SPD"]
path = modules/algorithm/lib/FidelityFX-SPD
url = https://github.com/GPUOpen-Effects/FidelityFX-SPD.git
AUTHORS 0 → 100644
Alexander Gauggel
Artur Wasmut
Josch Morgenstern
Katharina Krämer
Lars Hoerttrich
Leonie Franken
Mara Vogt
Mark O. Mints
Sebastian Gaida
Simeon Hermann
Susanne Dötsch
Tobias Frisch
Trevor Hollmann
Vanessa Karolek
# Changelog
## [0.1.0](https://gitlab.uni-koblenz.de/vulkan2021/vkcv-framework/tree/0.1.0) (2021-12-07)
** Platform support:**
- Linux support (GCC and CLang)
- MacOS support (Apple CLang)
- Windows support (MSVC and MinGW-GCC experimentally)
** New modules:**
- [Asset-Loader](modules/asset_loader/README.md): A VkCV module to load basic assets like models, materials and images
- [Camera](modules/asset_loader/README.md): A VkCV module to manage cameras and their handle view and projection matrices
- [GUI](modules/gui/README.md): A VkCV module to integrate GUI rendering to your application as additional pass
- [Material](modules/material/README.md): A VkCV module to abstract typical kinds of materials for rendering
- [Meshlet](modules/meshlet/README.md): A VkCV module to divide vertex data of a mesh into meshlets
- [Scene](modules/scene/README.md): A VkCV module to load and manage a scene, simplify its rendering and potentially optimize it
- [Shader-Compiler](modules/shader_compiler/README.md): A VkCV module to compile shaders at runtime
- [Upscaling](modules/upscaling/README.md): A VkCV module to upscale images in realtime
** New features:**
- Resizable windows
- Multiple windows and multiple swapchains (window management)
- Dynamically requesting Vulkan features and extensions
- Shader reflection and runtime shader compilation (various shader stages)
- Realtime ray tracing
- Mesh shaders
- Indirect dispatch
- Compute pipelines and compute shaders
- Multiple queues and graphic pipelines
- Bindless textures
- ImGUI support
- Mipmapping
- Logging
- Command buffer synchronization
- Doxygen source code documentation
- Buffer, sampler and image management
- Camera management with gamepad support
- Input event synchronization
- Resource management with handles
cmake_minimum_required(VERSION 3.16)
project(vkcv)
# cmake options
option(BUILD_MODULES "Enables building VkCV as shared libraries" ON)
option(BUILD_PROJECTS "Enables building the VkCV projects" ON)
option(BUILD_CLANG_FORMAT "Enables formatting the source code" OFF)
option(BUILD_DOXYGEN_DOCS "Enables building the VkCV doxygen documentation" OFF)
option(BUILD_SHARED "Enables building VkCV as shared libraries" OFF)
option(BUILD_VMA_VULKAN_VERSION "Enforce a specific Vulkan version for VMA" OFF)
# uncomment the following line if cmake will refuse to build projects
#set(BUILD_PROJECTS ON)
if ((WIN32) AND (NOT BUILD_VMA_VULKAN_VERSION))
set(BUILD_VMA_VULKAN_VERSION "1.3.0")
endif()
if (BUILD_PROJECTS)
set(BUILD_MODULES ${BUILD_PROJECTS})
endif()
message(STATUS "Options:")
message(" - BUILD_MODULES: ${BUILD_MODULES}")
message(" - BUILD_PROJECTS: ${BUILD_PROJECTS}")
message(" - BUILD_CLANG_FORMAT: ${BUILD_CLANG_FORMAT}")
message(" - BUILD_DOXYGEN_DOCS: ${BUILD_DOXYGEN_DOCS}")
message(" - BUILD_SHARED: ${BUILD_SHARED}")
if (BUILD_SHARED)
set(vkcv_build_attribute SHARED)
else()
set(vkcv_build_attribute STATIC)
endif()
# settings c++ standard for the framework
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# checking build type and setting up a variable
......@@ -11,11 +43,18 @@ if (CMAKE_BUILD_TYPE)
set(vkcv_build_${_vkcv_build_type} 1)
endif()
message("-- Language: [ C++ " ${CMAKE_CXX_STANDARD} " ]")
message("-- Compiler: [ " ${CMAKE_CXX_COMPILER_ID} " " ${CMAKE_CXX_COMPILER_VERSION} " ]")
if (EXISTS "/usr/bin/mold")
set(CMAKE_LINKER "/usr/bin/mold")
endif()
message(STATUS "Language: [ C++ " ${CMAKE_CXX_STANDARD} " ]")
message(STATUS "Compiler: [ " ${CMAKE_CXX_COMPILER_ID} " " ${CMAKE_CXX_COMPILER_VERSION} " ]")
message(STATUS "Linker: [ " ${CMAKE_LINKER} " ]")
if ((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") AND (CMAKE_CXX_COMPILER_VERSION VERSION_LESS "9.0.0"))
message(FATAL_ERROR "Upgrade your compiler! GCC 9.0+ is required!")
elseif(MINGW)
message(WARNING "MinGW is impressively unstable! So beware it may not compile or crash during runtime!")
endif()
# setting up different paths
......@@ -33,38 +72,57 @@ set(vkcv_flags ${CMAKE_CXX_FLAGS})
# enabling warnings in the debug build
if (vkcv_build_debug)
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
set(vkcv_flags ${vkcv_flags} " -Weverything")
#set(vkcv_flags ${vkcv_flags} " -Weverything")
set(vkcv_flags ${vkcv_flags} " -Wextra -Wall -Wno-unused-parameter")
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
set(vkcv_flags ${vkcv_flags} " -Wextra -Wall -pedantic")
set(vkcv_flags ${vkcv_flags} " -Wextra -Wall -pedantic -Wno-unused-parameter")
else()
set(vkcv_flags ${vkcv_flags} " -W4")
endif()
endif()
if ((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") AND (CMAKE_CXX_COMPILER_VERSION VERSION_LESS "11.0.0"))
list(APPEND vkcv_definitions __NO_SEMAPHORES__)
endif()
# configure everything to use the required dependencies
include(${vkcv_config}/Libraries.cmake)
# set macro to enable vulkan debug labels
list(APPEND vkcv_definitions VULKAN_DEBUG_LABELS)
# set the compile definitions aka preprocessor variables
add_compile_definitions(${vkcv_definitions})
# add modules as targets
add_subdirectory(modules)
# check if the framework is used from a parent scope
get_directory_property(vkcv_parent_scope PARENT_DIRECTORY)
if (BUILD_MODULES)
message(STATUS "Modules: ON")
# add modules as targets
add_subdirectory(modules)
else()
message(STATUS "Modules: OFF")
endif()
# add source files for compilation
include(${vkcv_config}/Sources.cmake)
message("-- Libraries: [ ${vkcv_libraries} ]")
message("-- Flags: [ ${vkcv_flags} ]")
message(STATUS "Framework:")
message(" - Includes: [ ${vkcv_includes} ]")
message(" - Libraries: [ ${vkcv_libraries} ]")
message(" - Flags: [ ${vkcv_flags} ]")
# set the compiler flags for the framework
set(CMAKE_CXX_FLAGS ${vkcv_flags})
# create VkCV framework as static library using all source files
add_library(vkcv STATIC ${vkcv_sources})
# create VkCV framework as library using all source files
add_library(vkcv ${vkcv_build_attribute} ${vkcv_sources})
if(MSVC)
#enable multicore compilation on visual studio
target_compile_options(vkcv PRIVATE "/MP" "/openmp")
target_compile_options(vkcv PRIVATE "/MP" "/openmp" "/Zc:offsetof-")
#set source groups to create proper filters in visual studio
source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} FILES ${vkcv_sources})
......@@ -72,20 +130,40 @@ endif()
# add include directories from dependencies as system includes
target_include_directories(vkcv SYSTEM BEFORE PRIVATE ${vkcv_includes})
message(STATUS ${vkcv_includes})
# add the own include directory for public headers
target_include_directories(vkcv BEFORE PUBLIC ${vkcv_include})
message(STATUS ${vkcv_include})
# link the framework using all required libraries
target_link_libraries(vkcv ${vkcv_libraries})
message(STATUS ${vkcv_libraries})
# add sub-projects/examples as targets
add_subdirectory(projects)
if (BUILD_PROJECTS)
message(STATUS "Projects: ON")
# add sub-projects/examples as targets
add_subdirectory(projects)
else()
message(STATUS "Projects: OFF")
endif()
if (NOT WIN32)
if (BUILD_DOXYGEN_DOCS)
message(STATUS "Doxygen: ON")
# add doxygen as target if installed
include(${vkcv_config}/ext/Doxygen.cmake)
else()
message(STATUS "Doxygen: OFF")
endif()
if (vkcv_parent_scope)
list(APPEND vkcv_includes ${vkcv_include})
list(APPEND vkcv_libraries vkcv)
if (BUILD_MODULES)
list(APPEND vkcv_includes ${vkcv_modules_includes})
list(APPEND vkcv_libraries ${vkcv_modules_libraries})
endif()
set(vkcv_includes ${vkcv_includes} PARENT_SCOPE)
set(vkcv_libraries ${vkcv_libraries} PARENT_SCOPE)
endif()
\ No newline at end of file
This diff is collapsed.
LICENSE 0 → 100644
MIT License
Copyright (c) 2021 Universität Koblenz
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
......@@ -11,17 +11,51 @@ More information about Git LFS [here](https://git-lfs.github.com/).
## Build
[![pipeline status](https://gitlab.uni-koblenz.de/vulkan2021/vkcv-framework/badges/develop/pipeline.svg)](https://gitlab.uni-koblenz.de/vulkan2021/vkcv-framework/-/commits/develop)
Git submodules are used for libraries.
To download the submodules either clone using `git clone --recurse-submodules` or after `git clone` use `git submodule init` and `git submodule update`.
## Documentation
Detailed build process:
- [How to build on Windows](doc/BUILD_WINDOWS.md)
- [How to build on macOS](doc/BUILD_MACOS.md)
- [How to build on Linux](doc/BUILD_LINUX.md)
### Dependencies (required):
Most dependencies will be used via submodules but for example Vulkan needs to be installed correctly depending on your platform. So please setup your environment properly.
| Name of dependency | Used as submodule |
|-----------------------------------------------------------------------------------|---|
| [Vulkan](https://www.vulkan.org/) | ❌ |
| [Vulkan-Headers](https://github.com/KhronosGroup/Vulkan-Headers) | ✅ |
| [Vulkan-Hpp](https://github.com/KhronosGroup/Vulkan-Hpp) | ✅ |
| [GLFW](https://www.glfw.org/) | ✅ |
| [SPIRV-CROSS](https://github.com/KhronosGroup/SPIRV-Cross) | ✅ |
| [VulkanMemoryAllocator-Hpp](https://github.com/malte-v/VulkanMemoryAllocator-Hpp) | ✅ |
### Modules (optional):
The documentation for the develop-branch can be found here:
https://vkcv.de/develop/
The following modules will be provided in this repository and they will automatically be builded together with the framework if used. You can configure/adjust the build using CMake if necessary.
- [Algorithm](modules/algorithm/README.md)
- [Asset-Loader](modules/asset_loader/README.md)
- [Camera](modules/asset_loader/README.md)
- [GUI](modules/gui/README.md)
- [Effects](modules/effects/README.md)
- [Geometry](modules/geometry/README.md)
- [Material](modules/material/README.md)
- [Meshlet](modules/meshlet/README.md)
- [Scene](modules/scene/README.md)
- [Shader-Compiler](modules/shader_compiler/README.md)
- [Upscaling](modules/upscaling/README.md)
## Development
See this guide to setup your IDE for most forward development.
- [How to setup your IDE](doc/SETUP_IDE.md)
## Documentation
The documentation concerning the respective merge request is listed here:
https://vkcv.de/branch/
A pre-built documentation can be found here:
https://userpages.uni-koblenz.de/~vkcv/doc/
It is automatically generated and uploaded using the CI pipeline.
But it is recommended to build the documentation with Doxygen locally to get the most recent changes. There is also an optional CMake target to build the documentation via Doxygen.
......@@ -3,13 +3,23 @@ set(vkcv_config_lib ${vkcv_config}/lib)
set(vkcv_lib_path ${PROJECT_SOURCE_DIR}/${vkcv_lib})
if(NOT WIN32)
set(vkcv_libraries stdc++fs)
if (((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") AND (CMAKE_CXX_COMPILER_VERSION VERSION_LESS "9.1.0")) OR
((CMAKE_CXX_COMPILER_ID STREQUAL "Clang") AND (CMAKE_CXX_COMPILER_VERSION VERSION_LESS "9.0.0")))
set(vkcv_libraries stdc++fs)
endif()
if (CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
list(APPEND vkcv_flags -Xpreprocessor)
endif()
# optimization for loading times
list(APPEND vkcv_flags -pthread)
list(APPEND vkcv_flags -fopenmp)
endif()
# add custom functions to check for git submodules
include(${vkcv_config_ext}/Git.cmake)
list(APPEND vkcv_definitions _USE_MATH_DEFINES)
# some formatted printing
......@@ -19,6 +29,7 @@ set(vkcv_config_msg " - Library: ")
include(${vkcv_config_lib}/GLFW.cmake) # glfw-x11 / glfw-wayland # libglfw3-dev
include(${vkcv_config_lib}/Vulkan.cmake) # vulkan-intel / vulkan-radeon / nvidia # libvulkan-dev
include(${vkcv_config_lib}/SPIRV_Cross.cmake) # SPIRV-Cross # libspirv_cross_c_shared
include(${vkcv_config_lib}/VulkanMemoryAllocator.cmake) # VulkanMemoryAllocator
# cleanup of compiler flags
if (vkcv_flags)
......@@ -33,6 +44,9 @@ endif ()
# fix dependencies for different Linux distros (looking at you Ubuntu)
include(${vkcv_config_ext}/CheckLibraries.cmake)
# add custom function to include a file like a shader as string
include(${vkcv_config_ext}/IncludeShader.cmake)
# cleanup of compiler definitions aka preprocessor variables
if (vkcv_definitions)
list(REMOVE_DUPLICATES vkcv_definitions)
......
# adding all source files and header files of the framework:
set(vkcv_sources
${vkcv_include}/vkcv/Features.hpp
${vkcv_source}/vkcv/Features.cpp
${vkcv_include}/vkcv/FeatureManager.hpp
${vkcv_source}/vkcv/FeatureManager.cpp
${vkcv_include}/vkcv/Context.hpp
${vkcv_source}/vkcv/Context.cpp
${vkcv_include}/vkcv/Core.hpp
${vkcv_source}/vkcv/Core.cpp
${vkcv_include}/vkcv/File.hpp
${vkcv_source}/vkcv/File.cpp
${vkcv_include}/vkcv/Pass.hpp
${vkcv_source}/vkcv/Pass.cpp
${vkcv_include}/vkcv/PassConfig.hpp
${vkcv_source}/vkcv/PassConfig.cpp
......@@ -15,13 +27,19 @@ set(vkcv_sources
${vkcv_include}/vkcv/Handles.hpp
${vkcv_source}/vkcv/Handles.cpp
${vkcv_source}/vkcv/HandleManager.hpp
${vkcv_include}/vkcv/Window.hpp
${vkcv_source}/vkcv/Window.cpp
${vkcv_include}/vkcv/BufferTypes.hpp
${vkcv_include}/vkcv/Buffer.hpp
${vkcv_include}/vkcv/BufferManager.hpp
${vkcv_include}/vkcv/PushConstants.hpp
${vkcv_source}/vkcv/PushConstants.cpp
${vkcv_source}/vkcv/BufferManager.hpp
${vkcv_source}/vkcv/BufferManager.cpp
${vkcv_include}/vkcv/Image.hpp
......@@ -30,57 +48,100 @@ set(vkcv_sources
${vkcv_source}/vkcv/ImageManager.hpp
${vkcv_source}/vkcv/ImageManager.cpp
${vkcv_include}/vkcv/PipelineConfig.hpp
${vkcv_source}/vkcv/PipelineConfig.cpp
${vkcv_include}/vkcv/Logger.hpp
${vkcv_include}/vkcv/Swapchain.hpp
${vkcv_source}/vkcv/Swapchain.cpp
${vkcv_include}/vkcv/ShaderStage.hpp
${vkcv_include}/vkcv/ShaderProgram.hpp
${vkcv_source}/vkcv/ShaderProgram.cpp
${vkcv_include}/vkcv/PipelineConfig.hpp
${vkcv_include}/vkcv/GraphicsPipelineConfig.hpp
${vkcv_source}/vkcv/GraphicsPipelineConfig.cpp
${vkcv_include}/vkcv/ComputePipelineConfig.hpp
${vkcv_source}/vkcv/PipelineManager.hpp
${vkcv_source}/vkcv/PipelineManager.cpp
${vkcv_include}/vkcv/CommandResources.hpp
${vkcv_source}/vkcv/CommandResources.cpp
${vkcv_include}/vkcv/SyncResources.hpp
${vkcv_source}/vkcv/SyncResources.cpp
${vkcv_source}/vkcv/ComputePipelineManager.hpp
${vkcv_source}/vkcv/ComputePipelineManager.cpp
${vkcv_source}/vkcv/GraphicsPipelineManager.hpp
${vkcv_source}/vkcv/GraphicsPipelineManager.cpp
${vkcv_include}/vkcv/QueueManager.hpp
${vkcv_source}/vkcv/QueueManager.cpp
${vkcv_source}/vkcv/ImageLayoutTransitions.hpp
${vkcv_source}/vkcv/ImageLayoutTransitions.cpp
${vkcv_include}/vkcv/VertexLayout.hpp
${vkcv_source}/vkcv/VertexLayout.cpp
${vkcv_include}/vkcv/DispatchSize.hpp
${vkcv_source}/vkcv/DispatchSize.cpp
${vkcv_include}/vkcv/Event.hpp
${vkcv_include}/vkcv/TypeGuard.hpp
${vkcv_source}/vkcv/TypeGuard.cpp
${vkcv_include}/vkcv/DescriptorTypes.hpp
${vkcv_source}/vkcv/DescriptorManager.hpp
${vkcv_source}/vkcv/DescriptorManager.cpp
${vkcv_include}/vkcv/DescriptorConfig.hpp
${vkcv_source}/vkcv/DescriptorConfig.cpp
${vkcv_include}/vkcv/DescriptorBinding.hpp
${vkcv_source}/vkcv/DescriptorBinding.cpp
${vkcv_include}/vkcv/DescriptorWrites.hpp
${vkcv_source}/vkcv/DescriptorWrites.cpp
${vkcv_source}/vkcv/DescriptorSetLayoutManager.hpp
${vkcv_source}/vkcv/DescriptorSetLayoutManager.cpp
${vkcv_source}/vkcv/DescriptorSetManager.hpp
${vkcv_source}/vkcv/DescriptorSetManager.cpp
${vkcv_source}/vkcv/SamplerManager.hpp
${vkcv_source}/vkcv/SamplerManager.cpp
${vkcv_source}/vkcv/WindowManager.hpp
${vkcv_source}/vkcv/WindowManager.cpp
${vkcv_source}/vkcv/SwapchainManager.hpp
${vkcv_source}/vkcv/SwapchainManager.cpp
${vkcv_include}/vkcv/DescriptorWrites.hpp
${vkcv_include}/vkcv/DrawcallRecording.hpp
${vkcv_source}/vkcv/DrawcallRecording.cpp
${vkcv_include}/vkcv/CommandStreamManager.hpp
${vkcv_source}/vkcv/CommandStreamManager.hpp
${vkcv_source}/vkcv/CommandStreamManager.cpp
${vkcv_include}/vkcv/CommandRecordingFunctionTypes.hpp
${vkcv_include}/vkcv/EventFunctionTypes.hpp
${vkcv_include}/vkcv/ImageConfig.hpp
${vkcv_source}/vkcv/ImageConfig.cpp
${vkcv_include}/vkcv/Multisampling.hpp
${vkcv_source}/vkcv/Multisampling.cpp
${vkcv_include}/vkcv/Downsampler.hpp
${vkcv_source}/vkcv/Downsampler.cpp
${vkcv_include}/vkcv/BlitDownsampler.hpp
${vkcv_source}/vkcv/BlitDownsampler.cpp
${vkcv_include}/vkcv/SamplerTypes.hpp
${vkcv_include}/vkcv/Sampler.hpp
${vkcv_source}/vkcv/Sampler.cpp
${vkcv_include}/vkcv/DescriptorSetUsage.hpp
${vkcv_source}/vkcv/DescriptorSetUsage.cpp
${vkcv_include}/vkcv/Drawcall.hpp
${vkcv_source}/vkcv/Drawcall.cpp
${vkcv_include}/vkcv/VertexData.hpp
${vkcv_source}/vkcv/VertexData.cpp
${vkcv_include}/vkcv/Result.hpp
)
if (BUILD_CLANG_FORMAT)
message(STATUS "Clang-Format: ON")
# add clang-format as target if installed
include(${vkcv_config}/ext/ClangFormat.cmake)
else()
message(STATUS "Clang-Format: OFF")
endif()
if (EXISTS "/usr/bin/clang-format")
# note the option ALL which allows to format the source together with the application
add_custom_target( clang_format ALL
COMMAND /usr/bin/clang-format -style=file --sort-includes -i ${vkcv_sources}
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
COMMENT "Formatting code with Clang-Format"
VERBATIM )
else ()
message(WARNING "Doxygen need to be installed to generate the doxygen documentation")
endif ()
# check if Doxygen is installed
find_package(Doxygen)
find_package(Doxygen QUIET)
if (DOXYGEN_FOUND)
# note the option ALL which allows to build the docs together with the application
......
function(use_git_submodule submodule_path submodule_status)
file(GLOB path_glob "${submodule_path}/*")
list(LENGTH path_glob glob_len)
if(glob_len GREATER 0)
set(${submodule_status} TRUE PARENT_SCOPE)
return()
endif()
get_filename_component(submodule_name ${submodule_path} NAME)
message(WARNING "${submodule_name} is required..! Update the submodules!")
set(${submodule_status} FALSE PARENT_SCOPE)
endfunction()
function(include_shader shader include_dir source_dir)
if (NOT EXISTS ${shader})
message(WARNING "Shader file does not exist: ${shader}")
else()
get_filename_component(filename ${shader} NAME)
file(SIZE ${shader} filesize)
set(include_target_file ${include_dir}/${filename}.hxx)
set(source_target_file ${source_dir}/${filename}.cxx)
if ((EXISTS ${source_target_file}) AND (EXISTS ${include_target_file}))
file(TIMESTAMP ${shader} shader_timestamp "%Y-%m-%dT%H:%M:%S")
file(TIMESTAMP ${source_target_file} source_timestamp "%Y-%m-%dT%H:%M:%S")
string(COMPARE GREATER ${shader_timestamp} ${source_timestamp} shader_update)
else()
set(shader_update true)
endif()
if (shader_update)
string(TOUPPER ${filename} varname)
string(REPLACE "." "_" varname ${varname})
set(shader_header "#pragma once\n")
string(APPEND shader_header "// This file is auto-generated via cmake, so don't touch it!\n")
string(APPEND shader_header "extern unsigned char ${varname} [${filesize}]\;\n")
string(APPEND shader_header "extern unsigned int ${varname}_LEN\;\n")
string(APPEND shader_header "const std::string ${varname}_SHADER (reinterpret_cast<const char*>(${varname}), ${varname}_LEN)\;")
file(WRITE ${include_target_file} ${shader_header})
find_program(xxd_program "xxd")
if (EXISTS ${xxd_program})
get_filename_component(shader_directory ${shader} DIRECTORY)
add_custom_command(
OUTPUT ${source_target_file}
WORKING_DIRECTORY "${shader_directory}"
COMMAND xxd -i -C "${filename}" "${source_target_file}"
COMMENT "Processing shader into source files: ${shader}"
)
else()
set(shader_source "// This file is auto-generated via cmake, so don't touch it!\n")
string(APPEND shader_source "unsigned char ${varname}[] = {")
math(EXPR max_fileoffset "${filesize} - 1" OUTPUT_FORMAT DECIMAL)
message(STATUS "Processing shader into source files: ${shader}")
foreach(fileoffset RANGE ${max_fileoffset})
file(READ ${shader} shader_source_byte OFFSET ${fileoffset} LIMIT 1 HEX)
math(EXPR offset_modulo "${fileoffset} % 12" OUTPUT_FORMAT DECIMAL)
if (${offset_modulo} EQUAL 0)
string(APPEND shader_source "\n ")
endif()
if (${fileoffset} LESS ${max_fileoffset})
string(APPEND shader_source "0x${shader_source_byte}, ")
else()
string(APPEND shader_source "0x${shader_source_byte}\n")
endif()
endforeach()
string(APPEND shader_source "}\;\n")
string(APPEND shader_source "unsigned int ${varname}_LEN = ${filesize}\;")
file(WRITE ${source_target_file} ${shader_source})
endif()
endif()
endif()
endfunction()
# the first argument should be the project's target
macro(add_project)
# this should fix the execution path to load local files from the project
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
# this will create an executable for the project
add_executable(${ARGN})
# this should fix the execution path to load local files from the project (for MSVC)
if(MSVC)
set_target_properties(${ARGV0} PROPERTIES RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
set_target_properties(${ARGV0} PROPERTIES RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
# in addition to setting the output directory, the working directory has to be set
# by default visual studio sets the working directory to the build directory, when using the debugger
set_target_properties(${ARGV0} PROPERTIES VS_DEBUGGER_WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
endif()
endmacro()
......@@ -6,13 +6,14 @@ if (glfw3_FOUND)
message(${vkcv_config_msg} " GLFW - " ${glfw3_VERSION})
else()
if (EXISTS "${vkcv_lib_path}/glfw")
use_git_submodule("${vkcv_lib_path}/glfw" glfw_status)
if (${glfw_status})
add_subdirectory(${vkcv_lib}/glfw)
list(APPEND vkcv_libraries glfw)
list(APPEND vkcv_includes ${vkcv_lib_path}/glfw/include)
message(${vkcv_config_msg} " GLFW - " ${glfw3_VERSION})
else()
message(WARNING "GLFW is required..! Update the submodules!")
endif ()
endif ()
find_package(spirv_cross_c_shared QUIET)
if (spirv-cross_FOUND)
......@@ -5,7 +6,9 @@ if (spirv-cross_FOUND)
message(${vkcv_config_msg} " SPIRV Cross - " ${SPIRV_CROSS_VERSION})
else()
if (EXISTS "${vkcv_lib_path}/SPIRV-Cross")
use_git_submodule("${vkcv_lib_path}/SPIRV-Cross" spirv_cross_status)
if (${spirv_cross_status})
set(SPIRV_CROSS_EXCEPTIONS_TO_ASSERTIONS OFF CACHE INTERNAL "")
set(SPIRV_CROSS_SHARED OFF CACHE INTERNAL "")
set(SPIRV_CROSS_STATIC ON CACHE INTERNAL "")
......@@ -25,9 +28,8 @@ else()
add_subdirectory(${vkcv_lib}/SPIRV-Cross)
list(APPEND vkcv_libraries spirv-cross-cpp)
list(APPEND vkcv_includes ${vkcv_lib_path}/SPIV-Cross/include)
message(${vkcv_config_msg} " SPIRV Cross - " ${SPIRV_CROSS_VERSION})
else()
message(WARNING "SPIRV-Cross is required..! Update the submodules!")
endif ()
endif ()
\ No newline at end of file
endif ()
......@@ -2,8 +2,19 @@
find_package(Vulkan REQUIRED)
if (Vulkan_FOUND)
list(APPEND vkcv_includes ${Vulkan_INCLUDE_DIR})
use_git_submodule("${vkcv_lib_path}/Vulkan-Headers" vulkan_headers_status)
if (${vulkan_headers_status})
list(APPEND vkcv_includes ${vkcv_lib_path}/Vulkan-Headers/include)
endif()
use_git_submodule("${vkcv_lib_path}/Vulkan-Hpp" vulkan_hpp_status)
if (${vulkan_hpp_status})
list(APPEND vkcv_includes ${vkcv_lib_path}/Vulkan-Hpp)
endif()
list(APPEND vkcv_libraries ${Vulkan_LIBRARIES})
message(${vkcv_config_msg} " Vulkan - ")
message(${vkcv_config_msg} " Vulkan - " ${Vulkan_VERSION})
endif ()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment