Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Pinoxchio
apollo
提交
911c5a6c
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,发现更多精彩内容 >>
提交
911c5a6c
编写于
6月 23, 2020
作者:
S
storypku
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Bazel: refactored apollo_build.sh
上级
5e00dea2
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
46 addition
and
66 deletion
+46
-66
apollo6.sh
apollo6.sh
+1
-1
scripts/apollo_build.sh
scripts/apollo_build.sh
+44
-65
scripts/apollo_config.sh
scripts/apollo_config.sh
+1
-0
未找到文件。
apollo6.sh
浏览文件 @
911c5a6c
...
...
@@ -65,7 +65,7 @@ function apollo_env_setup() {
check_architecture_support
check_platform_support
check_minimal_memory_requirement
determine_gpu_use
# determine_gpu_use # work done by scripts/apollo.bashrc
determine_esdcan_use
APOLLO_ENV
=
"
${
APOLLO_ENV
}
STAGE=
${
STAGE
}
"
...
...
scripts/apollo_build.sh
浏览文件 @
911c5a6c
...
...
@@ -6,8 +6,6 @@ source "${TOP_DIR}/scripts/apollo.bashrc"
ARCH
=
"
$(
uname
-m
)
"
# STAGE="${STAGE:-dev}"
:
${
STAGE
:
=dev
}
:
${
USE_ESD_CAN
:
=false
}
COMMAND_LINE_OPTIONS
=
...
...
@@ -42,7 +40,7 @@ function determine_targets() {
exceptions
=
"
$(
determine_disabled_targets
${
compo
}
)
"
fi
if
[
-z
"
${
compo
}
"
]
;
then
targets
=
"//...
${
exceptions
}
"
targets
=
"//
modules/... union //cyber/
...
${
exceptions
}
"
else
targets
=
"//modules/drivers/...
${
exceptions
}
"
fi
...
...
@@ -61,43 +59,53 @@ function determine_targets() {
echo
"
${
targets
}
"
}
function
parse_cmdline_options
()
{
local
build_mode
=
"build
"
local
compilation_mode
=
"fastbuild
"
local
args_to_pass_on
=
""
function
_arg_parse
()
{
local
__retopts
=
"
$1
"
local
__retargs
=
"
$2
"
shift
2
local
known_options
=
""
local
remained_args
=
""
while
[
"$#"
-gt
0
]
;
do
local
option
=
"
$1
"
case
"
${
option
}
"
in
--mode
)
build_mode
=
"
$(
_check_build_mode
$2
)
"
;
shift
2
local
opt
=
"
$1
"
local
optarg
case
"
${
opt
}
"
in
--config
=
*
)
optarg
=
"
${
opt
#*=
}
"
known_options
=
"
${
known_options
}
${
opt
}
"
shift
;;
--config
)
optarg
=
"
${
2
}
"
;
shift
2
# check here
known_options
=
"
${
known_options
}
${
opt
}
${
optarg
}
"
;;
-c
|
--compilation_mode
)
compilation_mode
=
"
$(
_check_compilation_mode
$2
)
"
;
shift
2
-c
)
optarg
=
"
$2
"
;
shift
2
# check here
known_options
=
"
${
known_options
}
${
opt
}
${
optarg
}
"
;;
*
)
# Pass arguments we don't handle to bazel
args_to_pass_on
=
"
${
args_to_pass_on
}
${
option
}
"
;
shift
remained_args
=
"
${
remained_args
}
${
opt
}
"
shift
;;
esac
done
eval
${
__retopts
}
=
"'
${
known_options
}
'"
eval
${
__retargs
}
=
"'
${
remained_args
}
'"
}
local
myopts
=
""
if
[
"
${
compilation_mode
}
"
!=
"fastbuild"
]
;
then
myopts
=
"
${
myopts
}
-c
${
compilation_mode
}
"
fi
# TODO(all):
# Corner cases: build_gpu if env USE_GPU=0, build_cpu if env USE_GPU=1
# And, interaction with apollo.bazelrc
if
[
"
${
build_mode
}
"
==
"build_cpu"
]
;
then
myopts
=
"
${
myopts
}
--cxxopt=-DCPU_ONLY"
elif
[
"
${
USE_GPU
}
"
-eq
1
]
;
then
myopts
=
"
${
myopts
}
--config=gpu"
fi
myopts
=
"
${
myopts
}
--cxxopt=-DUSE_ESD_CAN=
${
USE_ESD_CAN
}
"
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
${
args_to_pass_on
}
)
"
targets
=
"
$(
determine_targets
${
remained_args
}
)
"
COMMAND_LINE_OPTIONS
=
"
${
myopts
}
"
BUILD_TARGETS
=
"
${
targets
}
"
...
...
@@ -107,52 +115,23 @@ function parse_cmdline_options() {
info
"
${
TAB
}
Build Targets:
${
GREEN
}${
BUILD_TARGETS
}${
NO_COLOR
}
"
}
function
_check_build_mode
()
{
local
supported_modes
=
" build build_cpu build_gpu "
local
mode
=
"
$1
"
if
!
optarg_check_for_opt
"--mode"
"
${
mode
}
"
;
then
exit
1
fi
if
[[
"
${
supported_modes
}
"
!=
*
"
${
mode
}
"
*
]]
;
then
error
"Unknown build mode:
${
mode
}
. Supported values:"
error
"
${
supported_modes
}
"
exit
1
fi
echo
"
${
mode
}
"
}
function
_check_compilation_mode
()
{
local
supported_modes
=
" fastbuild dbg opt "
local
mode
=
"
$1
"
if
!
optarg_check_for_opt
"-c"
"
${
mode
}
"
;
then
exit
1
fi
if
[[
"
${
supported_modes
}
"
!=
*
"
${
mode
}
"
*
]]
;
then
error
"Unknown compilation mode:
${
mode
}
. Supported values:"
error
"
${
supported_modes
}
"
exit
1
fi
echo
"
${
mode
}
"
function
_run_bazel_build_impl
()
{
local
job_args
=
"--jobs=
$(
nproc
)
"
bazel build
--distdir
=
"
${
APOLLO_CACHE_DIR
}
/distdir"
"
${
job_args
}
"
$@
}
function
bazel_build
()
{
parse_cmdline_options
"
$@
"
if
!
"
${
APOLLO_IN_DOCKER
}
"
;
then
error
"The build operation must be run from within docker container"
exit
1
#
exit 1
fi
run bazel build
--distdir
=
"
${
APOLLO_CACHE_DIR
}
"
"
${
COMMAND_LINE_OPTIONS
}
"
"
${
BUILD_TARGETS
}
"
parse_cmdline_options
"
$@
"
_run_bazel_build_impl
"
${
COMMAND_LINE_OPTIONS
}
"
"
$(
bazel query
${
BUILD_TARGETS
}
)
"
}
function
main
()
{
bazel_build
"
$@
"
bazel_build
$@
}
main
"
$@
"
scripts/apollo_config.sh
浏览文件 @
911c5a6c
...
...
@@ -8,6 +8,7 @@ source "${TOP_DIR}/scripts/apollo.bashrc"
IFS
=
''
read
-r
-d
''
STARTUP_TXT
<<
EOF
startup --output_user_root="
${
APOLLO_CACHE_DIR
}
/bazel"
common --distdir="
${
APOLLO_CACHE_DIR
}
/distdir"
EOF
set
-e
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录