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贼好用。

4. 参考资料

更多配置:http://blog.csdn.net/andyelvis/article/details/7055377

相关代码下载:http://pan.baidu.com/share/link?shareid=239572&uk=908463093

相关文章:

  • 2021-04-18
  • 2021-07-20
  • 2021-10-21
  • 2021-12-28
  • 2021-05-27
  • 2021-06-02
  • 2021-11-23
  • 2021-09-27
猜你喜欢
  • 2022-12-23
  • 2021-10-23
  • 2021-08-15
  • 2022-02-12
  • 2022-12-23
相关资源
相似解决方案