icculus / mojoshader

Use Direct3D shaders with other 3D rendering APIs.
https://icculus.org/mojoshader/
zlib License
139 stars 36 forks source link

CMake: Fall back to unknown version when Hg repo is missing #3

Closed kiates closed 5 years ago

kiates commented 6 years ago

The readme says that if you don't have cmake you can pass MOJOSHADER_NO_VERSION_INCLUDE, however there is a case where you may be working with a non-hg cloned repository (but still have hg installed and using cmake). If hg is not detected it uses -1, and so it seems reasonable that if you want to bypass the version generation, it should use the same -1 value if you explicitly pass -DMOJOSHADER_NO_VERSION_INCLUDE.

kiates commented 6 years ago

Without this, you are forced to edit the generated version file and add -1 or something to the #define in the file.

flibitijibibo commented 6 years ago

What we should probably do is make it so we don't even need to define this ourselves - let's add error checking to the HG path so that failure to get an hg revision falls back to "???" instead of producing an empty define.

flibitijibibo commented 6 years ago

Hey @rcgordon, how does this look? I can make a Mercurial version of this patch if this looks good to you.

flibitijibibo commented 5 years ago

This is now in fna-staging, which is where I'm keeping things until Ryan merges stuff into Hg (which can take some time...).