Search code examples
ddmd

How can I set an output directory for rdmd (Windows)?


I know, that in dmd it can be done like this:

> cd ..\bin
> dmd ..\src\example.d

or like this:

> dmd example.d -offilename ..\bin\example.exe

But in rdmd this methods doesn't work. File "example.exe" always appears in the same folder with "example.d".

I tried to do this

> rdmd --build-only example.d ..\bin\example.exe

, this

> rdmd --build-only example.d -offilename ..\bin\example.exe

and this

> cd ..\bin && rdmd --build-only ..\src\example.d

with the same negative result.


Solution

  • You got the syntax of -offilename wrong. filename is a sample value. You need to replace it: -of..\bin\example.exe. Many other dmd options work in the same way.

    Also, rdmd doesn't pass arguments that come after the source file to dmd. They are interpreted as arguments to the program that's built and run (regardless of --build-only). That means, you need to put -of..\bin\example.exe before example.d:

    rdmd --build-only -of..\bin\example.exe example.d