Static if on release build
rikki cattermole
rikki at cattermole.co.nz
Fri Oct 20 03:11:13 UTC 2017
On 20/10/2017 3:36 AM, Fra Mecca wrote:
> I can't find any documentation regarding conditional compilation in
> release and debug mode.
>
> I have read the page regarding the topicon dlang.org but adding the
> snippet below makes no difference when compiling with dub -b release
> {
> version(full) {
> //do something
> } else {
> //do something else
> }
>
> How can I produce a release version with different parameters from debug
> using dub and static if's?
Well yeah... full doesn't exist[0].
If debug is turned on:
debug {
} else {
}
That else isn't for 'release'. Release turns on optimizations in the
compiler and disables a few other things like asserts.
If you want to specify a version at the command line use
``-version=MyVersion``. For a debug identifier use ``--debug=MyDebug``
and yes, debug conditions can have identifiers like versions require.
For dub you can specify it via ``versions`` and ``debugVersions``.
[0] https://dlang.org/spec/version.html
[1] http://code.dlang.org/package-format?lang=json
More information about the Digitalmars-d-learn
mailing list