andy-thomason / Vookoo

A set of utilities for taking the pain out of Vulkan in header only modern C++
MIT License
522 stars 52 forks source link

Add an 'install' capability for Vookoo. #25

Open FunMiles opened 4 years ago

FunMiles commented 4 years ago

I've started to add installation capabilities to the Vookoo CMakeLists. After a make install, using Vookoo from a project entails adding to the CMakeLists:

find_package(Vookoo REQUIRED) target_link_libraries(your_target Vookoo::vookoo_interface)

To my partial surprise, make install did install glfw and if one wants to use it (for example to run code like in the examples), one would have:

find_package(Vookoo REQUIRED) find_package(glfw3 REQUIRED) target_link_libraries(your_target Vookoo::vookoo_interface glfw)

Actually trying to do exactly that made me realize that the examples depend on glm. I am not a fan of glm and think it is a big error to use it in Vulkan project if for no other reason that it is geared towards OpenGL y-upward view of the screen coordinate system while Vulkan is y-downward.

Should glm be installed? Ignored? Replaced by a vkm ? Should I impede glfw3 from installing? Or install only if a find_package(glfw3) fails?

My current source can be found at: https://github.com/FunMiles/Vookoo/tree/installer

lhog commented 4 years ago

As a personal note: I tend to avoid projects that have too much NIH stuff. One can find a half dozens of semi-complete engines and frameworks with their own implementations of STL, matrix math, smart pointers, etc. My initial attention to Vookoo was due to the fact that it used mostly "standard" libraries. GLM at the moment is too big too fail, same cannot be told about any similar library by a single or a few contributors, no matter how good they are claimed to be.

Y-flip & GLM problem seems to be widely documented over the Internet and should not represent much of the issue. For example: https://www.saschawillems.de/blog/2019/03/29/flipping-the-vulkan-viewport/ https://github.com/SaschaWillems/Vulkan/blob/master/examples/negativeviewportheight/negativeviewportheight.cpp

FunMiles commented 4 years ago

@lhog I'll close the glm choice question with this post with one final comment: the example of documentation is actually a typical example of "quick and dirty" that does not talk much about the handedness of the frame systems (With an emphasis on plural because in OpenGL, the normalized coordinate frame system is opposite from the others). glm also is tuned for the various precision of floating points that embedded OpenGL has. Vulkan does not have that to my knowledge. Personally I use Eigen to help me with matrix operations.

I'll conclude that the install should not install glm. I do agree with you that it is outside of the project. The current install I created doesn't do it right now, and that's probably better that way.

How about the glfw? I was surprised to see that from within the CMake framework, it got automatically installed. For somebody downloading vku for the first time, it might be good to have it installed because the vku_framework references it and is used in the examples. However, if it is already installed, the situation may get confusing or the install may fail (I haven't experienced it though but I have two more machines on which I can experiment). One solution to which I hinted early on would be to check if it is already installed with a find_package(glfw3) and make sure it is not reinstalled if a proper version is found.

PS: glfw is very lightly coupled to vku_framework and could easily be uncoupled.