Noxagonal/Vulkan2DRenderer

Fix to always recompiling shaders

Closed this issue · 3 comments

exuvo commented

We managed to stop cmake from always recompiling the shaders. Now it only recompiles when any shader source file is changed or during clean builds.

The changes are:
Move generated shader headers out of the glob recurse so it stops rebuilding because it sees the previous compile changed the files.
Manually include IncludeAllShaders.h as a source file.
Tell CMake that the add_custom_command produces IncludeAllShaders.h.
Tell CMake that the add_custom_command depends on the shader sources so it reruns on shader changes.

I tried to make a pullrequest but i can't make it build on my machine without all the other changes we have made so i'll just link the commit here and you can merge it in yourself. exuvo@a86522a exuvo@e36319d

Unfortunately this makes the shader compiler tool run every time on VS for some reason. I'm okay with shaders being outside of the Source folder but I might add a special case for VS in CMakeLists.txt going back to the original behavior.

VS is being rather weird about this, at this point I'm pretty sure it's a limitation but I'll see if I can figure something out.

exuvo commented

Wow thats wierd for us it is the opposite. Your version runs all the time for us and the linked changes makes it only run when needed. You did clean the build directory before testing the CMake change right?

My IDE is eclipse on linux and my buddy is using Visual Studio Code natively on linux so i thought it would behave the same as normal Visual Studio.

Yeah I tried clean build too, I spent way too many hours trying to get that to work so I'll leave a different path for VS for now and try it again later.