Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Pinoxchio
apollo
提交
82396742
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,发现更多精彩内容 >>
提交
82396742
编写于
6月 19, 2020
作者:
S
storypku
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Build: apollo6.sh: scripts/apollo_build.sh
上级
e21e4ba7
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
177 addition
and
12 deletion
+177
-12
apollo6.sh
apollo6.sh
+32
-2
scripts/apollo.bashrc
scripts/apollo.bashrc
+5
-0
scripts/apollo_build.sh
scripts/apollo_build.sh
+140
-10
未找到文件。
apollo6.sh
浏览文件 @
82396742
...
...
@@ -9,6 +9,7 @@ SUPPORTED_ARCHS=" x86_64 aarch64 "
APOLLO_VERSION
=
"@non-git"
APOLLO_ENV
=
""
USE_ESD_CAN
=
false
:
${
USE_GPU
:
=0
}
:
${
STAGE
:
=dev
}
...
...
@@ -58,6 +59,16 @@ function determine_gpu_use() {
USE_GPU
=
"
${
use_gpu
}
"
}
function
determine_esdcan_use
()
{
local
esdcan_dir
=
"
${
APOLLO_ROOT_DIR
}
/third_party/can_card_library/esd_can"
local
use_esd
=
false
if
[
-f
"
${
esdcan_dir
}
/include/ntcan.h"
-a
\
-f
"
${
esdcan_dir
}
/lib/libntcan.so.4"
]
;
then
use_esd
=
true
fi
USE_ESD_CAN
=
"
${
use_esd
}
"
}
function
check_apollo_version
()
{
local
branch
=
"
$(
git_branch
)
"
if
[
"
${
branch
}
"
==
"
${
APOLLO_VERSION
}
"
]
;
then
...
...
@@ -69,14 +80,17 @@ function check_apollo_version() {
}
function
apollo_env_setup
()
{
check_apollo_version
check_architecture_support
check_platform_support
check_minimal_memory_requirement
determine_gpu_use
check_apollo_version
determine_esdcan_use
APOLLO_ENV
=
"
${
APOLLO_ENV
}
USE_GPU=
${
USE_GPU
}
"
APOLLO_ENV
=
"
${
APOLLO_ENV
}
STAGE=
${
STAGE
}
"
APOLLO_ENV
=
"
${
APOLLO_ENV
}
USE_ESD_CAN=
${
USE_ESD_CAN
}
"
# Add more here ...
info
"Apollo Environment Settings:"
...
...
@@ -96,10 +110,26 @@ function main() {
if
[
"$#"
-eq
0
]
;
then
exit
0
fi
local
build_sh
=
"
${
APOLLO_ROOT_DIR
}
/scripts/apollo_build.sh"
local
cmd
=
"
$1
"
;
shift
case
"
${
cmd
}
"
in
build
)
env
${
APOLLO_ENV
}
bash
${
APOLLO_ROOT_DIR
}
/scripts/apollo_build.sh
"
$@
"
env
${
APOLLO_ENV
}
bash
"
${
build_sh
}
"
"
$@
"
;;
build_opt
)
env
${
APOLLO_ENV
}
bash
"
${
build_sh
}
"
-c
opt
"
$@
"
;;
build_dbg
)
env
${
APOLLO_ENV
}
bash
"
${
build_sh
}
"
-c
dbg
"
$@
"
;;
build_cpu
)
env
${
APOLLO_ENV
}
bash
"
${
build_sh
}
"
--mode
build_cpu
"
$@
"
;;
build_gpu
)
env
${
APOLLO_ENV
}
bash
"
${
build_sh
}
"
--mode
build_gpu
"
$@
"
;;
build_opt_gpu
)
env
${
APOLLO_ENV
}
bash
"
${
build_sh
}
"
--mode
build_gpu
-c
opt
"
$@
"
;;
buildify
)
env
${
APOLLO_ENV
}
bash
${
APOLLO_ROOT_DIR
}
/scripts/apollo_buildify.sh
...
...
scripts/apollo.bashrc
浏览文件 @
82396742
...
...
@@ -171,3 +171,8 @@ function read_one_char_from_stdin() {
echo
"
${
answer
}
"
|
tr
'[:upper:]'
'[:lower:]'
}
function
optarg_check_for_opt
()
{
local
opt
=
"
$1
"
local
optarg
=
"
$2
"
!
[[
-z
"
${
optarg
}
"
||
"
${
optarg
}
"
=
~ ^-.
*
]]
}
scripts/apollo_build.sh
浏览文件 @
82396742
...
...
@@ -4,22 +4,152 @@ set -e
TOP_DIR
=
"
$(
cd
"
$(
dirname
"
${
BASH_SOURCE
[0]
}
"
)
/.."
&&
pwd
-P
)
"
source
"
${
TOP_DIR
}
/scripts/apollo.bashrc"
ARCH
=
"
$(
uname
-m
)
"
# STAGE="${STAGE:-dev}"
:
${
STAGE
:
=dev
}
:
${
USE_GPU
:
=0
}
:
${
USE_ESD_CAN
:
=false
}
function
bazel_build
()
{
local
allowed_cmodes
=
" fastbuild dbg opt "
local
cmode
=
"fastbuild"
if
[
"
$1
"
==
"-c"
]
||
[
"
$1
"
==
"--compilation_cmode"
]
;
then
cmode
=
"
$2
"
;
shift
2
if
[[
"
${
allowed_cmodes
}
"
!=
*
"
${
cmode
}
"
*
]]
;
then
error
"Unknown compilation mode:
${
cmode
}
"
COMMAND_LINE_OPTIONS
=
BUILD_TARGETS
=
function
determine_disabled_targets
()
{
local
disabled
=
local
compo
=
"
$1
"
if
[[
-z
"
${
compo
}
"
||
"
${
compo
}
"
==
"drivers"
]]
;
then
if
!
${
USE_ESD_CAN
}
;
then
warning
"ESD CAN library supplied by ESD Electronics doesn't exist."
warning
"If you need ESD CAN, please refer to:"
warning
" third_party/can_card_library/esd_can/README.md"
disabled
=
"
${
disabled
}
except //modules/drivers/canbus/can_client/esd/..."
fi
elif
[[
"
${
compo
}
"
==
"localization"
&&
"
${
ARCH
}
"
!=
"x86_64"
]]
;
then
# Skip msf for non-x86_64 platforms
disabled
=
"
${
disabled
}
except //modules/localization/msf/..."
fi
echo
"
${
disabled
}
"
# DISABLED_CYBER_MODULES="except //cyber/record:record_file_integration_test"
}
# components="$(echo -e "${@// /\\n}" | sort -u)"
function
determine_targets
()
{
local
targets
=
local
compo
=
"
$1
"
if
[[
-z
"
${
compo
}
"
||
"
${
compo
}
"
==
"drivers"
]]
;
then
local
exceptions
=
if
!
${
USE_ESD_CAN
}
;
then
exceptions
=
"
$(
determine_disabled_targets
${
compo
}
)
"
fi
if
[
-z
"
${
compo
}
"
]
;
then
targets
=
"//...
${
exceptions
}
"
else
targets
=
"//modules/drivers/...
${
exceptions
}
"
fi
elif
[[
"
${
compo
}
"
==
"cyber"
]]
;
then
if
[[
"
${
ARCH
}
"
==
"x86_64"
]]
;
then
targets
=
"//cyber/... union //modules/tools/visualizer/..."
else
targets
=
"//cyber/..."
fi
elif
[[
-d
"
${
APOLLO_ROOT_DIR
}
/modules/
${
compo
}
"
]]
;
then
targets
=
"//modules/
${
compo
}
/..."
else
error
"Oops, no such component under <APOLLO_ROOT_DIR>/modules/ . Exiting ..."
exit
1
fi
echo
"
${
targets
}
"
}
function
parse_cmdline_options
()
{
local
build_mode
=
"build"
local
compilation_mode
=
"fastbuild"
local
args_to_pass_on
=
""
while
[
"$#"
-gt
0
]
;
do
local
option
=
"
$1
"
case
"
${
option
}
"
in
--mode
)
build_mode
=
"
$(
_check_build_mode
$2
)
"
;
shift
2
;;
-c
|
--compilation_mode
)
compilation_mode
=
"
$(
_check_compilation_mode
$2
)
"
;
shift
2
;;
*
)
# Pass arguments we don't handle to bazel
args_to_pass_on
=
"
${
args_to_pass_on
}
${
option
}
"
;
shift
;;
esac
done
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
local
modules
=
"
$@
"
#bazel build -c "${cmode}" --distdir=${APOLLO_CACHE_DIR} "$@"
myopts
=
"
${
myopts
}
--cxxopt=-DUSE_ESD_CAN=
${
USE_ESD_CAN
}
"
local
targets
targets
=
"
$(
determine_targets
${
args_to_pass_on
}
)
"
COMMAND_LINE_OPTIONS
=
"
${
myopts
}
"
BUILD_TARGETS
=
"
${
targets
}
"
info
"Build Overview: "
info
"
${
TAB
}
Bazel Options:
${
GREEN
}${
COMMAND_LINE_OPTIONS
}${
NO_COLOR
}
"
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
bazel_build
()
{
parse_cmdline_options
"
$@
"
if
!
"
${
APOLLO_IN_DOCKER
}
"
;
then
error
"The build operation must be run from within docker container"
exit
1
fi
run bazel build
--distdir
=
"
${
APOLLO_CACHE_DIR
}
"
"
${
COMMAND_LINE_OPTIONS
}
"
"
${
BUILD_TARGETS
}
"
}
function
main
()
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录