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

Update, expand and simplify development environment project setup #36

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

SaschaWillems
Copy link
Collaborator

This PR updates, simplifies and expands the development environment setup for Windows with Visual Studio.

The most important change is that the project setup now uses the %VULKAN_SDK% environment variable instead of explicit versioned SDK folder names. This makes setup easier and unties this chapter from the SDK version.

The linux setup is also updated and first points to the Linux setup guides from LunarG instead of a list of single components.

Also updates a few other chapters that had folders like '/home/user/VulkanSDK/x.x.x.x/x86_64' for e.g. calling glslc. This was something that confused people up to a point where they simply tried to use the x.x.x.x folder and failed. This now also uses either the env variable (Windows) or jut removes the path altogether (Linux) as those tools are globally available after SDK installation.

Other changes include updated screenshots and a note on what glfw library folder to select on Windows (as it depends on the used Visual Studio version)

Refs #19

@SaschaWillems SaschaWillems changed the title Update, expand and simplify Visual Studio Windows project setup Update, expand and simplify development environment project setup Nov 16, 2023
@Pacheco95
Copy link

That's great! Indeed, using the SDK makes life easier. One thing that could be a great addition to the documentation is a CMakeLists.txt configured to bootstrap the setup using the SDK. This could simplify the setup for all platforms

@SaschaWillems
Copy link
Collaborator Author

SaschaWillems commented Nov 16, 2023

We are already working on a proper CMake setup. But that's a bit more involved and will come later. This PR is esp. meant to fix some pressing issues that confuse people starting with the tutorial ;)

@@ -47,8 +49,9 @@ There are other libraries available for this purpose, like https://www.libsdl.or
You can find the latest release of GLFW on the http://www.glfw.org/download.html[official website].
In this tutorial we'll be using the 64-bit binaries, but you can of course also choose to build in 32 bit mode.
In that case make sure to link with the Vulkan SDK binaries in the `Lib32` directory instead of `Lib`.
After downloading it, extract the archive to a convenient location.
I've chosen to create a `Libraries` directory in the Visual Studio directory under documents.
After downloading it, extract the archive to a convenient location like `C:\Vulkan-Tutorial`.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to recommend they use git to get the Vulkan Tutorial?

I've chosen to create a `Libraries` directory in the Visual Studio directory under documents.
After downloading it, extract the archive to a convenient location like `C:\Vulkan-Tutorial`.

Extract glfw there so that you have a path called `C:\Vulkan-Tutorial\glfw` with contents similar to this:
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe also think about showing how to use CMake and a packaging service such as vcpkg in windows apt in linux. This way, the project will be cleaner and easier to work with in other projects.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's the plan for the long run ;)

@@ -57,8 +60,13 @@ image::/images/glfw_directory.png[]
Unlike DirectX 12, Vulkan does not include a library for linear algebra operations, so we'll have to download one.
http://glm.g-truc.net/[GLM] is a nice library that is designed for use with graphics APIs and is also commonly used with OpenGL.

GLM is a header-only library, so just download the https://github.com/g-truc/glm/releases[latest version] and store it in a convenient location.
You should have a directory structure similar to the following now:
GLM is a header-only library, so just download the https://github.com/g-truc/glm/releases[latest version] and store it in a convenient location like `C:\Vulkan-Tutorial`.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can even mention using submodules.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I didn't want to change too much aside from the most pressing issues. I think once we have a proper CMake setup using FetchContent we can make this whole setup chapter a lot easier :)

C:/VulkanSDK/x.x.x.x/Bin/glslc.exe shader.vert -o vert.spv
C:/VulkanSDK/x.x.x.x/Bin/glslc.exe shader.frag -o frag.spv
%VULKAN_SDK%/Bin/glslc.exe shader.vert -o vert.spv
%VULKAN_SDK%/Bin/glslc.exe shader.frag -o frag.spv
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$VULKAN_SDK for bash

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks :)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oddly that env variable isn't set on m Ubuntu setup (WSL2), even though I've installed the SDK :/

/home/user/VulkanSDK/x.x.x.x/x86_64/bin/glslc shader.vert -o vert.spv
/home/user/VulkanSDK/x.x.x.x/x86_64/bin/glslc shader.frag -o frag.spv
glslc shader.vert -o vert.spv
glslc shader.frag -o frag.spv
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

assuming it's in the path, which it might not be (one can install via tarball and not setup the path).
Instead this would work:
$VULKAN_SDK/x86_64/bin/glslc
You can confirm it's in the path with which i.e.
which glslc

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, will incorporate this :)

LunarG provides the Vulkan SDK for 64-bit Linux distribution. Installation depends on your distribution and installation:

- link:https://vulkan.lunarg.com/doc/view/latest/linux/getting_started_ubuntu.html[Getting Started with the Ubuntu Vulkan SDK]
- link:https://vulkan.lunarg.com/doc/view/latest/linux/getting_started.html[Getting Started with the Linux Tarball Vulkan SDK]
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For Linux, I recommend to most programmers to create a directory to hold Vulkan then a soft link so all paths are always the same after upgrades. i.e.

mkdir -p ~/Vulkan_SDK && pushd ~/Vulkan_SDK
then every time you get vulkan via new udpate even:
tar -xzf /vulkan.tar.gz
ln -s latest x.x.x

Now whenever you set the Vulkan Path anywhere in a project, you point it to ~/Vulkan_SDK/latest. You can now update/downgrade Vulkan and just update the softlink to keep the same path everywhere.

@@ -59,12 +59,12 @@ Add the directory with `stb_image.h` to the include directories for GCC:

[,text]
----
VULKAN_SDK_PATH = /home/user/VulkanSDK/x.x.x.x/x86_64
VULKAN_SDK_PATH = /usr/include/vulkan
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might not be correct. I'd have to look at the instructions again if LunarG advocates to install it to the system include directory. Having the includes live in the VulkanSDK path is universally accurate and covers the case where a linux user might not have super user access.

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

Successfully merging this pull request may close these issues.

None yet

3 participants