[Scons-users] Need help in understanding scon build approach
Harry Cruise
princeharry_89 at yahoo.com
Sun Jun 15 05:30:12 EDT 2014
Directory Structure:
WorkSpace/root_dir |_ SConstruct|_ multipy |_ include |_ mul.h |_ src |_ mul.cpp |_ SConscript|_ sum |_ include |_ sum.h |_ src |_ sum.cpp |_ SConscript|_ src_main |_ main.cpp |_ SConscript
Contents of root_dir/SConstruct:
# This Sconstruct file should build:# Static and Shared libraries of sum and mul for both release(build/release) and debug mode(build/debug) and place it into the directory as mentioned in parenthesis# Finally build executable for main.cpp by linking it with sum and mul libraries# and place it into src_main/build/release and src_main/build/debug directoriesimportos
env =Environment()debug_env =env.Clone(CCFLAGS ='-g')release_env =env.Clone(CCFLAGS ='-O2')SConscript('SConscript',variant_dir='build/debug/',export={'env':debug_env},duplicate=0)SConscript('SConscript',variant_dir='build/release/',export={'env':release_env},duplicate=0)
Contents of multiply/src/SConscript file :
# The main purpose of this SConscript file is to create static and shared library version# for release and debug mode# It should also creates objects and place it into build/release and build/debug # directories inside multiply directoryimportos import('env')libs =['limul.a','libmul.so']env.StaticLibrary(target ='mul',source =Glob('src/*.cpp'))env.SharedLibrary(target ='mul',source =Glob('src/*.cpp'))Return('libs')
Similar kind of SConscript file is present in sum directory for the same purpose as mentioned in comment of multiply/src/SConscript file.
For src_main/SConscript:
importos import('env')Program('main.cpp',LIBS=['sum','mul'],LIBPATHS=[])# How should I mention LIBPATHS here ?
Running the scons command from root_dir throws message
scons '.' is
upto date without building anything, with the warning that build/release/SConscript not found.
I am new user of scons build tool, And wasn't able to do this kind of simple example which is a very common practical scenario.
Please suggest me necessary details to fix error and add optimization in my approach to fulfil the requirement/purpose so that example becomes complete. And kindly help me to
learn this much better.
I appreciate any help and pointer, Thanks in advance !!
Regards,
Harry
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://four.pairlist.net/pipermail/scons-users/attachments/20140615/578f7bfa/attachment-0001.html>
More information about the Scons-users
mailing list