SCons

{{Redirect-distinguish|Scons|Scones}}

{{Infobox software

| name = SCons

| logo = SCons.png

| screenshot =

| caption =

| collapsible =

| author = Steven Knight

| developer =

| released = {{start date and age|2001|12|13}}{{cite web |url=http://legacy.python.org/workshops/2002-02/papers/16/index.htm|first=Steven|last=Knight|date=February 2002|title = SCons Design and Implementation|access-date=March 23, 2024|url-status=live|archive-url=https://web.archive.org/web/20180321082341/http://legacy.python.org/workshops/2002-02/papers/16/index.htm|archive-date=March 21, 2018}}

| discontinued =

| latest release version = 4.8.1{{cite web |url=https://scons.org/archives.html |title = Archives - SCons}}

| latest release date = {{start date and age|2024|09|04}}

| latest preview version =

| latest preview date =

| repo = {{URL|https://github.com/SCons/scons}}

| programming language = Python

| operating system = Cross-platform

| platform =

| size =

| language =

| genre = Software development tools

| license = MIT License

| website = {{URL|http://scons.org}}

}}

SCons is a software development tool that analyzes source code 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 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, was created by Bob Sidebotham in 1999.{{Citation | url = http://www.dsmit.com/cons/ | title = Cons | type = web site | publisher = DSMit | url-status = dead | archive-url = https://archive.today/20000815211359/http://www.dsmit.com/cons/ | archive-date = 2000-08-15 }}. It served as a base for the ScCons build tool, a design which won the Software Carpentry project SC Build competition in August 2000.{{cite web| url = https://lwn.net/2000/0810/a/sc-second-round.php3 |title= Software Carpentry Design Competition Second Round Results Config, Build, and Track categories|date=2000-08-04|first=Alex|last= Samuel|access-date= 2012-10-29}} ScCons was the foundation for SCons.

SCons inspired the creation of Waf, formerly known as SCons/BKsys, which emerged in the KDE 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.{{cite web|url=https://lwn.net/Articles/188693/|title=Why the KDE project switched to CMake – and how (continued)|last=Neundorf|first=Alexander|date=21 June 2006|publisher=LWN | access-date =21 July 2009}}

Notable projects that use SCons (or used it at one time) include: The Battle for Wesnoth,{{cite web| url = http://wiki.wesnoth.org/CompilingWesnoth#Building_with_SCons | title =CompilingWesnoth|access-date= 2011-04-11 | work = Wiki | publisher = Wesnoth}} Battlefield 1942,{{citation needed|date=March 2014}} Doom 3,{{cite web|url=https://github.com/id-Software/DOOM-3/blob/master/README.txt | publisher = id Software | title=README.txt | access-date= 2015-05-13}} gem5,{{Citation | url = http://www.gem5.org/ | title = Gem5}}. gpsd,{{cite web|url= http://esr.ibiblio.org/?p=3089| work = ESR | publisher = iBiblio | title= SCons is full of win today|date = 2011-04-05 | access-date=2011-04-11}} GtkRadiant,{{cite web| publisher = QE radiant | url= http://www.qeradiant.com/cgi-bin/trac.cgi/browser/GtkRadiant/trunk/COMPILING |title=Developer documentation for GtkRadiant 1.6.0 (Zeroradiant)| date= 2008-06-30 | format = Trac | access-date = 2009-12-28}} Madagascar,{{cite web | publisher = Ahay | work = Wiki | url= http://www.ahay.org/wiki/Installation#Installation_from_source |title= Installation|date = 2011-02-26 | access-date = 2011-04-11}} Nullsoft Scriptable Install System,{{cite web | url = http://nsis.svn.sourceforge.net/viewvc/nsis/NSIS/trunk/INSTALL?revision=6147&view=markup | archive-url = https://archive.today/20120711221146/http://nsis.svn.sourceforge.net/viewvc/nsis/NSIS/trunk/INSTALL?revision=6147&view=markup | url-status = dead | archive-date = 2012-07-11 | title = INSTALL | work = NSIS | type = source code | date = 2011-05-28 | access-date = 2011-04-11 | publisher = Source forge }} OpenNebula,{{cite web | url = http://dev.opennebula.org/projects/opennebula/repository/revisions/e20fb5c4c42960186cae7cdf353ba96e7a629703/entry/SConstruct | title = /SConstruct - OpenNebula - OpenNebula Development pages | publisher = OpenNebula Project | access-date= 2016-01-09}} VMware,{{citation needed|date=March 2014}}, Wolfenstein: Enemy Territory,{{cite web|url = https://github.com/id-Software/Enemy-Territory/blob/master/README.txt | publisher = id Software | title = README.txt | access-date = 2017-04-25}} XORP and MCA2,{{cite web|url= http://mca2.org/ |title= Modular Controller Architecture|publisher = Research Center for Information Technology (FZI), Karlsruhe Institute of Technology (KIT)}} openpilot{{Cite web|url=https://github.com/commaai/openpilot|title=openpilot Github repository|website=comma.ai/|access-date=2021-05-10}} and Godot.{{Cite web|url=https://docs.godotengine.org/en/3.1/development/compiling/introduction_to_the_buildsystem.html|title=Introduction to the buildsystem — Godot Engine latest documentation|website=docs.godotengine.org|access-date=2019-08-19}}

.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 (GCC) dependency analysis, SCons uses a regular expression scan for included source files
  • Built-in support for C, C++, D, Java, Fortran, Objective-C, Yacc, Lex, Qt and SWIG, as well as TeX and LaTeX 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 {{Not a typo|.dsp}}, {{Not a typo|.dsw}}, {{Not a typo|.sln}} and {{Not a typo|.vcproj}} 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
  • Autoconf-like support for finding #include files, libraries, functions and typedefs
  • 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 systems (including Linux, AIX and OS/2, *BSD Unices, HP-UX, SGI IRIX, Solaris, illumos), Windows NT, OS X

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

{{Portal|Free and open-source software}}

  • {{Annotated link|Buildout}}
  • {{Annotated link|qmake}}
  • {{Annotated link|Qbs (build tool)}}
  • {{Annotated link|Premake}}
  • {{Annotated link|List of build automation software}}

References

{{Reflist|30em}}