Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Pinoxchio
apollo
提交
3618c52b
A
apollo
项目概览
Pinoxchio
/
apollo
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
A
apollo
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
3618c52b
编写于
6月 23, 2020
作者:
S
storypku
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Bazel: apollo_build.sh works
上级
45bc830d
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
40 addition
and
50 deletion
+40
-50
scripts/apollo_build.sh
scripts/apollo_build.sh
+40
-50
未找到文件。
scripts/apollo_build.sh
浏览文件 @
3618c52b
...
...
@@ -8,10 +8,10 @@ ARCH="$(uname -m)"
:
${
USE_ESD_CAN
:
=false
}
C
OMMAND_
LINE_OPTIONS
=
BUIL
D_TARGETS
=
C
MD
LINE_OPTIONS
=
SHORTHAN
D_TARGETS
=
function
determine_disabled_targets
()
{
function
determine_disabled_
bazel_
targets
()
{
local
disabled
=
local
compo
=
"
$1
"
if
[[
-z
"
${
compo
}
"
||
"
${
compo
}
"
==
"drivers"
]]
;
then
...
...
@@ -33,88 +33,68 @@ function determine_disabled_targets() {
# components="$(echo -e "${@// /\\n}" | sort -u)"
# if [ ${PIPESTATUS[0]} -ne 0 ]; then ... ; fi
function
determine_targets
()
{
local
targets
=
function
determine_
bazel_
targets
()
{
local
bazel_
targets
=
local
compo
=
"
$1
"
if
[[
-z
"
${
compo
}
"
||
"
${
compo
}
"
==
"drivers"
]]
;
then
local
exceptions
=
if
!
${
USE_ESD_CAN
}
;
then
exceptions
=
"
$(
determine_disabled_targets
${
compo
}
)
"
exceptions
=
"
$(
determine_disabled_
bazel_
targets
${
compo
}
)
"
fi
if
[
-z
"
${
compo
}
"
]
;
then
targets
=
"//modules/... union //cyber/...
${
exceptions
}
"
bazel_
targets
=
"//modules/... union //cyber/...
${
exceptions
}
"
else
targets
=
"//modules/drivers/...
${
exceptions
}
"
bazel_
targets
=
"//modules/drivers/...
${
exceptions
}
"
fi
elif
[[
"
${
compo
}
"
==
"cyber"
]]
;
then
if
[[
"
${
ARCH
}
"
==
"x86_64"
]]
;
then
targets
=
"//cyber/... union //modules/tools/visualizer/..."
bazel_
targets
=
"//cyber/... union //modules/tools/visualizer/..."
else
targets
=
"//cyber/..."
bazel_
targets
=
"//cyber/..."
fi
elif
[[
-d
"
${
APOLLO_ROOT_DIR
}
/modules/
${
compo
}
"
]]
;
then
targets
=
"//modules/
${
compo
}
/..."
bazel_
targets
=
"//modules/
${
compo
}
/..."
else
error
"Oops, no such component under <APOLLO_ROOT_DIR>/modules/ . Exiting ..."
exit
1
fi
echo
"
${
targets
}
"
echo
"
${
bazel_
targets
}
"
}
function
_arg_parse
()
{
local
__retopts
=
"
$1
"
local
__retargs
=
"
$2
"
shift
2
function
_parse_cmdline_arguments
()
{
local
known_options
=
""
local
remained_args
=
""
while
[
"$#"
-gt
0
]
;
do
local
opt
=
"
$1
"
for
((
pos
=
1
;
pos <
=
$#;
pos++
))
;
do
#do echo "$#" "$i" "${!i}"; done
local
opt
=
"
${
!pos
}
"
local
optarg
case
"
${
opt
}
"
in
--config
=
*
)
optarg
=
"
${
opt
#*=
}
"
known_options
=
"
${
known_options
}
${
opt
}
"
shift
;;
--config
)
optarg
=
"
${
2
}
"
;
shift
2
# check here
((
++pos
))
optarg
=
"
${
!pos
}
"
known_options
=
"
${
known_options
}
${
opt
}
${
optarg
}
"
;;
-c
)
optarg
=
"
$2
"
;
shift
2
# check here
((
++pos
))
optarg
=
"
${
!pos
}
"
known_options
=
"
${
known_options
}
${
opt
}
${
optarg
}
"
;;
*
)
remained_args
=
"
${
remained_args
}
${
opt
}
"
shift
;;
esac
done
eval
${
__retopts
}
=
"'
${
known_options
}
'"
eval
${
__retargs
}
=
"'
${
remained_args
}
'"
}
function
parse_cmdline_options
()
{
local
remained_args
=
""
local
known_options
=
""
_arg_parse known_options remained_args
# FIXME(all): Use "--define USE_ESD_CAN=${USE_ESD_CAN}" instead
local
myopts
=
"
${
known_options
}
--cxxopt=-DUSE_ESD_CAN=
${
USE_ESD_CAN
}
"
local
targets
targets
=
"
$(
determine_targets
${
remained_args
}
)
"
COMMAND_LINE_OPTIONS
=
"
${
myopts
}
"
BUILD_TARGETS
=
"
${
targets
}
"
# Strip leading whitespaces
known_options
=
"
$(
echo
"
${
known_options
}
"
|
sed
-e
's/^[[:space:]]*//'
)
"
remained_args
=
"
$(
echo
"
${
remained_args
}
"
|
sed
-e
's/^[[:space:]]*//'
)
"
info
"Build Overview: "
info
"
${
TAB
}
Bazel Options:
${
GREEN
}${
COMMAND_LINE_OPTIONS
}${
NO_COLOR
}
"
info
"
${
TAB
}
Build Targets:
${
GREEN
}${
BUILD_TARGETS
}${
NO_COLOR
}
"
CMDLINE_OPTIONS
=
"
${
known_options
}
"
SHORTHAND_TARGETS
=
"
${
remained_args
}
"
}
function
_run_bazel_build_impl
()
{
...
...
@@ -128,8 +108,19 @@ function bazel_build() {
# exit 1
fi
parse_cmdline_options
"
$@
"
_run_bazel_build_impl
"
${
COMMAND_LINE_OPTIONS
}
"
"
$(
bazel query
${
BUILD_TARGETS
}
)
"
_parse_cmdline_arguments
$@
# FIXME(all): Use "--define USE_ESD_CAN=${USE_ESD_CAN}" instead
CMDLINE_OPTIONS
=
"
${
CMDLINE_OPTIONS
}
--cxxopt=-DUSE_ESD_CAN=
${
USE_ESD_CAN
}
"
local
bazel_targets
bazel_targets
=
"
$(
determine_bazel_targets
${
SHORTHAND_TARGETS
}
)
"
info
"Build Overview: "
info
"
${
TAB
}
Bazel Options:
${
GREEN
}${
CMDLINE_OPTIONS
}${
NO_COLOR
}
"
info
"
${
TAB
}
Build Targets:
${
GREEN
}${
bazel_targets
}${
NO_COLOR
}
"
_run_bazel_build_impl
"
${
CMDLINE_OPTIONS
}
"
"
$(
bazel query
${
bazel_targets
}
)
"
}
function
build_simulator
()
{
...
...
@@ -147,11 +138,10 @@ function build_simulator() {
function
main
()
{
if
[
"
${
USE_GPU
}
"
-eq
1
]
;
then
info
"
Running build under GPU mode. GPU is required to run the build
."
info
"
Your GPU is enabled to run the build on
${
ARCH
}
platform
."
else
info
"Running build under CPU mode."
info
"Running build under CPU mode
on
${
ARCH
}
platform
."
fi
info
"Building for
${
ARCH
}
arch ..."
bazel_build
$@
build_simulator
success
"Done building Apollo. Enjoy!"
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录