Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing very quick and easy option to setup the development environment for Vulkan on Windows WITHOUT Visual Studio #39

Open
SergioGiacomoSammartano opened this issue Jan 18, 2024 · 2 comments

Comments

@SergioGiacomoSammartano
Copy link

SergioGiacomoSammartano commented Jan 18, 2024

Hi,
First of all, I want to point out that I really, really appreciate the tutorial material, I think that you are doing an amazing job with it!

However, at the very beginning of it, I noticed a little thing that really bothered me: the "If you’re developing for Windows, then I will assume that you are using Visual Studio to compile your code." sentence.

What if somebody wants to develop a Vulkan application on Windows with some other IDE or editor? What about people using Code::Blocks, Eclipse, Notepad++, Sublime Text, VS Code, or Atom? What if someone wants to use GCC or Clang, for the compilation process?

Just having MingGW installed on a Windows system makes the setup of the development environment for that system almost identical to the setup on Linux (actually a bit easier, in my opinion). The major difference between the two is the need to include the Win32 GDI library in the linking options for Windows, instead of the ones for the X Window System and XFree86-VidModeExtension (or equivalent ones for Wayland) needed for Linux, libraries used by the GLFW utility.

I am not a very expert programmer, but after some research, and a bit of trials and errors, I managed to make the build system work on VS Code, both using a Makefile and using its native json configuration system.

Here is the makefile:
`
CXXFLAGS = -g -std=c++17 -O2

GLFW_INCLUDE_DIR = "C:\Dev\Frameworks\Libraries\GLFW\glfw-3.3.9.bin.WIN64\include"
GLM_INCLUDE_DIR = "C:\Dev\Frameworks\Libraries\glm\glm 0.9.9.8"
VULKAN_INCLUDE_DIR = "C:\Dev\Frameworks\VulkanSDK\Include"
CPPFLAGS = -I${GLFW_INCLUDE_DIR} -I${GLM_INCLUDE_DIR} -I${VULKAN_INCLUDE_DIR}

GLFW_LIB_DIR = C:\Dev\Frameworks\Libraries\GLFW\glfw-3.3.9.bin.WIN64\lib-mingw-w64
VULKAN_LIB_DIR = C:\Dev\Frameworks\VulkanSDK\Lib
LDFLAGS = -L${GLFW_LIB_DIR} -L${VULKAN_LIB_DIR} -lvulkan-1 -lglfw3 -lgdi32

main: main.cpp
g++ ${CXXFLAGS} main.cpp -o main.exe ${CPPFLAGS} ${LDFLAGS}
`

And here's a snippet for the tasks.json file:
{ "version": "2.0.0", "tasks": [ { "type": "cppbuild", "label": "C/C++: g++.exe build project", "command": "C:\\mingw64\\bin\\g++.exe", "args": [ "-fdiagnostics-color=always", "-g", "${file}", "-o", "${fileDirname}\\${fileBasenameNoExtension}.exe", "-std=c++17", "-O2", "-IC:\\Dev\\Frameworks\\VulkanSDK\\Include", "-IC:\\Dev\\Frameworks\\Libraries\\GLFW\\glfw-3.3.9.bin.WIN64\\include", "-IC:\\Dev\\Frameworks\\Libraries\\glm\\glm 0.9.9.8", "-LC:\\Dev\\Frameworks\\VulkanSDK\\Lib", "-LC:\\Dev\\Frameworks\\Libraries\\GLFW\\glfw-3.3.9.bin.WIN64\\lib-mingw-w64", "-lvulkan-1", "-lglfw3", "-lgdi32" ], "options": { "cwd": "${fileDirname}" }, "problemMatcher": [ "$gcc" ], "group": { "kind": "build", "isDefault": true }, "detail": "compiler: C:\\mingw64\\bin\\g++.exe" } ] }

Of course, the above snippets use absolute paths for the libraries installed on my specific machine (just because I was lazy!), but they can be easily adapted to other people's systems by using adequate variables, relative paths, etc.

So, why not include something similar also into the "Windows" section of the Vulkan tutorial? Maybe just the Makefile part, which basically can work with any other IDE or text editor?

To be totally fair, I felt the need to make this request partly because there are a few things about Visual Studio (not Code!) that makes me deeply dislike it and consider it to be a bad IDE, compared to most of the other alternatives: its sheer size on disk (absurdly big), it's standard project view-tree that makes the developer unaware of the underlying file system, its outdated look and feel, its lack of versatility regarding supported programming languages, excessive complexity, (...the list can go on for quite a while...), but above all, the fact that it HIDES away from the developer a lot of things that are going on under the hood during the building process, i.e. what the compiler is doing, how the linking is managed, etc.
While basically everything in this IDE is managed via graphical interfaces which make somewhat easier to set up a simple to medium-sized project, everything seems quite obscure and based on an unwritten, blind "trust" on Microsoft doings. And on bigger projects developed using VS... good luck fixing linking problems!

Sorry for the above rant, you can totally ignore it if you like! But please consider mentioning a MinGW option or some other alternative for Vulkan development on Windows platform!

@SergioGiacomoSammartano
Copy link
Author

I actually don't know how to make the code in the post above look like properly formatted code.... any tips would be welcome!

@SaschaWillems
Copy link
Collaborator

We are aware of this and we're already working on fixing this. We will add proper CMake support to the project, so you can basically use any C++ compiler/IDE with it. No date on this yet, though.

See #11

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants