歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> Linux教程 >> scons安裝和使用

scons安裝和使用

日期:2017/2/28 14:52:30   编辑:Linux教程

scons安裝和使用

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://www.linuxidc.com/Linux/2013-02/79467.htm

相關代碼下載:

免費下載地址在 http://linux.linuxidc.com/

用戶名與密碼都是www.linuxidc.com

具體下載目錄在 /2013年資料/2月/16日/scons安裝和使用

Copyright © Linux教程網 All Rights Reserved