www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Making .exe

reply Dlearner <daz20 msn.com> writes:
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!
Jan 19 2017
parent reply Nemanja Boric <4burgos gmail.com> writes:
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.
Jan 19 2017
parent reply Dlearner <daz20 msn.com> writes:
On Thursday, 19 January 2017 at 20:56:41 UTC, Nemanja Boric wrote:
 On Thursday, 19 January 2017 at 18:58:31 UTC, Dlearner wrote:
 [...]
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.
Yo! Okay I did this and I run the .exe and it works, but if I try to copy/paste it on my desktop and run it, it (obviously) doesn't work. Is there a way to somehow compile the source, .dll's and image file that I'm using together into one executable?
Jan 19 2017
parent Mike Parker <aldacron gmail.com> writes:
On Thursday, 19 January 2017 at 21:47:53 UTC, Dlearner wrote:

 Yo!
 Okay I did this and I run the .exe and it works, but if I try 
 to copy/paste it on my desktop and run it, it (obviously) 
 doesn't work.  Is there a way to somehow compile the source, 
 .dll's and image file that I'm using together into one 
 executable?
If your app has dependencies, you should bundle them all up and distribute it all as a zip file or installer. That's not specific to D.
Jan 19 2017