Skip to content
Surf Wiki
Save to docs
general/articles-with-example-python-programming-language-code

From Surf Wiki (app.surf) — the open knowledge base

SCons

Software development tool


Software development tool

FieldValue
nameSCons
logoSCons.png
screenshot
authorSteven Knight
released
latest release version4.9.1
latest release date
latest preview date
repo
programming languagePython
operating systemCross-platform
genreSoftware development tools
licenseMIT License
website

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 Perl, 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 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, Battlefield 1942, Doom 3, gem5, gpsd, GtkRadiant, Madagascar, Nullsoft Scriptable Install System, OpenNebula, 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 (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 .dsp, .dsw, .sln and .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"])

References

References

  1. Knight, Steven. (February 2002). "SCons Design and Implementation".
  2. "Archives - SCons".
  3. "Cons". DSMit.
  4. Samuel, Alex. (2000-08-04). "Software Carpentry Design Competition Second Round Results Config, Build, and Track categories".
  5. Neundorf, Alexander. (21 June 2006). "Why the KDE project switched to CMake – and how (continued)". LWN.
  6. "CompilingWesnoth". Wesnoth.
  7. "README.txt". id Software.
  8. "Gem5".
  9. (2011-04-05). "SCons is full of win today". iBiblio.
  10. (2008-06-30). "Developer documentation for GtkRadiant 1.6.0 (Zeroradiant)". QE radiant.
  11. (2011-02-26). "Installation". Ahay.
  12. (2011-05-28). "INSTALL". Source forge.
  13. "/SConstruct - OpenNebula - OpenNebula Development pages". OpenNebula Project.
  14. "README.txt". id Software.
  15. "Modular Controller Architecture". Research Center for Information Technology (FZI), Karlsruhe Institute of Technology (KIT).
  16. "openpilot Github repository".
  17. "Introduction to the buildsystem — Godot Engine latest documentation".
Info: Wikipedia Source

This article was imported from Wikipedia and is available under the Creative Commons Attribution-ShareAlike 4.0 License. Content has been adapted to SurfDoc format. Original contributors can be found on the article history page.

Want to explore this topic further?

Ask Mako anything about SCons — get instant answers, deeper analysis, and related topics.

Research with Mako

Free with your Surf account

Content sourced from Wikipedia, available under CC BY-SA 4.0.

This content may have been generated or modified by AI. CloudSurf Software LLC is not responsible for the accuracy, completeness, or reliability of AI-generated content. Always verify important information from primary sources.

Report