码迷,mamicode.com
首页 > 其他好文 > 详细

scons安装和使用

时间:2016-06-27 19:52:32      阅读:274      评论:0      收藏:0      [点我收藏+]

标签:

1. scons是神马?

scons是linux下的自动构建工具,类似cmake。

2. 安装

wget http://prdownloads.sourceforge.net/scons/scons-2.2.0.tar.gz

tar zxvf scons-2.2.0.tar.gz

cd scons-2.2.0

python setup.py install

正常情况下,scons将安装到${PYTHON_INSTALL_DIR}/bin/下

3. hello world程序

三个文件hello.h hello.c main.c hello.h定义函数void hello(); hello.c中实现该函数,main.c中调用该函数。

编写SConstruct,scons构建时使用。内容如下:

Program(‘hello‘, [‘hello.c‘, ‘main.c‘])

开始构建 

scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
gcc -o hello.o -c hello.c
gcc -o main.o -c main.c
gcc -o hello hello.o main.o
scons: done building targets.

此时二进制文件已经构建完成,scons贼好用。

scons安装和使用

标签:

原文地址:http://www.cnblogs.com/jjqfqy/p/5620748.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!