Please note:The SCons wiki is in read-only mode due to ongoing spam/DoS issues. Also, new account creation is currently disabled. We are looking into alternative wiki hosts.
Differences between revisions 231 and 232
Revision 231 as of 2014-02-28 18:52:20
Size: 6895
Editor: DirkBaechle
Comment: adding link to new recipe
Revision 232 as of 2014-07-18 01:43:57
Size: 7026
Editor: AlexBurton
Comment: Added NonDeterministicDependencies
Deletions are marked like this. Additions are marked like this.
Line 38: Line 38:

== Tree Problems ==
 * NonDeterministicDependencies How to incorperate builders which can produce an unknown number of results

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

Tree Problems

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-07-18 01:43:57 by AlexBurton)