SCons is a
software development tool
A programming tool or software development tool is a computer program that is used to develop another computer program, usually by helping the developer manage computer files. For example, a programmer may use a tool called a source code editor ...
that analyzes
source code
In computing, source code, or simply code or source, is a plain text computer program written in a programming language. A programmer writes the human readable source code to control the behavior of a computer.
Since a computer, at base, only ...
dependencies and
operating system
An operating system (OS) is system software that manages computer hardware and software resources, and provides common daemon (computing), services for computer programs.
Time-sharing operating systems scheduler (computing), schedule tasks for ...
adaptation requirements from a software project description and generates final binary executables for installation on the target operating system platform. Its function is similar to the more popular
GNU build system.
The tool generates
Python scripts for project configuration and build logic.
History
The ''Cons'' software construction utility, written in the
Perl
Perl is a high-level, general-purpose, interpreted, dynamic programming language. Though Perl is not officially an acronym, there are various backronyms in use, including "Practical Extraction and Reporting Language".
Perl was developed ...
, was created by Bob Sidebotham in 1999. It served as a base for the ''ScCons'' build tool, a design which won the
Software Carpentry project SC Build competition in August 2000. ScCons was the foundation for SCons.
SCons inspired the creation of
Waf, formerly known as ''SCons/BKsys'', which emerged in the
KDE
KDE is an international free software community that develops free and open-source software. As a central development hub, it provides tools and resources that enable collaborative work on its projects. Its products include the KDE Plasma gra ...
community. For some time, there were plans to use it as the build tool for KDE 4 and beyond, but that effort was abandoned in favor of
CMake.
Notable projects that use SCons (or used it at one time) include:
The Battle for Wesnoth
''The Battle for Wesnoth'' is a free and open-source software, free and open-source turn-based strategy video game with a high fantasy setting (similar to J. R. R. Tolkien's Tolkien's legendarium, legendarium), designed by Australian-American d ...
,
Battlefield 1942,
Doom 3
''Doom 3'' is a 2004 first-person shooter, first-person shooter game developed by id Software and published by Activision. ''Doom 3'' was originally released for Microsoft Windows on August 3, 2004, adapted for Linux later that year, and Vide ...
,
FCEUX, gem5,
gpsd,
GtkRadiant,
Madagascar
Madagascar, officially the Republic of Madagascar, is an island country that includes the island of Madagascar and numerous smaller peripheral islands. Lying off the southeastern coast of Africa, it is the world's List of islands by area, f ...
,
Mixxx,
MongoDB
MongoDB is a source-available, cross-platform, document-oriented database program. Classified as a NoSQL database product, MongoDB uses JSON-like documents with optional database schema, schemas. Released in February 2009 by 10gen (now MongoDB ...
,
Nullsoft Scriptable Install System,
OpenNebula
OpenNebula is an open source cloud computing platform for managing heterogeneous data center, public cloud and edge computing infrastructure resources. OpenNebula manages on-premises and remote virtualization, virtual infrastructure to build priv ...
,
VMware,,
Wolfenstein: Enemy Territory,
XORP and MCA2,
openpilot and
Godot.
.csig is the SCons Content Signature file format.
Features
Major features include:
* Configuration files are Python; user-written builds can leverage a general-purpose, cross-platform programming language
*
Dependency analysis for
C,
C++ and
Fortran
* Dependency analysis is extensible through user-defined scanners for other languages or file types; unlike
GNU Compiler Collection
The GNU Compiler Collection (GCC) is a collection of compilers from the GNU Project that support various programming languages, Computer architecture, hardware architectures, and operating systems. The Free Software Foundation (FSF) distributes ...
(GCC) dependency analysis, SCons uses a
regular expression
A regular expression (shortened as regex or regexp), sometimes referred to as rational expression, is a sequence of characters that specifies a match pattern in text. Usually such patterns are used by string-searching algorithms for "find" ...
scan for included source files
* Built-in support for C, C++,
D,
Java
Java is one of the Greater Sunda Islands in Indonesia. It is bordered by the Indian Ocean to the south and the Java Sea (a part of Pacific Ocean) to the north. With a population of 156.9 million people (including Madura) in mid 2024, proje ...
,
Fortran,
Objective-C
Objective-C is a high-level general-purpose, object-oriented programming language that adds Smalltalk-style message passing (messaging) to the C programming language. Originally developed by Brad Cox and Tom Love in the early 1980s, it was ...
,
Yacc
Yacc (Yet Another Compiler-Compiler) is a computer program for the Unix operating system developed by Stephen C. Johnson. It is a lookahead left-to-right rightmost derivation (LALR) parser generator, generating a LALR parser (the part of a co ...
,
Lex,
Qt and
SWIG, as well as
TeX
Tex, TeX, TEX, may refer to:
People and fictional characters
* Tex (nickname), a list of people and fictional characters with the nickname
* Tex Earnhardt (1930–2020), U.S. businessman
* Joe Tex (1933–1982), stage name of American soul singer ...
and
LaTeX
Latex is an emulsion (stable dispersion) of polymer microparticles in water. Latices are found in nature, but synthetic latices are common as well.
In nature, latex is found as a wikt:milky, milky fluid, which is present in 10% of all floweri ...
documents
* Support for other languages via custom builders
* Building from central repositories of source code and pre-built targets
* Ability to use
Visual Studio, including the generation of , , and files
* Detection of file content changes using
MD5
The MD5 message-digest algorithm is a widely used hash function producing a 128-bit hash value. MD5 was designed by Ronald Rivest in 1991 to replace an earlier hash function MD4, and was specified in 1992 as Request for Comments, RFC 1321.
MD5 ...
signatures; optional, configurable ability to use traditional timestamps
* Ability to do parallel builds, maintaining a specified number of jobs running simultaneously regardless of directory hierarchy
* Autoconf-like support for finding #include files, libraries, functions and
typedef
typedef is a reserved keyword in the programming languages C, C++, and Objective-C. It is used to create an additional name (''alias'') for another data type, but does not create a new type, except in the obscure case of a qualified typedef of ...
s
* Global view of dependencies, so multiple build passes or reordering targets is not required.
* Ability to share built files in a cache to speed up multiple builds - like
ccache but for any type of target file, not just C/C++ compilation
* Designed from the ground up for cross-platform builds; known to work on
POSIX
The Portable Operating System Interface (POSIX; ) is a family of standards specified by the IEEE Computer Society for maintaining compatibility between operating systems. POSIX defines application programming interfaces (APIs), along with comm ...
systems (including
Linux
Linux ( ) is a family of open source Unix-like operating systems based on the Linux kernel, an kernel (operating system), operating system kernel first released on September 17, 1991, by Linus Torvalds. Linux is typically package manager, pac ...
,
AIX and
OS/2
OS/2 is a Proprietary software, proprietary computer operating system for x86 and PowerPC based personal computers. It was created and initially developed jointly by IBM and Microsoft, under the leadership of IBM software designer Ed Iacobucci, ...
,
*BSD Unices,
HP-UX
HP-UX (from "Hewlett Packard Unix") is a proprietary software, proprietary implementation of the Unix operating system developed by Hewlett Packard Enterprise; current versions support HPE Integrity Servers, based on Intel's Itanium architect ...
,
SGI IRIX
IRIX (, ) is a discontinued operating system developed by Silicon Graphics (SGI) to run on the company's proprietary MIPS architecture, MIPS workstations and servers. It is based on UNIX System V with Berkeley Software Distribution, BSD extensio ...
,
Solaris,
illumos
Illumos (stylized as "illumos") is a partly free and open-source Unix operating system. It has been developed since 2010 and is based on OpenSolaris, after the discontinuation of that product by Oracle. It comprises a kernel, device driver ...
),
Windows NT
Windows NT is a Proprietary software, proprietary Graphical user interface, graphical operating system produced by Microsoft as part of its Windows product line, the first version of which, Windows NT 3.1, was released on July 27, 1993. Original ...
,
OS X
macOS, previously OS X and originally Mac OS X, is a Unix, Unix-based operating system developed and marketed by Apple Inc., Apple since 2001. It is the current operating system for Apple's Mac (computer), Mac computers. With ...
Examples
The following is an SConstruct file that builds a
hello world C program using the default platform compiler:
Program("hello-world.c")
The following is a SConstruct file for a project that includes two source files and specifies build tool options:
env = Environment()
env.Append(CPPFLAGS= -Wall", "-g"
env.Program("hello", hello.c", "main.c"
See also
*
*
*
*
*
References
External links
*
{{DEFAULTSORT:Scons
Articles with example Python (programming language) code
Build automation
Compiling tools
Free software programmed in Python
Software using the MIT license