Reputation: 1375
I am new to scons and have been trying to build some files, in vain. I am on Linux and am good at Python. Here's my sample SConstruct file:
vstPlugName = 'again'
vstSDKDir = '/home/yati/Projects/Sound/vstsdk2.4'
env = Environment(CPPPATH=vstSDKDir, tools=['g++'])
env['CCFLAGS'] = ['-Wall -O3']
src_dir = vstSDKDir + '/public.sdk/source/vst2.x'
env.Library(vstPlugName, [
vstPlugName + '.cpp',
src_dir + '/audioeffect.cpp',
src_dir + '/audioeffectx.cpp',
src_dir + '/vstplugmain.cpp'
])
The intent is to build a '.o' from the shown cpp files - I tried env.Object() but it raises an exception saying "multiple sources given for an object file..." - understandable. But then when I run scons
for the above SConstruct script, I get this:
scons: Reading SConscript files ...
AttributeError: 'SConsEnvironment' object has no attribute 'Library':
File "/home/yati/Projects/Sound/development/again/source/SConstruct", line 10:
env.Library(vstPlugName, [
Please help. Also, is there a brief, decent intro on scons for Linux? I don't really have the time to go through the entire manpage or the official docs.
Upvotes: 3
Views: 1872
Reputation: 6155
By setting the tools attribute you tell scons to only use the tool "g++". By the looks of it it doesn't look like the "g++" tool include the linker so the environment no longer supports the Library call. If you use gcc as tool you will include the complete compiler collection so it will compile cpp files with g++.
As you yourself have discovered it is possible to omit the tools entirely in most cases, as Scons will try to select the correct tool for you. But in other cases it might be neccessary to tell Scons to prefer one tool before another. (Like on windows where I prefer SCons to use mingw-g++ instead of visual c++ when compiling c++ code) Then
env = Environment(tools=['mingw'])
is necessary.
Upvotes: 3
Reputation: 663
I'm not sure exactly whats happening but I think you might be clobbering stuff with tools=['g++'].
I think this might work:
env = Environment(CPPPATH=vstSDKDir, tools=['default', 'g++'])
Upvotes: 5