[Scons-users] Storing object files in different directory

Christopher Dimech dimech.christopher at gmail.com
Sat Oct 11 12:33:42 EDT 2014


This SConscript scheme looks similar like recursive
makefiles, which is not much to my liking.

On 11 October 2014 17:12, Dirk Bächle <tshortik at gmx.de> wrote:

> 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
>
>
> _______________________________________________
> Scons-users mailing list
> Scons-users at scons.org
> https://pairlist4.pair.net/mailman/listinfo/scons-users
>



-- 
Christopher Dimech
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist4.pair.net/pipermail/scons-users/attachments/20141011/1f572d2f/attachment.html>


More information about the Scons-users mailing list