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

[#15] Added build type detection in cmake to make gcc trigger-happy

parent 06c433b9
No related branches found
No related tags found
1 merge request!10Small little additions to the collection
This commit is part of merge request !10. Comments created here will be created in the context of that merge request.
......@@ -4,6 +4,11 @@ project(vkcv)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
if (CMAKE_BUILD_TYPE)
string(TOLOWER "${CMAKE_BUILD_TYPE}" _vkcv_build_type)
set(vkcv_build_${_vkcv_build_type} 1)
endif()
message("-- Language: [ C++ " ${CMAKE_CXX_STANDARD} " ]")
set(vkcv_config ${PROJECT_SOURCE_DIR}/config)
......@@ -15,6 +20,10 @@ set(vkcv_source ${PROJECT_SOURCE_DIR}/src)
set(vkcv_flags ${CMAKE_CXX_FLAGS})
if (vkcv_build_debug)
set(vkcv_flags ${vkcv_flags} " -Wextra -Wall -pedantic")
endif()
include(${vkcv_config}/Sources.cmake)
include(${vkcv_config}/Libraries.cmake)
......
#include "Context.hpp"
#include "CoreManager.hpp"
#include <iostream>
namespace vkcv {
Context::Context(vk::Instance instance, vk::PhysicalDevice physicalDevice, vk::Device device)
......@@ -147,7 +145,7 @@ namespace vkcv {
vk::PhysicalDevice phyDevice;
std::vector<vk::PhysicalDevice> devices = instance.enumeratePhysicalDevices();
if (devices.size() == 0) {
if (devices.empty()) {
throw std::runtime_error("failed to find GPUs with Vulkan support!");
}
......@@ -174,7 +172,7 @@ namespace vkcv {
/// <param name="physicalDevice"> The physical device. </param>
/// <returns></returns>
int Context::deviceScore(const vk::PhysicalDevice& physicalDevice) {
int score = 0;
uint32_t score = 0;
vk::PhysicalDeviceProperties properties = physicalDevice.getProperties();
std::vector<vk::QueueFamilyProperties> qFamilyProperties = physicalDevice.getQueueFamilyProperties();
......@@ -229,7 +227,7 @@ namespace vkcv {
}
uint32_t create = queueCount;
for (int i = 0; i < qFamilyCandidates.size() && create > 0; i++) {
for (uint32_t i = 0; i < qFamilyCandidates.size() && create > 0; i++) {
const int maxCreatableQueues = std::min(create, qFamilyCandidates[i].queueCount);
vk::DeviceQueueCreateInfo qCreateInfo(
vk::DeviceQueueCreateFlags(),
......
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