提交 7729a6d5 编写于 作者: S storypku 提交者: Xiangquan Xiao

Scripts: updated non-interactive mode support for apollo_config.sh

Goodbye to tools/apollo.bazelrc.sample
上级 1940d118
......@@ -15,52 +15,52 @@
# See the License for the specific language governing permissions and
# limitations under the License.
###############################################################################
set -e
TOP_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd -P)"
source "${TOP_DIR}/cyber/setup.bash"
set -e
BAZEL_CONF="${TOP_DIR}/.apollo.bazelrc"
ARCH="$(uname -m)"
function config_noninteractive() {
local output_dir="${APOLLO_CACHE_DIR}/bazel"
> "${BAZEL_CONF}"
echo "startup --output_user_root=\"${output_dir}\"" >> "${BAZEL_CONF}"
echo "common --distdir=\"${APOLLO_BAZEL_DISTDIR}\"" >> "${BAZEL_CONF}"
echo >> "${BAZEL_CONF}"
echo -e "build --action_env GCC_HOST_COMPILER_PATH=\"/usr/bin/${ARCH}-linux-gnu-gcc-7\"" >> "${BAZEL_CONF}"
cat "${TOP_DIR}/tools/apollo.bazelrc.sample" >> "${BAZEL_CONF}"
}
function config_interactive() {
function run_bootstrap() {
py3_bin="$(which python3 || true)"
# Set all env variables
"${py3_bin}" "${TOP_DIR}/tools/bootstrap.py" "$@"
}
function config() {
if [ $# -eq 0 ]; then
config_noninteractive
else
local mode="$1"
shift
if [ "${mode}" == "--clean" ]; then
rm -f "${BAZEL_CONF}"
elif [[ "${mode}" == "--interactive" || "${mode}" == "-i" ]]; then
config_interactive "$@"
else
config_noninteractive
fi
function main() {
local mycfg="$(basename ${BAZEL_CONF})"
if [[ "$#" -eq 0 ]]; then
run_bootstrap --help
exit 1
fi
}
function main() {
config "$@"
case "$1" in
--clean)
rm -f "${BAZEL_CONF}"
exit 0
;;
-h | --help)
run_bootstrap --help
exit 0
;;
-i | --interactive)
info "Configure ${mycfg} in interactive mode"
run_bootstrap --interactive
ok "Successfully configured ${mycfg} in interactive mode."
exit 0
;;
--noninteractive)
info "Configure ${mycfg} in non-interactive mode"
run_bootstrap --interactive false
ok "Successfully configured ${mycfg} in non-interactive mode."
exit 0
;;
*)
run_bootstrap --help
exit 0
;;
esac
}
main "$@"
build --action_env PYTHON_BIN_PATH="/usr/bin/python3"
build --action_env PYTHON_LIB_PATH="/usr/lib/python3/dist-packages"
build --python_path="/usr/bin/python3"
build:gpu --config=cuda
build:gpu --config=tensorrt
build --action_env CUDA_TOOLKIT_PATH="/usr/local/cuda-10.2"
build --action_env TF_CUDA_COMPUTE_CAPABILITIES="3.7,5.2,6.0,6.1,7.0,7.2,7.5"
# This config refers to building with CUDA available.
build:using_cuda --define=using_cuda=true
build:using_cuda --action_env TF_NEED_CUDA=1
build:using_cuda --crosstool_top=@local_config_cuda//crosstool:toolchain
# This config refers to building CUDA with nvcc.
build:cuda --config=using_cuda
build:cuda --define=using_cuda_nvcc=true
build:tensorrt --action_env TF_NEED_TENSORRT=1
build:teleop --define=WITH_TELEOP=true
......@@ -962,8 +962,6 @@ def main():
_APOLLO_INSIDE_DOCKER = inside_docker()
_INTERACTIVE_MODE = args.interactive
print("== Configure {} {}interactively ==".format(args.output_file,
"" if _INTERACTIVE_MODE else "non-"))
# Make a copy of os.environ to be clear when functions and getting and setting
# environment variables.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册