1. Install PythonBecause scons is written in Python, you must install Python before using scons. Before installing python, check whether python is available in your system (run Python-V or Python-version in the command line of the system ). $ Python-vpython 2.5.1 In a Windows system, c: \> Python-vpython 2.5.1 if python is not installed, you will see an error mes
1. Install PythonBecause SCons is written in Python, you have to install Python before using SCons. Before you install Python, you should be aware of whether Python is available in your system (running Python-v or Python--version on the system's command line). $python-V Python 2.5.1 in a Windows system,C:\>python-v python 2.5.1 If Python isn't installed, you'll s
SConscript () function to set the attached configuration file. By convention, these ancillary configuration files are named "SConscript", and you can also use any other name.3. scons command line parameters
1 scons: Execute the SConstruct Script 2 scons-c clean3 scons-Q to display only the compilation information, rem
/latex. Users can also expand according to their own needs to obtain the desiredProgramming Language.
Supports parallel build of the make-J style. Compared with make-J, scons can run n jobs at the same time without worrying aboutCode.
Use Autoconf to search for header files, function libraries, functions, and type definitions.
Excellent platforms. Scons can run on Linux, Aix, BSD, HP/UX, Irix, Sola
1. Compile a simple C/C ++ Program
This is a famous "Hello, world!" written in C language! "Program: int main () {printf (" Hello, world! \ N ") ;}use scons to compile it. Enter the following command in a file named sconstruct: Program ('Hello. C ') This short configuration file gives scons two pieces of information: What You Want To compile (an executable program), the input file you compile (hello. c ). P
Chapter 3. less simple things to do with builds
In this chapter, you will see some simple compilation configuration examples.
3.1 specifying the name of the target (output) File=====When you use program to compile the project, the default output file name is the same as the source file name.Program ('hello. C ')If you want to use another output name, you only need to specify it on the left side of the source file name. In scons, the first appearance o
Install scons ====
This is not detailed. If it is too troublesome, you can directly use sudo apt-Get install scons. Do not bother to download the source code for installation.
Simple compilation ====
Let's look at the simplest Hello, world program.IntMain (){Printf ("Hello, world! \ N ");}Create a sconstruct file and writeProgram ('hello. C ')
The simplest automated compilation file contains two pieces of i
Chapter 4. Building and linking with libraries=====In large-scale software, it is very convenient to use libraries for management, and it can save a lot of trouble for code reuse.
4.1 building libraries=====Like the program function, you only need to call the library function to generate the library.Library ('foo', ['f1. C', 'f2. C', 'f3. c'])
% Scons-QCC-O f1.o-C f1.cCC-O f2.o-C f2.cCC-O f3.o-C f3.cAr RC libfoo. A f1.o f2.o f3.oRanlib libfoo.In addit
developers to build software. Compared with traditional make tools, SCons has the following advantages:
● Use the Python script as the configuration file
● For C, C ++, and Fortran, built-in support for reliable automatic dependency analysis. you do not need to execute "make depends" or "make clean" as the make tool does to obtain all dependencies.
● Built-in support for C, C ++, D, Java, Fortran, Yacc, Lex, Qt, SWIG, And Tex/Latex. You can also expa
increase the speed of multi-task creation ----- ccache supports all target file types, not just C/C ++ Compilation
Supports the exaggerated platform. Currently, we know that Linux and other POSIX systems (including Aix, * BSD systems, HP/UX,IRIX and Solaris), Windows NT, Mac OS x, and OS/2.
The following is the original text, which is taken from the scons official website. If the translation is not in
Introduction and use of Scons automatic large-scale system building toolsAuthor: Yu Chao email: yuchao86@gmail.com
1. OverviewScons is an automated building tool written in Python. From the perspective of building, it is the same as GNU make. The key to Make is to build the dependency between files and then compile the project based on the dependency. The dependency needs to be built manually or manually. This is not difficult for large systems.
) or DLL file (in Windows), you can use sharedlibrary: sharedlibrary ('foo', ['f1. c', 'f2. c', 'f3. C ']) Run scons compilation in POSIX: % scons-QCC-O f1. OS-C f1.ccc-O f2. OS-C f2.ccc-O f3. OS-C f3.ccc-O libfoo. so-shared f1. OS f2. OS f3. OS
2. link library filesWhen linking a library file, use the $ libs variable to specify the library file and use $ libpat
An environment is a set of values that can affect how a program executes. There are three different types of environments in scons:
External Environment: external environment refers to the set of variables in the user environment when the user runs scons. These variables can be obtained through the OS. Environ Dictionary of Python IN THE sconscript file.
Construction Environment: A constructor is a unique o
HTTP://SCONSOLIDATOR.COM/PROJECTS/SCONSOLIDATOR/WIKI/GETTING_STARTEDADD scons support to an existing projectTo add scons support to an existing/C + + project, just right click on the project (s) in the Project Explorer and choose O NE of the following submenus of SCons:
Use self-provided scons build (aka "Exis
In scons, ENV is called in windows. program ("hello. C "), you can call tools such as Cl and link to automatically compile the link; Use Env. jar (target = 'Hello. jar ', source = ['Hello. java ']), compress the file with the jar tool... to understand how to integrate these tools, I checked the source code.The module File of scons is usually installed in Python L
SCons is a python-written automated build tool that python and scons need to be installed before they can run and cross-platform . its integrated functionality is similar to Autoconf/automake and is a simple and reliable tool. Many systems now come with Python, so you can install scons directly. (This document is for logging only)Installing SCons1. Preparatory wo
Install scons in linux is an automated building tool written in Python. It can run only after python and scons are installed. Its integration function is similar to autoconf/automake and is a simple and reliable tool. Many systems now have python, so install scons directly. Install scons 1. prepare to check whether the
Use scons instead of makefile to quickly build applications
Author: Liu Da-poechant
Blog: blog.csdn.net/poechant
Email: zhongchao.ustc@gmail.com
Copyright · poechant
0 Introduction
Writing building rules for make tools is not easy. Its Complex Configuration Rules are daunting for experienced developers. Many alternatives to the Make tool were born. scons is one of them.
1. Merge the options into the environment: mergeflags Function
The construction environment of scons has a mergeflags method, which combines the dictionary of a value into the construction environment. Mergeflags treats each value in the dictionary as an option list. If an option already exists in the construction environment variable, mergeflags will not set this option again.
When merging options to any variable named in the path, mergeflags keeps t
files.
7) use the MD5 Signature to check the build's changes. It also supports detecting changes with the traditional time stamp.
8) the parallel build is improved, such as make-J. Running n jobs at the same time does not depend on the directory inheritance structure.
9) Integrate the find # include file, libraries, functions and typedefs files like Autoconf.
10) global view of all dependencies.
11) share built files in a cache to speed up multiple builds, such as ccache but not limite
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.