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.

SCons
Original author(s)Steven Knight
Initial releaseDecember 13, 2001; 23 years ago (2001-12-13)[1]
Stable release
4.8.1[2] / September 4, 2024; 3 months ago (2024-09-04)
Repositorygithub.com/SCons/scons
Written inPython
Operating systemCross-platform
TypeSoftware development tools
LicenseMIT License
Websitescons.org

The tool generates Python scripts for project configuration and build logic.

History

edit

The Cons software construction utility, written in the Perl, was created by Bob Sidebotham in 1999.[3] It served as a base for the ScCons build tool, a design which won the Software Carpentry project SC Build competition in August 2000.[4] 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.[5]

Notable projects that use SCons (or used it at one time) include: The Battle for Wesnoth,[6] Battlefield 1942,[citation needed] Doom 3,[7] FCEUX,[8] gem5,[9] gpsd,[10] GtkRadiant,[11] Madagascar,[12] Mixxx,[13] MongoDB,[14] Nullsoft Scriptable Install System,[15] OpenNebula,[16] VMware,[citation needed], Wolfenstein: Enemy Territory,[17] XORP and MCA2,[18] openpilot[19] and Godot.[20]

.csig is the SCons Content Signature file format.

Features

edit

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

edit

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

edit
  • Buildout – programming tool aimed to assist with deploying software
  • qmake – software build tool that generates Makefiles
  • Qbs (build tool) – cross-platform free and open-source software for managing the build process of software
  • Premake – Cross-platform build tool for configuring platform-specific builds
  • List of build automation software

References

edit
  1. ^ Knight, Steven (February 2002). "SCons Design and Implementation". Archived from the original on March 21, 2018. Retrieved March 23, 2024.
  2. ^ "Archives - SCons".
  3. ^ Cons (web site), DSMit, archived from the original on 2000-08-15.
  4. ^ Samuel, Alex (2000-08-04). "Software Carpentry Design Competition Second Round Results Config, Build, and Track categories". Retrieved 2012-10-29.
  5. ^ Neundorf, Alexander (21 June 2006). "Why the KDE project switched to CMake – and how (continued)". LWN. Retrieved 21 July 2009.
  6. ^ "CompilingWesnoth". Wiki. Wesnoth. Retrieved 2011-04-11.
  7. ^ "README.txt". id Software. Retrieved 2015-05-13.
  8. ^ "Downloads". FCEUX. Retrieved 2017-04-25.
  9. ^ Gem5.
  10. ^ "SCons is full of win today". ESR. iBiblio. 2011-04-05. Retrieved 2011-04-11.
  11. ^ "Developer documentation for GtkRadiant 1.6.0 (Zeroradiant)" (Trac). QE radiant. 2008-06-30. Retrieved 2009-12-28.
  12. ^ "Installation". Wiki. Ahay. 2011-02-26. Retrieved 2011-04-11.
  13. ^ "Mixxx/Compiling". GitHub. 2014-08-26.
  14. ^ "Building for Linux". MongoDB. 10gen. January 30, 2009. Archived from the original on February 21, 2009. Retrieved February 8, 2011.
  15. ^ "INSTALL". NSIS (source code). Source forge. 2011-05-28. Archived from the original on 2012-07-11. Retrieved 2011-04-11.
  16. ^ "/SConstruct - OpenNebula - OpenNebula Development pages". OpenNebula Project. Retrieved 2016-01-09.
  17. ^ "README.txt". id Software. Retrieved 2017-04-25.
  18. ^ "Modular Controller Architecture". Research Center for Information Technology (FZI), Karlsruhe Institute of Technology (KIT).
  19. ^ "openpilot Github repository". comma.ai/. Retrieved 2021-05-10.
  20. ^ "Introduction to the buildsystem — Godot Engine latest documentation". docs.godotengine.org. Retrieved 2019-08-19.
edit