使用blade编译C/C++

阅读 85

2022-02-20

零、搭建blade


0、ubuntu安装python3

sudo apt-get update
sudo apt-get python3
ln -s /usr/bin/python3.5 /usr/bin/python

1、安装ninja

#clone 仓
git clone https://github.com/ninja-build/ninja.git

#编译
cd ninja
./configure.py --bootstrap

#安装
cp ./ninja  /usr/bin 
ninja --version

2、安装blade

git clone https://github.com/chen3feng/blade-build.git
cd blade-build
./install 

一、示例


0、hello world

同一个目录下:main.cpp, BUILD, BLADE_ROOT

main.cpp

#include <iostream>
using namespace std;

int main()
{
    cout << "hello world" << endl;
    return 0;
}

BUILD

cc_binary(
   name = 'main',
   srcs = [
     'main.cpp',
   ],
 )

 BLADE_ROOT文件没有内容

编译:

blade build .

精彩评论(0)

0 0 举报