[Scons-users] Storing object files in different directory
Gary Oberbrunner
garyo at oberbrunner.com
Sat Oct 11 13:04:48 EDT 2014
It may be able to work like that, I'm not sure. In this case botoh.sc
would look like:
SConscript('../../lib/lib.sc', build_dir='.')
but I think SCons may still have trouble with source dirs that are outside
the "SCons tree"; SCons considers the source tree to be below the main
SConstruct. That's why it's easiest to have your main SConstruct at the
top level.
Still, if you _need_ to have the main SConstruct down a few levels, try the
above and let us know if it works.
(I'm not sure it'll be the friendliest thing for your users to have to cd
down a couple of levels before invoking the build script, whatever build
system you use, but of course that's up to you.)
On Sat, Oct 11, 2014 at 12:59 PM, Christopher Dimech <
dimech.christopher at gmail.com> wrote:
> I want to specify the path (another directory) where the object
> files go from the SConstruct file which exists in another directory.
>
> Here is the structure
>
>
>
> /vik/build/sc/botoh.sc
> /vik/lib/endian.f
> /vik/utils/botoh.f
>
>
> Then run the script as follows
>
>
> cd vik/build/sc
> scons -f botoh.sc
>
>
>
>
>
>
>
>
> On 11 October 2014 17:33, Christopher Dimech <dimech.christopher at gmail.com
> > wrote:
>
>> 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
>>
>
>
>
> --
> Christopher Dimech
>
> _______________________________________________
> Scons-users mailing list
> Scons-users at scons.org
> https://pairlist4.pair.net/mailman/listinfo/scons-users
>
>
--
Gary
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist4.pair.net/pipermail/scons-users/attachments/20141011/eee3e575/attachment.html>
More information about the Scons-users
mailing list