[Scons-users] SCons is only installing .lib part of SharedLibrary on Windows when target is specified

Damien damien at khubla.com
Wed Feb 6 12:35:07 EST 2013


I'm late to this conversation, but we ran into this a few years ago.
The way we guaranteed to get our installs right on every build was to
not specify build targets directly on the command line, but to specify
them through our own command-line options that we pre-processed
ourselves in SConscripts. We have separate build, lib and bin
directories. Then we had our lib/dll installs as Default actions in the
SConscript files, like this:

....
....
simlib1 = thisenv.SharedLibrary('simlib', libsources)
simlibinstall = thisenv.Install(thisenv['LIBDIR'], simlib1)
simdylibinstall = thisenv.Install(thisenv['BINDIR'], simlib1)
Default(simlibinstall + simdylibinstall)

This does bypass SCons' target processing and other smarts, but it means
you get exactly what you ask for each time, on every OS. It's just more
work to write the preprocessing part.

Damien

On 06/02/2013 10:21 AM, Dan Pidcock wrote:

> On 6 February 2013 16:59, Dan Pidcock <dan.pidcock at googlemail.com> wrote:

>> On 1 February 2013 17:58, Gary Oberbrunner <garyo at oberbrunner.com> wrote:

>>> On Fri, Feb 1, 2013 at 11:28 AM, Dan Pidcock <dan.pidcock at googlemail.com>

>>> wrote:

>>>> On 1 February 2013 15:33, Gary Oberbrunner <garyo at oberbrunner.com> wrote:

>>>>> On Fri, Feb 1, 2013 at 10:24 AM, Dan Pidcock

>>>>> <dan.pidcock at googlemail.com>

>>>>> wrote:

>>>>>> However, looking through the --taskmastertrace output did show that

>>>>>> the DLL wasn't even being considered when just the application was

>>>>>> being built, but the .lib was being considered.

>>>>>

>>>>> This is correct behavior -- you don't need the .dll to link the .exe.

>>>>> Your

>>>>> Install should pick up both, however, and I think it is.

>>>>> You're using Default(), which tells SCons what to build if you don't

>>>>> specify

>>>>> any targets on the cmd line. In your run 1, though, you do specify a

>>>>> target

>>>>> (your exe) -- so it builds only what's needed to build that target.

>>>>>

>>>>> Maybe what you want is Alias('all', ...) instead of Default(), and then

>>>>> say

>>>>> Default(Alias('all')) to build all by default?

>>>> I think I understand: Currently what I have tells SCons to install the

>>>> library when no target is specified, but when I specify a target I

>>>> still need to tell it to install the library?

>>>

>>> Correct. SCons will only build what it's told to. Default() is only used

>>> when no command-line targets are specified. And further, if there's no

>>> Default(), everything under the current dir is built.

>>>>

>>>> How do I do the latter?

>>>>

>>>> I tried:

>>>> Alias('all', sampleApplicationEnv.Install(binDir, sampleApplication))

>>>> Default(Alias('all'))

>>>> in the application SConscript

>>>> and:

>>>> Alias('all', sampleLibraryEnv.Install(binDir, sampleLibrary))

>>>> Default(Alias('all'))

>>>> in the library SConscript

>>>> but that also only installed the .lib and not the .dll

>>>

>>> That should have worked. Print out sampleLibraryEnv.Install(binDir,

>>> sampleLibrary)) and see if it's a list containing your dll.

>>> Do the printing like this:

>>> stuff=sampleLibraryEnv.Install(binDir, sampleLibrary))

>>> print [str(x) for x in stuff]

>>> because the elements of the list are Nodes, and you need to print their

>>> string representations. If your DLL is in that list, then it should get

>>> into the alias, and thence into the default (which of course is only used if

>>> you don't specify a target).

>>




More information about the Scons-users mailing list