nvpro-samples / vk_video_samples

Vulkan video samples
Apache License 2.0
262 stars 43 forks source link

Specify CMake generator in build scripts #40

Open kkartaltepe opened 1 year ago

kkartaltepe commented 1 year ago

Currently update_external_sources.sh::build_glslang in the decoder project does not specify a generator and assumes the user has not configured an alternative default (a relatively new feature in CMake).

It would help to avoid issues to specify the generator explicitly with -G "Unix Makefiles" (similar to build_shaderrc) when you do not use the generator aware cmake build wrapper functions.

zlatinski commented 7 months ago

Hi kkartaltepe, currently shaderrc is built using the Ninja generator. Would you like for us to change this to GnuMake, as well?

kkartaltepe commented 7 months ago

This bug is not about the chosen build generator, only making your own choices work on other people's machines.

If you hardcode the generator into your script, you should also hard code the generator into your cmake calls. This way your script works when the default on my machine is not the default on your machine.

kkartaltepe commented 7 months ago

For example,

https://github.com/nvpro-samples/vk_video_samples/blob/main/vk_video_decoder/update_external_sources.sh#L87

Correctly specifies -G Ninja and then hardcodes calls to ninja.

https://github.com/nvpro-samples/vk_video_samples/blob/main/vk_video_decoder/update_external_sources.sh#L58

Incorrectly creates using the default generator, and then hardcodes calls to make. This is often found in legacy cmake code prior to the introduction of configuration default generators and the generator aware cmake --build command line.