Please note:The SCons wiki is now restored from the attack in March 2013. All old passwords have been invalidated. Please reset your password if you have an account. If you note missing pages, please report them to Also, new account creation is currently disabled due to an ongoing spam flood (2013/08/27).
Differences between revisions 230 and 231
Revision 230 as of 2013-12-20 10:34:44
Size: 6776
Editor: AlexBurton
Comment: Changes to page approved from queue revision 3.
Revision 231 as of 2014-02-28 18:52:20
Size: 6895
Editor: DirkBaechle
Comment: adding link to new recipe
Deletions are marked like this. Additions are marked like this.
Line 48: Line 48:
 * ExplicitlyCallCppScanner: How to explicitly call the C/CPP scanner on a source file in your SConstruct/SConscript.

This is the place to share tips, examples, and short scripts.

  • The SCons ManPage also contains a number of quick examples. See the Examples section towards the bottom of the page.

Scons : Extending and getting info

Command-Line Arguments and Help



  • GetTargets: you want to look at the targets the user entered

  • PhonyTargets: A close approximation of a target that is always built

  • DependsAndAliases: How to ensure Alias() work correctly with Depends()

Install & Uninstall Targets

Clean Targets

Source Files

  • BuildDirGlob lets you glob for source files from a build directory.

  • ExternalFiles: how to use other source files not recognized by scons (e.g. linker scripts)

  • UsingCvs: how to download source files from a CVS server

  • WgetSourceCode: How to use sourcecode() methods to 'wget' files

  • DynamicSourceGenerator: how to use a source generator that puts out many source files, by having scons add targets dynamically.

  • FindTargetSources: Find sources and headers for a target when generating MSVSProject.

  • AddFilesDynamically to every build per-environment

  • MFObject: Compile multiple source files with a single invocation of the compiler

  • ExplicitlyCallCppScanner: How to explicitly call the C/CPP scanner on a source file in your SConstruct/SConscript.

Building and Linking

  • UsingOrigin: using $ORIGIN to specify runtime search path for libraries

  • UsingPkgConfig: many libraries these days come with .pc files, such as GTK+, but how do you use them?

  • SharedLibrarySignatureOverride: avoid relinking every program when a shared library is rebuilt.

  • BuildTimeCallback: How to have a function called at build time

  • RightNow: Build one or more targets during the SConscript reading phase, then continue reading SConscripts

Build Dirs

Build logs

  • BuildLog: How to write SCons output to a file as well as the screen.

  • ColorBuildMessages: Replace the raw build commands printed to the screen with colored messages

  • ColorGcc: using the colorgcc wrapper to colorize the output of compilers with warning / error messages matching the gcc output format.

  • HidingCommandLinesInOutput: how to hide all or part of the printed command lines for prettier build logs.



Multiple Projects

Increasing performance and large builds


Full-blown Examples

  • AdvancedBuildExample: This document describes how the Bombyx project is doing its builds. This configuration is interesting in that it builds for each target platform in a different directory, and has a very structured build.

  • ExtendedExample A log of John Arrizza's quest to convert an Ant-based build system to SCons.

  • AllInSConstruct Bill Baxter's attempt at a SCons-based build system.

  • RpmHonchoTemp: JeffPitman's adventure in coercing SCons to manage an RPM repository.

  • BasicSimpleProject: Andrew Lentvorski's venture to build Gambit with SCons on his way to cross-compiling

  • SimpleProject_1: A simple project with libraries and profile information

  • MavenIdeasWithSCons: An approach of using some maven ideas and best practices with SCons.

  • SDLWindowsApp: A typical SDL application on Windows (including icon and no annoying dialog pop-up)

SconsRecipes (last edited 2014-02-28 18:52:20 by DirkBaechle)