i, I setup the vulkan sdk environment exactly according to the instruction in gettin started guide (sorry can not post link):
In brief, I installed and verified ICD is present for my graphics card in one of the specified location.
Downloaded and untar-red the vulkan-sdk into root and used setup-env.sh to initialize env. Also including in bashrc to invoke it everytime.
THe above instruction in the URL had cpp and make build instruction using simple vulkan app, but today I am somehow unable to locate. I know I followed it exactly. Now instead I have some vague cmake simple app isntruction.
Anyways, I pasted the effort from yesterday below and problem is build error says vulkan.h
is missing.
BELOW IS 1. CPP AND 2. MAKEFILE + 3. BUILD OUTPUT.
The build output complains glfw include statement unable to find <vulkan/vulkan.h>
but I included that in the searchable path:
/root/vulkan/1.1.114.0/x86_64/include:/root/vulkan/1.1.114.0/x86_64/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/local/include/
Also makefile also some following statements:
CFLAGS = -std=c++17 -I$(VULKAN_SDK_PATH)/include
So why is it complaining about not finding the vulkan.h?
#define GLFW_INCLUDE_VULKAN
#include <GLFW/glfw3.h>
#define GLM_FORCE_RADIANS
#define GLM_FORCE_DEPTH_ZERO_TO_ONE
#include <glm/vec4.hpp>
#include <glm/mat4x4.hpp>
#include <iostream>
int main() {
glfwInit();
glfwWindowHint(GLFW_CLIENT_API, GLFW_NO_API);
GLFWwindow* window = glfwCreateWindow(800, 600, "Vulkan window", nullptr, nullptr);
uint32_t extensionCount = 0;
vkEnumerateInstanceExtensionProperties(nullptr, &extensionCount, nullptr);
std::cout << extensionCount << " extensions supported" << std::endl;
glm::mat4 matrix;
glm::vec4 vec;
auto test = matrix * vec;
while(!glfwWindowShouldClose(window)) {
glfwPollEvents();
}
glfwDestroyWindow(window);
glfwTerminate();
return 0;
}
VULKAN_SDK_PATH = /home/user/VulkanSDK/x.x.x.x/x86_64
CFLAGS = -std=c++17 -I$(VULKAN_SDK_PATH)/include
LDFLAGS = -L$(VULKAN_SDK_PATH)/lib `pkg-config --static --libs glfw3` -lvulkan
VulkanTest: main.cpp
g++ $(CFLAGS) -o VulkanTest main.cpp $(LDFLAGS)
.PHONY: test clean
test: VulkanTest
LD_LIBRARY_PATH=$(VULKAN_SDK_PATH)/lib VK_LAYER_PATH=$(VULKAN_SDK_PATH)/etc/vulkan/explicit_layer.d ./VulkanTest
clean:
rm -f VulkanTest
root@guyen-MS-7B22:~/vulkantest# make
g++ -std=c++17 -I/home/user/VulkanSDK/x.x.x.x/x86_64/include -o VulkanTest main.cpp -L/home/user/VulkanSDK/x.x.x.x/x86_64/lib `pkg-config --static --libs glfw3` -lvulkan
In file included from main.cpp:2:0:
/usr/local/include/GLFW/glfw3.h:111:12: fatal error: vulkan/vulkan.h: No such file or directory
#include <vulkan/vulkan.h>
^~~~~~~~~~~~~~~~~
compilation terminated.
Makefile:7: recipe for target 'VulkanTest' failed
make: *** [VulkanTest] Error 1
root@guyen-MS-7B22:~/vulkantest#