/luckfox-bazel

luckfox on bazel

Primary LanguageStarlark

luckfox 编译环境

当前仓库是为了学习bazel 以及 luckfox 而创立。

使用方式

Linux 系统

目前只测试过ubuntu,理论上包括wsl在内都可以使用。

# 编译测试项目
bazel build //test/...
# 编译整个项目
bazel build //...

windows or macos 系统

对于其他系统,可以考虑将 toolchains.bzl 里面的编译链修改为对应系统的编译链,其中windows还需要修改wrappers下的脚本 (windows比较麻烦,建议直接使用 wsl)。

远程编译

所有的系统都可以进行远程编译。需要部署bazel远程服务,具体可以参考远程执行概览,这里为了快速部署使用了 buildfarm。可以通过docker-compose.yaml快速启动。

启动成功之后,记录IP地址,例如:192.168.1.100;或者127.0.0.1。然后修改文件 .bazelrc

更改为:

- build:remote            --remote_executor=grpc://IP地址或者域名:8980
- build:remote            --remote_cache=grpc://IP地址或者域名:8980
+ build:remote            --remote_executor=grpc://192.168.1.100:8980
+ build:remote            --remote_cache=grpc://192.168.1.100:8980

- # build                   --config=remote
+ build                   --config=remote

然后就可以在项目里面进行编译:

# 编译测试项目
bazel build //test/...
# 编译整个项目
bazel build //...

参考文章

关于 bazel 远程服务 远程执行概览 远程执行服务

bazel 交叉编译链 参考了 https://ltekieli.com/cross-compiling-with-bazel/

opencv-mobile 参考 https://zhuanlan.zhihu.com/p/670191385