`
1.源码下载
git clone https://github.com/abseil/abseil-cpp
2. bazel build -c opt //absl/…
bazel会在abseil-cpp目录创建WORKSPACE文件,自动根据absl/BUILD.bazel,及子目录的BUILD.bazel编译abseil项目。
-c opt选项解释:
–compilation_mode [-c] (fastbuild, dbg or opt; default: “fastbuild”)
Specify the mode the binary will be built in. Values: ‘fastbuild’, ‘dbg’,
‘opt’.
Tags: affects_outputs, action_command_lines
命令举例:
bazel test --cxxopt=-std=c++17 -c opt --test_timeout 800 --runs_per_test=1 --jobs 1 --nocache_test_results //absl/synchronization:graphcycles_benchmark --verbose_failures --sandbox_debug
//清除重建:
bazel clean --async
//设置不使用cache
bazel test --test_timeout 8,80,800,1200 --nocache_test_results //absl/container:inlined_vector_benchmark
//超时设置
–test_timeout (a single integer or comma-separated list of 4 integers; default: “-1”)
//每个Test Case run 几遍
–runs_per_test (a positive integer or test_regex@runs. This flag may be passed more than once; may be used multiple times)
//多任务在多CPU上测试
bazel test -j HOST_RAM //absl/…
bazel test -j HOST_CPUS //absl/…
bazel test -j HOST_CPUS2.0 //absl/…
bazel test -j HOST_CPUS4.0 //absl/…
//cpu参数
–cpu (a string; default: “”)
//编译参数
–cxxopt (a string; may be used multiple times)
//只跑benchmark
bazel test --cxxopt=-std=c++17 --test_timeout 800 --runs_per_test=1 --jobs HOST_CPUS --nocache_test_results --test_tag_filters=benchmark //absl/…
//测试benchmark的某些case
bazel test --test_timeout 800 --runs_per_test=1 --jobs HOST_CPUS --noca che_test_results --test_tag_filters=benchmark //absl/types:* //absl/strings:*
//不跑benchmark
bazel test --cxxopt=-std=c++17 --test_timeout 800 --runs_per_test=1 --jobs HOST_CPUS --nocache_test_results --test_tag_filters=-benchmark //absl/…