chromium版本号:(stable_51.0.2704.106)
方案
启用USE_ASH宏需要重新生成编译目录。
在顶级GN目录(src目录)中输入:
gn args out/x86_d --ide=vs
在弹出的文本编辑器中添加编译选项参数:use_ash = true即可,我的args.gn文件
# Build arguments go here. Examples:
# is_component_build = true
# is_debug = false
# See "gn args <out_dir> --list" for available build arguments.
is_component_build = true
enable_nacl = false
is_debug = true
target_cpu = "x86"
use_ash = true
有时候在编辑参数的时候,GIT-BASH中就已经在生成文件了,此时你填写的参数可能就没生效了
Waiting for editor on "……\args.gn"...
Generating files...
如果是这种情况,就等文件生成好后,保存args.gn再输入下面的命令:
gn gen out/x86_d --ide=vs
重新生成ninja文件和vcxproj文件就可以了,此时在ninja文件和vcxproj文件中就可以看到
-DUSE_ASH=1
的预定义宏了。接下来直接编译即可
ninja chrome
相关内容
你可以通过输入以下命令来获取所有编译选项参数的默认值,需要提供编译目录
gn args out/x86_d --list
也可以获取某个指定的变量
gn args out/x86_d --list=use_ash
结果如下
use_ash Default = false
//build/config/ui.gni:22
Indicates if Ash is enabled. Ash is the Aura Shell which provides a
desktop-like environment for Aura. Requires use_aura = true
当我们在args.gn中指定了变量的值后,默认的初始化就不会执行.
具体的宏定义声明在以下位置src\build\config\BUILD.gn
config("feature_flags") {
...
if (use_ash) {
defines += [ "USE_ASH=1" ]
}
if (use_aura) {
defines += [ "USE_AURA=1" ]
}
...
}
使用以下命令查看某个target的详细信息
gn desc out/x86_d //chrome/browser/ui:ui
可以对某项进行筛选
gn desc out/x86_d //chrome/browser/ui:ui defines
部分结果如下
defines
MOJO_RUNNER_CLIENT
MOJO_SHELL_CLIENT
V8_DEPRECATION_WARNINGS
CLD_VERSION=2
ENABLE_MDNS=1
ENABLE_NOTIFICATIONS
ENABLE_PEPPER_CDMS
ENABLE_PLUGINS=1
ENABLE_PDF=1
ENABLE_PRINTING=1
ENABLE_BASIC_PRINTING=1
ENABLE_PRINT_PREVIEW=1
ENABLE_SPELLCHECK=1
USE_ASH=1
USE_AURA=1
USE_DEFAULT_RENDER_THEME=1
...
关于gn的详细用法,输入
gn help
查询,或参考GN Reference
参考内容
https://www.chromium.org/developers/gn-build-configuration
https://www.chromestory.com/2012/04/aura-and-ash-in-chrome-os-what-are-they/
so aha,编译后不能直接运行,大体看了下,不知道怎么改,是不是windows下不支持呢?