[Scons-users] scons and windows
Tom Tanner (BLOOMBERG/ LONDON)
ttanner2 at bloomberg.net
Wed Mar 11 04:45:10 EDT 2015
I'm setting up an scons build for a windows project with QT (using Dirk's QT stuff) which produces a bunch of .DLL, .lib, and .exe targets. A minimal example for the 2nd problem will take some time, but for the first, I want to do 'debug' and 'release' builds. The first should produce pdbs and the 2nd shouldn't.
Anyway, currently this is what I do for the debug config on the SConstruct
env['LINKFLAGS'] += [ '/DEBUG' ]
env['CPPFLAGS'] += [ '/Z7' ]
and then visual studio 10 generates *automatically* a .pdb with the same name as the dll/exe for every dll and exe I build. And I get debugging information for the .lib files as well.
But, as far as I understand it, the current version of SCons requires me to do (and this syntax is probably wrong)
env.Program('fred', Glob('*.cpp'), LIBS = stuff, PDB = 'fred' if config == 'debug' else None)
for every dll and exe in the project. And I still need to set CPPFLAGS globally so that my .libs get the debugging information built into them (again, as I understand it).
This seems a waste of effort - firstly I need to enter the target name twice and secondly I need to have the same boilerplate for every executable / dll that gets build.
I guess a simple fix for this for my project would be to wrap the linker emitter with a test to see if '/DEBUG' is in LINKFLAGS and then generate an extra target, but I think there's a more general requirement here.
From: bill at baddogconsulting.com At: Mar 10 2015 02:51:03
To: Tom Tanner (BLOOMBERG/ LONDON), scons-users at scons.org
Subject: Re: [Scons-users] scons and windows
Tom,
In general, I'ved used the PDB as an argument to the builder so:
env.Program('tartget',[sources...], PDB='somefile.pdb')
If you post a sample of your SConstruct we can see what's happening, even better a minimal example.
-Bill
On Mon, Mar 9, 2015 at 4:21 AM, Tom Tanner (BLOOMBERG/ LONDON) <ttanner2 at bloomberg.net> wrote:
I started playing around with scons / qt4 on windows at home last week and have a couple of questions / oddities / potential issues
1) There's an env['PDB'] which according to the documentation you set to the name of the pdb file the linker should generate. Given that in the main you'd want it to be the same as the executable / DLL, couldn't you just set it to 'True'?. This'd be a lot of help in the project I'm trying to create an scons replacement build for as I'd just need to set this once in the SConstruct file to generate these for everything, rather than in each SConscript file. My experience with visual C++ 10 is if you link with /DEBUG you get a .pdb file with the expected name, without having to specify anything else to the linker.
2) For reasons that are beyond me, scons appears to be running the linker *twice* when it generates an executable. That is to say the output is along the lines of
using temporary file xxxx for command
link /OUT:thingie.exe <enormous command line>
link /OUT:thingie.exe @xxxx
using temporary file yyyy for command
link /OUT:thingie.exe <enormous command line>
link /OUT:thingie.exe @yyyy
where the entire command line is identical.
Haven't finished the work of adding it yet, but it's already showing benefits. Not the least of which is I can open a subproject by itself, and just build that, which is completely impossible with qmake.
_______________________________________________
Scons-users mailing list
Scons-users at scons.org
https://pairlist4.pair.net/mailman/listinfo/scons-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist4.pair.net/pipermail/scons-users/attachments/20150311/e055fce8/attachment.html>
More information about the Scons-users
mailing list