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

Dan Pidcock dan.pidcock at googlemail.com
Fri Feb 1 10:24:15 EST 2013


On 31 January 2013 21:30, Bill Deegan <bill at baddogconsulting.com> wrote:

> On Thu, Jan 31, 2013 at 5:37 AM, Dan Pidcock <dan.pidcock at googlemail.com>

> wrote:

>>

>> I have a project that contains a SharedLibrary and a Program, and when I

>> do a scons build with no target specified it works fine, but when I do a

>> build with the program specified as the target after changing a source file

>> in the library, it rebuilds the .lib and.dll but only installs the .lib (log

>> output below). In fact I don't really want it to install the .lib anyway as

>> that is just required for building.

>>

>> The source is structured as a library and an application directory with a

>> SConscript in each and a SConstruct at the root. There is then a separate

>> build directory and a bin directory where shared libraries and executables

>> should be installed.

>>

>> The SConstruct basically sets compiler flags and then calls:

>>

>> projects=[ 'SampleLibrary', 'SampleApplication',]

>>

>> for project in projects:

>>

>> variant_dir = buildDir # D:\Build on windows

>>

>> for dir in string.split(project, '/'):

>>

>> variant_dir = os.path.join(variant_dir, dir)

>>

>> SConscript([project+'/SConscript', ], exports='env binDir buildType',

>> variant_dir=variant_dir, duplicate=dupSrc)

>>

>> where dupSrc is switched off for Windows

>>

>> and the SConscripts look like:

>>

>> Import('*')

>>

>> projectName='SampleLibrary'

>>

>> projectEnv = env.Clone()

>>

>> project = projectEnv.SharedLibrary(projectName, Glob('*.cpp')) # or

>> .Program

>>

>> Default(project )

>>

>> Default(projectEnv.Install(binDir, project))

>

>

> It may be because on windows SharedLibrary() returns more than one node (

> the .dll and the .lib usually).

>

> Try:

> for n in projectEnv.Install(binDir, project):

> Default(n)

>

> See if that resolves the issue.

> If so, then I'd guess that Default() isn't handling more than a single node.

> (which it should according to the docs..)

>

> -Bill


Bill,

That didn't make any difference so it looks like Default is handling
multiple nodes OK.

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. With that in mind, I
added the DLL to the LIBS in the SConscript (because I imagine that is
how SCons knows that the application depends on the .lib) and it works
OK. However this is not cross-platform so is there a better way to do
this?

i.e., I did:
projectEnv.Append(LIBS=['SampleLibrary', 'SampleLibrary.dll'])

Dan


More information about the Scons-users mailing list