Refactor the CMakeLists for all the samples; use vulkan.hpp/vulkan_raii.hpp as precompiled header.
This commit is contained in:
@@ -14,30 +14,15 @@
|
||||
|
||||
cmake_minimum_required(VERSION 3.2)
|
||||
|
||||
project(RAII_RayTracing)
|
||||
|
||||
set(HEADERS
|
||||
CameraManipulator.hpp
|
||||
)
|
||||
|
||||
set(SOURCES
|
||||
CameraManipulator.cpp
|
||||
RayTracing.cpp
|
||||
)
|
||||
|
||||
source_group(headers FILES ${HEADERS})
|
||||
source_group(sources FILES ${SOURCES})
|
||||
|
||||
add_executable(RAII_RayTracing
|
||||
${HEADERS}
|
||||
${SOURCES}
|
||||
)
|
||||
|
||||
set_target_properties(RAII_RayTracing PROPERTIES FOLDER "RAII_Samples")
|
||||
target_link_libraries(RAII_RayTracing PRIVATE utils)
|
||||
target_include_directories(RAII_RayTracing PUBLIC
|
||||
${CMAKE_SOURCE_DIR}/samples/RayTracing/common
|
||||
${CMAKE_SOURCE_DIR}/samples/RayTracing/vulkannv
|
||||
${CMAKE_SOURCE_DIR}/stb
|
||||
${CMAKE_SOURCE_DIR}/tinyobjloader
|
||||
)
|
||||
vulkan_hpp__setup_sample_raii(
|
||||
NAME RayTracing
|
||||
INCLUDE_DIRS
|
||||
${CMAKE_SOURCE_DIR}/samples/RayTracing/common
|
||||
${CMAKE_SOURCE_DIR}/samples/RayTracing/vulkannv
|
||||
${CMAKE_SOURCE_DIR}/stb
|
||||
${CMAKE_SOURCE_DIR}/tinyobjloader
|
||||
HEADERS
|
||||
CameraManipulator.hpp
|
||||
SOURCES
|
||||
CameraManipulator.cpp
|
||||
RayTracing.cpp)
|
||||
|
||||
@@ -28,8 +28,6 @@
|
||||
// unknow compiler... just ignore the warnings for yourselves ;)
|
||||
#endif
|
||||
|
||||
#define VULKAN_HPP_ENABLE_DYNAMIC_LOADER_TOOL 0
|
||||
|
||||
// clang-format off
|
||||
// we need to include vulkan.hpp before glfw3.h, so stop clang-format to reorder them
|
||||
#include <vulkan/vulkan.hpp>
|
||||
@@ -691,7 +689,27 @@ int main( int /*argc*/, char ** /*argv*/ )
|
||||
#if !defined( NDEBUG )
|
||||
vk::raii::DebugUtilsMessengerEXT debugUtilsMessenger( instance, vk::su::makeDebugUtilsMessengerCreateInfoEXT() );
|
||||
#endif
|
||||
vk::raii::PhysicalDevice physicalDevice = vk::raii::PhysicalDevices( instance ).front();
|
||||
|
||||
vk::raii::PhysicalDevice physicalDevice( nullptr );
|
||||
vk::raii::PhysicalDevices physicalDevices( instance );
|
||||
for ( auto & pd : physicalDevices )
|
||||
{
|
||||
std::vector<vk::ExtensionProperties> ep = pd.enumerateDeviceExtensionProperties();
|
||||
if ( std::find_if( ep.cbegin(),
|
||||
ep.cend(),
|
||||
[]( vk::ExtensionProperties const & prop )
|
||||
{ return strcmp( prop.extensionName, VK_NV_RAY_TRACING_EXTENSION_NAME ) == 0; } ) !=
|
||||
ep.cend() )
|
||||
{
|
||||
physicalDevice = pd;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ( !*physicalDevice )
|
||||
{
|
||||
std::cerr << AppName << ": can't find a PhysicalDevice supporting extension <" << VK_NV_RAY_TRACING_EXTENSION_NAME << ">" << std::endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
std::vector<vk::ExtensionProperties> extensionProperties = physicalDevice.enumerateDeviceExtensionProperties();
|
||||
assert( vk::su::contains( extensionProperties, VK_KHR_SWAPCHAIN_EXTENSION_NAME ) );
|
||||
|
||||
Reference in New Issue
Block a user