关键是默认脚本是python。这里有可行的设置
GN
buildconfig = "//build/BUILDCONFIG.gn"
script_executable = "/bin/bash" # ADDED this line
跑
gn gen out
再次修改build.gn as
action("awk") {
script = "convert.sh"
sources = [ "hello.cc" ]
outputs = [ "$target_out_dir/hello2.cc" ]
args = rebase_path(sources, root_build_dir) +
rebase_path(outputs, root_build_dir)
}
executable("hello") {
sources = [
"$target_out_dir/hello2.cc",
]
include_dirs = [ "//" ] # to support #include in original .cc
deps = [
":hello_shared",
":hello_static",
":awk",
]
}
shared_library("hello_shared") {
sources = [
"hello_shared.cc",
"hello_shared.h",
]
defines = [ "HELLO_SHARED_IMPLEMENTATION" ]
}
static_library("hello_static") {
sources = [
"hello_static.cc",
"hello_static.h",
]
}