SCons is a
computer software
Software is a set of computer programs and associated documentation and data. This is in contrast to hardware, from which the system is built and which actually performs the work.
At the lowest programming level, executable code consists ...
build tool that automatically analyzes source code file dependencies and operating system adaptation requirements from a software project description and generates final binary executables for installation on the target operating system platform. Its function is analogous to the traditional
GNU build system based on the
make utility and the
autoconf
GNU Autoconf is a tool for producing configure scripts for building, installing, and packaging software on computer systems where a Bourne shell is available.
Autoconf is agnostic about the programming languages used, but it is often used for ...
tools.
SCons generates project configurations and build process implementations in the form of
Python scripts.
Major features
Major SCons features include the following:
* Configuration files are Python scripts, which means that user-written builds have access to a complete general-purpose programming language.
* Automatic
dependency analysis built-in for
C,
C++ and
Fortran. Dependency analysis is extensible through user-defined dependency scanners for other languages or file types. Unlike the
GNU Compiler Collection
The GNU Compiler Collection (GCC) is an optimizing compiler produced by the GNU Project supporting various programming languages, hardware architectures and operating systems. The Free Software Foundation (FSF) distributes GCC as free sof ...
's (GCC) built-in dependency analysis, it 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 search 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 (; id, Jawa, ; jv, ꦗꦮ; su, ) is one of the Greater Sunda Islands in Indonesia. It is bordered by the Indian Ocean to the south and the Java Sea to the north. With a population of 151.6 million people, Java is the world's mo ...
,
Fortran,
Objective-C
Objective-C is a general-purpose, object-oriented programming language that adds Smalltalk-style messaging to the C programming language. Originally developed by Brad Cox and Tom Love in the early 1980s, it was selected by NeXT for its N ...
,
Yacc
Yacc (Yet Another Compiler-Compiler) is a computer program for the Unix operating system developed by Stephen C. Johnson. It is a Look Ahead Left-to-Right Rightmost Derivation (LALR) parser generator, generating a LALR parser (the part of a comp ...
,
Lex,
Qt and
SWIG
The Simplified Wrapper and Interface Generator (SWIG) is an open-source software tool used to connect computer programs or libraries written in C or C++ with scripting languages such as Lua, Perl, PHP, Python, R, Ruby, Tcl, and other langu ...
, as well as
TeX
Tex may refer to:
People and fictional characters
* Tex (nickname), a list of people and fictional characters with the nickname
* Joe Tex (1933–1982), stage name of American soul singer Joseph Arrington Jr.
Entertainment
* ''Tex'', the Italian ...
and
LaTeX
Latex is an emulsion (stable dispersion) of polymer microparticles in water. Latexes are found in nature, but synthetic latexes are common as well.
In nature, latex is found as a milky fluid found in 10% of all flowering plants (angiosper ...
documents. SCons can also handle other languages or file types through user-defined builders.
* Building from central repositories of source code and pre-built targets.
* Built-in ability to use
Microsoft Visual Studio
Visual Studio is an integrated development environment (IDE) from Microsoft. It is used to develop computer programs including web site, websites, web apps, web services and mobile apps. Visual Studio uses Microsoft software development platfor ...
, including the generation of , , and files.
* Detection of file content changes using
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.
* Integrated 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 all 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
Ccache is a software development
Software development is the process of conceiving, specifying, designing, programming, documenting, testing, and bug fixing involved in creating and maintaining applications, frameworks, or other software co ...
but for any type of target file, not just C/C++ compilation.
* Designed from the ground up for cross-platform builds, and 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 both the system- and user-level application programming inte ...
systems (including
Linux
Linux ( or ) is a family of open-source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991, by Linus Torvalds. Linux is typically packaged as a Linux distribution, which i ...
,
IBM AIX
AIX (Advanced Interactive eXecutive, pronounced , "ay-eye-ex") is a series of proprietary Unix operating systems developed and sold by IBM for several of its computer platforms.
Background
Originally released for the IBM RT PC RISC w ...
and
OS/2
OS/2 (Operating System/2) is a series of computer operating systems, initially created by Microsoft and IBM under the leadership of IBM software designer Ed Iacobucci. As a result of a feud between the two companies over how to position OS/2 ...
,
*BSD Unices,
HP-UX
HP-UX (from "Hewlett Packard Unix") is Hewlett Packard Enterprise's proprietary implementation of the Unix operating system, based on Unix System V (initially System III) and first released in 1984. Current versions support HPE Integrit ...
,
SGI IRIX
IRIX ( ) is a discontinued operating system developed by Silicon Graphics (SGI) to run on the company's proprietary MIPS workstations and servers. It is based on UNIX System V with BSD extensions. In IRIX, SGI originated the XFS file system ...
,
Solaris,
illumos
Illumos (stylized as illumos) is a partly free and open-source Unix operating system. It is based on OpenSolaris, which was based on System V Release 4 (SVR4) and the Berkeley Software Distribution (BSD). Illumos comprises a kernel, device d ...
),
MS Windows NT
Windows NT is a proprietary graphical operating system produced by Microsoft, the first version of which was released on July 27, 1993. It is a processor-independent, multiprocessing and multi-user operating system.
The first version of Wi ...
,
Apple
An apple is an edible fruit produced by an apple tree (''Malus domestica''). Apple trees are cultivated worldwide and are the most widely grown species in the genus '' Malus''. The tree originated in Central Asia, where its wild ances ...
OS X
macOS (; previously OS X and originally Mac OS X) is a Unix operating system developed and marketed by Apple Inc. since 2001. It is the primary operating system for Apple's Mac computers. Within the market of desktop and la ...
.
History and related projects
SCons software history started with the ''Cons'' software construction utility created by Bob Sidebotham in 1999. Cons was written in the
Perl
Perl is a family of two High-level programming language, high-level, General-purpose programming language, general-purpose, Interpreter (computing), interpreted, dynamic programming languages. "Perl" refers to Perl 5, but from 2000 to 2019 it ...
language. It served as a base for the ''ScCons'' build tool, a design which won the
Software Carpentry
The Carpentries is a nonprofit organization that teaches software engineering and data science skills to researchers through instructional workshops. The Carpentries is made up of three programs areas: Software Carpentry, Data Carpentry and Libr ...
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 allow collaborative work on this kind of software. Well-known products include the ...
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
In software development, CMake is cross-platform free and open-source software for build automation, testing, packaging and installation of software by using a compiler-independent method. CMake is not a build system itself; it generates ano ...
.
Notable applications that use SCons include the following:
The Battle for Wesnoth
''The Battle for Wesnoth'' is a free and open-source turn-based strategy video game with a high fantasy setting, designed by Australian-American developer David White and first released in June 2003. In ''Wesnoth'', the player attempts to build ...
,
Battlefield 1942
''Battlefield 1942'' is a 2002 first-person shooter video game developed by DICE and published by Electronic Arts for Microsoft Windows and Mac OS X. The game can be played in single-player mode against the video game AI or in multiplayer mode ...
,
Doom 3
''Doom 3'' is a 2004 survival horror first-person shooter video 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 ported ...
,
FCEUX, gem5,
gpsd
gpsd is a computer software program that collects data from a Global Positioning System (GPS) receiver and provides the data via an Internet Protocol (IP) network to potentially multiple client applications in a server-client application archite ...
,
GtkRadiant
Based on Id Software's open stance towards game modifications, their ''Quake'' series became a popular subject for player mods beginning with '' Quake'' in 1996. Spurred by user-created hacked content on their previous games and the company's ...
,
Madagascar
Madagascar (; mg, Madagasikara, ), officially the Republic of Madagascar ( mg, Repoblikan'i Madagasikara, links=no, ; french: République de Madagascar), is an island country in the Indian Ocean, approximately off the coast of East Africa ...
,
Mixxx,
MongoDB
MongoDB is a source-available cross-platform document-oriented database program. Classified as a NoSQL database program, MongoDB uses JSON-like documents with optional schemas. MongoDB is developed by MongoDB Inc. and licensed under the Ser ...
,
Nullsoft Scriptable Install System
Nullsoft Scriptable Install System (NSIS) is a script-driven installer authoring tool for Microsoft Windows backed by Nullsoft, the creators of Winamp. NSIS is released under a combination of free software licenses, primarily the zlib licens ...
,
OpenNebula,
VMware
VMware, Inc. is an American cloud computing and virtualization technology company with headquarters in Palo Alto, California. VMware was the first commercially successful company to virtualize the x86 architecture.
VMware's desktop software ru ...
,,
Wolfenstein: Enemy Territory,
XORP and MCA2,
openpilot and
Godot.
Examples
The following example is a very simple SConstruct file that compiles the C program file hello-world.c using the default platform compiler:
Program("hello-world.c")
The following is a more complex example that creates an environment used to build the program hello:
env = Environment()
env.Append(CPPFLAGS= -Wall", "-g"
env.Program("hello",
hello.c", "main.c"
See also
*
Buildout
*
CMake
In software development, CMake is cross-platform free and open-source software for build automation, testing, packaging and installation of software by using a compiler-independent method. CMake is not a build system itself; it generates ano ...
*
qmake
*
Qbs (build tool)
*
Premake
*
GNU build system
*
List of build automation software
Build automation involves scripting or automating the process of compiling computer source code into binary code. Below is a list of notable tools associated with automating build processes.
Make-based
* GNU make, a make implementation with a ...
*
Waf
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