On Thursday, 19 January 2017 at 18:58:31 UTC, Dlearner wrote:
Hey!
I wrote a little program that has an image bounce around and change colours, like the old DVD player screensavers. How can I build this as a little .exe file that I can send to someone? In the dub documentation there is something like `dub --build=<release>`, but I'm not entirely sure what this does.

Thanks!

Hello!

The binary should be in the working directory:

```
➜   dub init
Package recipe format (sdl/json) [json]:
Name [test-dub]:
Description [A minimal D application.]:
Author name [Nemanja]:
License [proprietary]:
Copyright string [Copyright © 2017, Nemanja]:
Add dependency (leave empty to skip) []:
Successfully created an empty project in '/home/burgos/work/test-dub'.
Package sucessfully created in .
➜ echo 'import std.stdio;\nvoid main() { writeln("Hello!"); }' > source/app.d
➜   dub --build=release
Performing "release" build using dmd for x86_64.
test-dub ~master: building configuration "application"...
Linking...
Running ./test-dub
Hello!
➜   ./test-dub
Hello!
➜   ll
total 820K
-rw-rw-r-- 1 burgos burgos  168 Jan 19 21:53 dub.json
drwxrwxr-x 2 burgos burgos 4,0K Jan 19 21:52 source
-rwxrwxr-x 2 burgos burgos 811K Jan 19 21:53 test-dub <- the executable
```

You can ommit --build=release - this makes a "release mode" binary (without assertions and bounds check), which is a faster & smaller version of the binary, but with less sanity checks.

Reply via email to