-
-
Notifications
You must be signed in to change notification settings - Fork 320
BasicConcepts
This is a brief glossary of terms:
Construction Environment - when SCons makes decisions about how to build, it does so in the context of a construction environment with dependency trees, helper functions, builders, variables which control builders and other stuff. The SCons environment is created in memory and some parts of it are saved to disk to speed up things on the next start. It is often referred to as just Environment, which can be a little confusing as there many things in computing called environment (see especially System Environment below). There can be multiple construction environments active in a project, to account for different parts of the build needing different settings.
System Environment - is a familiar operating system container with environment variables such as PATH
, HOME
etc. It is accessible via the os.environ
mapping in Python and therefore in SCons. SCons does not automatically import settings from the system environment (like flags for compilers, or paths for tools) implicitly, because it's designed to be a crossplatform tool with predictable/repeatable behavior. That's why if you rely on any system PATH
or environment variables you need to extract those in your SConscript files explicitly. SCons documentation may also use the term External Environment for this.
Execution Environment - this is a kind of system environment: specifically, the one that SCons constructs for when it calls out to external commands such as compilers, linkers, etc. The execution environment for a given construction environment is stored in that environment's ENV
variable, and can be manipulated by the configuration scripts.
SConstruct - the default name of the main build configuration script SCons will execute to process the build. Even if given a different name and invoked as scons -f scriptname
it will still be referred to as the SConstruct in conversation.
SConscript - default name for additional SCons configuration scripts, usually placed in subdirectories of the project. They are used to help organize hierarchical builds. Need to be included in the build explicitly (for example by calling the SConscript
method). Generically, the entire collection of build scripts will often be referred to as "the SConscript files" even if other names are used (the term tends to include the SConstruct as well).
Construction Variable - variables within a Construction Environment which are used to instruct SCons about builds. Construction Variables can describe compiler flags, locations of commands to execute, and many other characteristics.
Builder - an SCons object that you explicitly call from an SConscript file instruct SCons that a source or set of sources should map to a build target or targets. Builders encapsulate rules on how to transform from a source file type to a target file type, for example, the Program
builder knows how to go from a source file (C, C++, Fortran, etc.) to an executable program file. The power of SCons is in the fact that dependencies are deduced and tracked automatically. When source files change, the system automatically detects which targets should be rebuilt.
Scanner - Scanner objects are used to scan source files for additional dependencies referenced inside a file but not passed as sources to a Builder. For instance, the C scanner identifies files included by a C preprocessor #include
statements).
Action: Actions are callable objects that do something (execute an external command or call a python function, for instance). A Builder retains a list of Actions needed to update its targets; those Actions are run when needed.
Node: a Node normally represents a filesystem object such as a file or directory. SCons Nodes form the nodes of the dependency graph; the arcs, which represent dependencies, are created by using Builders. There are also Alias nodes and Value nodes which represent SCons Aliases and a string value, respectively.
Tool - a Tool or more properly a Tool Module in SCons is a component that adds Builders, Scanners and other helpers to SCons environments for use within scripts. SCons scans several locations to find tool modules - there can be project-specific or installation-specific add-ons for extending core functionality. Note that unlike the common usage of tools in computing, of an external program that constructs something for you, in SCons a tool is only responsible for initialization of the environment to use certain internal or external facilities for software construction. To put it another way, a tool manipulates Construction Variables such that SCons can use the software the tool refers to.
Signature - SCons computes a signature for an object using a cryptographic hash function which has the property that the same input repeatably leads to the same signature. The default function is MD5. Signatures are used throughout SCons to identify file contents, build command lines, identify cached build artefacts, etc.