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

buckaroo 试用

时间:2019-02-02 14:28:10      阅读:181      评论:0      收藏:0      [点我收藏+]

标签:用户   rom   oop   ++   view   port   led   格式   nis   

我系统是mac 所以选择的是mac 的版本,官方是支持跨平台的。

安装

mac 版本安装

wget https://github.com/LoopPerfect/buckaroo/releases/download/v2.0.0/buckaroo-macos -O buckaroo
chmod +x ./buckaroo

取消信息收集(可选)

因为默认buckaroo 包含了遥测功能,在第一次运行的时候会有一个uuid生成,以此进行用户信息的统计,
我们可以通过环境变量禁用

export BUCKAROO_TELEMETRY_OPT_OUT=1

安装buck

因为buckaroo 使用了buck 做为包格式以及进行系统构建

brew tap facebook/fb
brew install buck

或者

wget https://github.com/njlr/buck-warp/releases/download/v0.3.0/buck-2019.01.10.01-osx -O buck
chmod +x ./buck
./buck

快速使用

这个来自官方的wiki,前提条件是参考上边的安装了buckaroo 以及buck

运行buckaroo quickstart 生成参考demo

buckaroo quickstart
按照提示输入名称

如下:

buckaroo quickstart
Please enter a project name (alphanumeric + underscores + dashes): 
demoapp
Writing project files... 
info Resolve start: 2019-02-02T12:04:10
info Resolving dependencies using quick strategy... 
info Resolve end: 2019-02-02T12:04:10
info Resolve time: 00:00:00.2814250
Success! 
info Installing packages...
success The packages folder is now up-to-date. 
To start your app: 
$ buck run :app

运行

buck run :app

效果

buck run :app
Starting new Buck daemon...
Using additional configuration options from .buckconfig.d/.buckconfig.buckaroo
Parsing buck files: finished in 1.8 sec
Building: finished in 1.9 sec (100%) 6/6 jobs, 6 updated
  Total time: 4.0 sec
Hello, world. 

添加依赖

buckaroo add github.com/buckaroo-pm/ericniebler-range-v3@branch=master

效果

buckaroo add github.com/buckaroo-pm/ericniebler-range-v3@branch=master
Adding github.com/buckaroo-pm/ericniebler-range-v3@branch=master
[solver] Resolved 0/1
[git] Fetching refs from https://github.com/buckaroo-pm/ericniebler-range-v3.git
[git] success fetched 49 refs in 3.556
[solver] Exploring github.com/buckaroo-pm/ericniebler-range-v3...
[solver] Fetching manifest...
[solver] success Manifest fetched in 1.308s
[solver] success Resolved github.com/buckaroo-pm/ericniebler-range-v3 -> {revision=bdbbf09fe99527553b511b07a21ccc4fdc90ce1d, branch=master}
info Installing packages...
info No receipt found for buckaroo/github/buckaroo-pm/ericniebler-range-v3; it will be installed. 
info Installing buckaroo/github/buckaroo-pm/ericniebler-range-v3... 
[git] Shallow cloning https://github.com/buckaroo-pm/ericniebler-range-v3.git



info Writing an installation receipt for buckaroo/github/buckaroo-pm/ericniebler-range-v3... 
success Installed buckaroo/github/buckaroo-pm/ericniebler-range-v3
success The packages folder is now up-to-date. 
Success. 

使用依赖 main.cpp

#include <iostream>
#include <vector>
#include <range/v3/all.hpp>

int main() {
  auto const xs = std::vector<int>({ 1, 2, 3, 4, 5 });
  auto const ys = xs
    | ranges::view::transform([](auto x) { return x * x; })
    | ranges::to_vector;

  for (auto const& i : ys) {
    std::cout << i << std::endl;
  }

  return 0;
}

重新运行

buck run :app

效果

buck run :app
Using additional configuration options from .buckconfig.d/.buckconfig.buckaroo
Invalidating internal cached state: Buck configuration options changed between invocations. This may cause slower builds.
Parsing buck files: finished in 1.1 sec
Building: finished in 3.1 sec (100%) 9/9 jobs, 2 updated
  Total time: 4.5 sec
1
4
9
16
25

说明

因为使用的是c++ 14 的编译器,如果不是c++ 14 的,需要修改配置.buckconfig 添加 如下

[cxx]
  cxxflags = -std=c++14

技术图片

说明

类似的包管理工具有conan,也是不错的选择

参考资料

https://github.com/LoopPerfect/buckaroo
https://buckbuild.com/setup/getting_started.html
https://github.com/LoopPerfect/buckaroo/wiki/installation

buckaroo 试用

标签:用户   rom   oop   ++   view   port   led   格式   nis   

原文地址:https://www.cnblogs.com/rongfengliang/p/10348193.html

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