View previous topic :: View next topic |
Author |
Message |
JJBananas
Joined: 16 May 2007 Posts: 5
|
Posted: Thu May 17, 2007 2:41 pm Post subject: DMD compiler with -od and -op flags? |
|
|
I'm trying to create separate directories for storing obj files, one for debug builds and one for release builds. So I use -odDebug and -odRelease, and that works fine. I would also like to retain the relative directories of the source tree so I use the -op flag, but this doesn't work, and examining the .rsp file show that the -op flag is not passed to the compiler at all.
By searching for "-op" in build.d, I notice that this seems to have been explicitly disabled (build.d:1758). (Although I haven't looked at the workings of this file enough to really understand what's happening, so I might be wrong). Is there a good reason this isn't allowed? |
|
Back to top |
|
|
Derek Parnell
Joined: 22 Apr 2004 Posts: 408 Location: Melbourne, Australia
|
Posted: Thu May 17, 2007 5:53 pm Post subject: Re: DMD compiler with -od and -op flags? |
|
|
JJBananas wrote: |
By searching for "-op" in build.d, I notice that this seems to have been explicitly disabled ... Is there a good reason this isn't allowed? |
Yes there is.
"-od<X>" means store the object files in <X>
"-op" means store an object file in the same directory as its source file.
There are mutually exclusive - you can't do both, unless <X> is the same place as where all the source files reside.
It is a commonly assumed that "-op" means store files relative to the source directories, but that is not the case.
I wish there was an option in DMD to specify a base path and then get all the object files to be stored realtive to that base according to the 'source' path. The only way I can do this with the current DMD is to compile each source file separately, specifying the target directory with -od<Y> where I 'calculate' <Y> based on the absolute source path and the base path supplied by yet another switch ...
For example, if the I have source files ...
Code: |
c:\myproject\file1.d
f:\standard\utils\someutil.d
c:\bobs\packages\foo.d
|
and you supplied the base directory as "e:\temp\obj"
I would have to compile each file separately, specifying ...
Code: |
dmd -ode:\temp\obj\c_drive\myproject\ c:\myproject\file1.d
dmd -ode:\temp\obj\f_drive\standard\utils f:\standard\utils\someutil.d
dmd -ode:\temp\obj\c_drive\bobs\packages c:\bobs\packages\foo.d
|
rather than have DMD compile all three files in one execution.
This is something I'm planning to do for a future release of Bud. _________________ --
Derek
skype name: derek.j.parnell |
|
Back to top |
|
|
JJBananas
Joined: 16 May 2007 Posts: 5
|
Posted: Fri May 18, 2007 7:33 am Post subject: |
|
|
Okay, thanks for the explanation. It makes a lot of sense.
After reading what you said about the -op flag I experimented a bit, and I understand why you have disallowed it in the general case. Absolute paths, or even relative paths that point above the current path, can case trouble.
It turns out that what I was panning to do would work, I think, as long as I only used relative paths, below the current directory. Personally I would consider any files in directories above the current one to be separate libraries that need to be compiled separately and then linked in, but I understand why you want to prevent problems for people who do do it that way.
Overall, it's only a minor inconvenience. |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|