[Scons-users] Storing object files in different directory
Dirk Bächle
tshortik at gmx.de
Sat Oct 11 12:12:47 EDT 2014
Hi Christopher,
On 11.10.2014 17:02, Christopher Dimech wrote:
> The problem I have is that I have two source directories,
> lib and utils. The directory utils is where the main program
> resides, lib is where the other fortran files exist. Where should
> the SConscript file reside?
>
> [...]
>
in general it makes sense to have an SConscript in each folder where
your input files are, and a "module" (=program/library/...) gets built.
This makes it easier to reference filenames within each "module",
because these names are interpreted relative to the location of the
current SConscript file.
So, in your case I'd have an SConscript in "lib":
Import('env')
env.Libary('mylib', Glob('*.f'))
and another one in "utils":
Import('env')
env.Append(LIBS=['mylib'])
env.Append(LIBPATH=['../lib'])
env.Program('botoh.x', Glob('*.f'))
. For being able to build both of these "modules" into a Variant dir,
I'd then add another "SConscript" at top-level:
SConscript('lib/SConscript')
SConscript('utils/SConscript')
and finally call this SConscript from the top-level SConstruct with the
"variant_dir=" option as:
env = Environment(...)
Export('env')
SConscript('SConscript', variant_dir='build')
Best regards,
Dirk
More information about the Scons-users
mailing list