How do you declare manifest constants?
schveiguy at gmail.com
Thu Nov 4 17:09:31 UTC 2021
On 11/4/21 12:43 PM, Andrey Zherikov wrote:
> I want to embed some info from build system - version info, for example.
> I can easily do this with C++ compiler by `-DVERSION="1.2.3"` but there
> is no such an option in dmd. So I'm wondering how do people workaround
> I see only one way: generate a file and add it to the build (file might
> be `.d` source or something included by import expression).
D doesn't have any equivalent for this. The closest you can get is to
turn on `version` identifiers.
There is also a quirky `-version=123` which is IMO, a completely useless
Your best bet is to do what you are doing -- generate a d file, and then
Note, there is at least one dub package which does this for you:
I use it in my build and it works OK. You just have to remember to
attribute your tag in git.
More information about the Digitalmars-d-learn