Start with scons » History » Revision 2
« Previous |
Revision 2/3
(diff)
| Next »
jun chen, 03/10/2025 12:50 AM
Start with scons¶
where is scons¶
scons is in /home/hqtan/local/bin/scons
, you should add this path to $PATH
: or set alias to it.
recommend to add alias scons to "bsub -I -q centl /home/hqtan/local/bin/scons"
useful command¶
- compile
scons
- clean
scons -c
or
git clean -xdf ../
- create release
scons --cut
- test create release, save time w/o copy ext and compress
scons --cut --test
- debug mode
scons VFRBOSF=l
Code Structure¶
how does the scons work?¶
scons works like make, but the main depend file name is SConstruct instead of makefile,
firstly it will search SConscruct
file in current directly, will complain error if not found, for a hierarchy code,
secondly it will try to find SConscript
in each sub-directory.
In the SConstruct
, we need call env.SConscript
to compile each sub-directory.
More details refer to¶
scons-man.pdf
scons-user.pdf
Compile_and_linke_using_Scons.pdf
how to add a sub module?
scons --init=module—name
Example of SConscript¶
- generally the env comes from the top level SConstruct which defined some variable and functions, if we will change somethings in it, we should do Clone before use it.
- DEPENDS include the dependency of current module, it will be used as Link directory(-L) when link the binary.
- LIBS include the linked library name, it will be used as -lklibname> when link the binary
- LINKFLAGS include extra link flags, it will be used when link the binary
- cpp_files include all source files which should be compiled, alway remember add your source file into this list when you add a new cc file
- build_vesper_target accept above arguments and do compile and link
- the argument exectuable was specified means we want to build a binary, else if we should specify shared_library to build a shared library instead.
- in Vesper we expect each module is a shared library instead of a static library to reduce the size of the total package.
Updated by jun chen 3 months ago · 3 revisions