学习进度
- 2021.6.24 Ongoing
- 2021.6.25 Finished
Understanding GN build flags
gn args out/mybuild ,会弹出一个 editor文本
gn args out/mybuild --list,能输出所有build arguments
gn args out/mybuild --list=argument name,能输出argument name的属性值
gn args FirstParam , 第一个参数应该是build category,因为不同的case,configure不同
“GN args”不是传给GN的command line arguments,而是而是写进args.gn file
Command build variants
Release Build
is_debug = false
On Android : is_java_debug = false
Trybots : dcheck_always_on = true
Component build
Component build links many parts of Chrome into separate shared libraries to avoid the long link step at the end。在非ios builds和大部分developer builds and debugging的时候,都默认为false状态,这个会变慢link的速度,有一些人会在release版本中开启获得更快的links和runtime performance
- Startup is slower and some linker optimizations won't work, so don't do benchmarks in this mode
- benchmark是指一些评分标准,output性能结果评估的软件
设置的方法:gn args out/YourDirectory --args = ' ',然后在弹出的edit中,设置
is_component_build=true
Faster builds with no or minimal symbols
将symbol_level的优先级降低,这样build会更快
Disable Native Client
大部分Developer 不需要native client,可以关闭以加速
enable_nacl = false
Remove WebCore symbols
WebCore占用了大量的debugging symbols。如果不需要debug WebCore,也可以取消
blink_symbol_level = 0
Overriding the CPU architecture
重写CPU架构目标,一般会根据host os and cpu去处理出默认值
在不同的系统下,target_cpu的值会有一些不同,Windows没有特别的地方
Goma
googlers 可以通过分布式架构distributed builds做加速
Official Chrome build
googler才能用,pass
Windows
通过 $ gn gen --ide=vs out\Default可以生成VSProject and solution files
Android Build(Linux)| Chrome OS build(Linux)
:) Android checkout的看这个,pass
总结
介绍通过gn args directory --list/--args 对编译参数进行设置
介绍一些可以选择关闭的boolean,有利于加速构建(编译)
- compile 检查语法,生成二进制文件 object
- build = complile + link。link是将obj文件链接起来,如果具备执行的条件,则将obj文件链接生成exe或者dll文件