自动化构建工具——scons

之前只用过make和cmake,无意中看到了有这样一个c/c++项目的构建工具,想试试看怎么样。

安装

scons的官网,可以在这里下载
https://scons.org/, 怎么装就不用说了吧。

使用方法

  • 1.写一个再熟悉不过的例子
#include 
using namespace std;

int main()
{
    cout << "Hello world" << endl;
    return 0;
}
  • 2.新建SConstruct文件
Program('hello_world.cc')
  • 3.执行scons命令
$ scons
scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
g++ -o hello_world.o -c hello_world.cc
g++ -o hello_world hello_world.o
scons: done building targets.

可以看到生成了一个可执行文件 hello_world

你可能感兴趣的:(自动化构建工具——scons)