提交 ca7b7104 编写于 作者: X Xiangquan Xiao 提交者: Calvin Miao

Scripts: Auto-config if user didn't do it.

上级 c3768291
......@@ -78,6 +78,10 @@ function apollo_env_setup() {
info "${TAB}APOLLO_IN_DOCKER: ${APOLLO_IN_DOCKER}"
info "${TAB}APOLLO_VERSION: ${APOLLO_VERSION}"
info "${TAB}APOLLO_ENV: ${APOLLO_ENV} USE_GPU=${USE_GPU}"
if [ ! -f "${APOLLO_ROOT_DIR}/.apollo.bazelrc" ]; then
env ${APOLLO_ENV} bash "${APOLLO_ROOT_DIR}/scripts/apollo_config.sh" "$@"
fi
}
#TODO(all): Update node modules
......
......@@ -7,8 +7,6 @@ You could still proceed with the next few steps even if you are missing the Linu
./apollo.sh
# To make sure you start clean
./apollo.sh clean
# To configure bazel settings
./apollo.sh config
# This will build the full system and requires that you have an nVidia GPU with nVidia drivers loaded
bash apollo.sh build
```
......
......@@ -32,6 +32,10 @@ function clean() {
bazel clean --async
popd >/dev/null
fi
# Remove local bazel config.
bash "${TOP_DIR}/scripts/apollo_config.sh" --clean
success "Done $0 ${stage}."
}
......
......@@ -13,33 +13,32 @@ EOF
set -e
BAZEL_CONF="${TOP_DIR}/.apollo.bazelrc"
function config_noninteractive() {
local bzl_cfg_file="${APOLLO_ROOT_DIR}/.apollo.bazelrc"
echo "${STARTUP_TXT}" > "${bzl_cfg_file}"
echo "${STARTUP_TXT}" > "${BAZEL_CONF}"
# determine_gpu_use
# FIXME(all): Disable gpu mode for aarch64 until we are ready.
if [ "$(uname -m)" = "aarch64" ]; then
echo "build --config=cpu" >> "${bzl_cfg_file}"
echo "build --config=cpu" >> "${BAZEL_CONF}"
else
if [ "${USE_GPU}" -eq 1 ]; then
echo "build --config=gpu" >> "${bzl_cfg_file}"
echo "build --config=gpu" >> "${BAZEL_CONF}"
else
echo "build --config=cpu" >> "${bzl_cfg_file}"
echo "build --config=cpu" >> "${BAZEL_CONF}"
fi
fi
cat "${APOLLO_ROOT_DIR}/tools/apollo.bazelrc.sample" >> "${bzl_cfg_file}"
cat "${TOP_DIR}/tools/apollo.bazelrc.sample" >> "${BAZEL_CONF}"
}
function config_interactive() {
if [ -z "$PYTHON_BIN_PATH" ]; then
PYTHON_BIN_PATH=$(which python3 || true)
fi
local bzl_cfg_file="${APOLLO_ROOT_DIR}/.apollo.bazelrc"
# Set all env variables
"$PYTHON_BIN_PATH" "${TOP_DIR}/tools/bootstrap.py" "$@"
echo "${STARTUP_TXT}" >> "${bzl_cfg_file}"
echo "${STARTUP_TXT}" >> "${BAZEL_CONF}"
}
function config() {
......@@ -48,7 +47,9 @@ function config() {
config_noninteractive
else
local mode="$1" ; shift
if [[ "${mode}" == "--interactive" || "${mode}" == "-i" ]]; then
if [ "${mode}" == "--clean" ]; then
rm -f "${BAZEL_CONF}"
elif [[ "${mode}" == "--interactive" || "${mode}" == "-i" ]]; then
config_interactive "$@"
else
config_noninteractive
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册