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
The GNU Autotools, also known as the GNU Build System, is a suite of programming tools designed to assist in making source code packages portable to many Unix-like systems.
It can be difficult to make a software program portable: the C compiler ...
based on the
make
Make or MAKE may refer to:
* Make (magazine), a tech DIY periodical
*Make (software), a software build tool
*Make, Botswana, in the Kalahari Desert
*Make Architects
Make Architects is an international architecture practice headquartered in Londo ...
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
Python may refer to:
Snakes
* Pythonidae, a family of nonvenomous snakes found in Africa, Asia, and Australia
** ''Python'' (genus), a genus of Pythonidae found in Africa and Asia
* Python (mythology), a mythical serpent
Computing
* Python (pro ...
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++
C++ (pronounced "C plus plus") is a high-level general-purpose programming language created by Danish computer scientist Bjarne Stroustrup as an extension of the C programming language, or "C with Classes". The language has expanded significan ...
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 software ...
'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" or ...
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 List ...
,
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 NeXTS ...
,
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 com ...
,
Lex
Lex or LEX may refer to:
Arts and entertainment
* ''Lex'', a daily featured column in the ''Financial Times''
Games
* Lex, the mascot of the word-forming puzzle video game ''Bookworm''
* Lex, the protagonist of the word-forming puzzle video ga ...
,
Qt and
SWIG, 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 (angiosperms ...
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 websites, web apps, web services and mobile apps. Visual Studio uses Microsoft software development platforms such a ...
, 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 tool that caches compilations so that the next time, the same compilation can be avoided and the results can be taken from the cache. This can greatly speed up recompilation time. The detection is done by hashi ...
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 interf ...
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 ...
,
IBM AIX
AIX (Advanced Interactive eXecutive, pronounced , "ay-eye-ex") is a series of Proprietary software, proprietary Unix operating systems developed and sold by IBM for several of its computer platforms.
Background
Originally released for the ...
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 Integrity Ser ...
,
SGI SGI may refer to:
Companies
*Saskatchewan Government Insurance
*Scientific Games International, a gambling company
*Silicon Graphics, Inc., a former manufacturer of high-performance computing products
*Silicon Graphics International, formerly Rac ...
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 and ...
,
Solaris
Solaris may refer to:
Arts and entertainment Literature, television and film
* ''Solaris'' (novel), a 1961 science fiction novel by Stanisław Lem
** ''Solaris'' (1968 film), directed by Boris Nirenburg
** ''Solaris'' (1972 film), directed by ...
,
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 ...
),
MS Windows NT
Windows NT is a proprietary graphical operating system
An operating system (OS) is system software that manages computer hardware, software resources, and provides common services for computer programs.
Time-sharing operating systems sc ...
,
Apple
An apple is an edible fruit produced by an apple tree (''Malus domestica''). Apple fruit tree, trees are agriculture, cultivated worldwide and are the most widely grown species in the genus ''Malus''. The tree originated in Central Asia, wh ...
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 lapt ...
.
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, general-purpose, interpreted, dynamic programming languages. "Perl" refers to Perl 5, but from 2000 to 2019 it also referred to its redesigned "sister language", Perl 6, before the latter's name was offici ...
language. 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 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 anothe ...
.
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 a ...
,
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 architec ...
,
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
Mixxx is free and open-source software for DJing.James, Daniel. "Drafting Digital Media". Apress, 2009, p. 213. It is cross-platform and supports most common music file formats. Mixxx can be controlled with MIDI and HID controllers and timecode ...
,
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 Serve ...
,
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 license. It ...
,
OpenNebula
OpenNebula is a cloud computing platform for managing heterogeneous distributed data center infrastructures. The OpenNebula platform manages a data center's virtual infrastructure to build private, public and hybrid implementations of Infrastruc ...
,
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
XORP is an open-source Internet Protocol routing software suite originally designed at the International Computer Science Institute in Berkeley, California. The name is derived from ''eXtensible Open Router Platform''. It supports OSPF, BGP, RI ...
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
Buildout is an open-source software build tool. Buildout is created using the Python programming language. It implements a principle of separation of configuration from the scripts that do the setting up.
Buildout is primarily used to download a ...
*
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 anothe ...
*
qmake
qmake is a utility that automates the generation of makefiles. Makefiles are used by the program make to build executable programs from source code; therefore qmake is a make-makefile tool, or ''makemake'' for short.
The makefiles that qmake pro ...
*
Qbs (build tool)
*
Premake
Premake is an open-source software development utility for automatically building configuration from source code.
Features
Some of Premake's features are:
* It supports the C, C++, and C# programming languages.
* Its syntax is simple.
* I ...
*
GNU build system
The GNU Autotools, also known as the GNU Build System, is a suite of programming tools designed to assist in making source code packages portable to many Unix-like systems.
It can be difficult to make a software program portable: the C compiler ...
*
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