From 0bcb214744af600cd970f3eeca92935582aec9a5 Mon Sep 17 00:00:00 2001 From: Robert Neale Date: Tue, 12 Apr 2022 16:22:10 -0700 Subject: [PATCH] Transition to using TF's bazel configuration rather than maintaining our own. PiperOrigin-RevId: 441320246 --- oss_scripts/configure.sh | 40 +++++++++++++++++++++++++++++++++++----- 1 file changed, 35 insertions(+), 5 deletions(-) diff --git a/oss_scripts/configure.sh b/oss_scripts/configure.sh index 8122ae945..2825901ae 100755 --- a/oss_scripts/configure.sh +++ b/oss_scripts/configure.sh @@ -60,11 +60,41 @@ if is_windows; then sed -i -e 's/":headers",$/":headers", ":windows_static_link_data",/' third_party/icu/BUILD.bzl fi -# Copy the building configuration of TF. -curl https://raw.githubusercontent.com/tensorflow/tensorflow/master/.bazelrc -o .bazelrc -# the next line is temporary to aid in transition -write_to_bazelrc "build:manylinux2010 --config=release_cpu_linux" -write_to_bazelrc "build:manylinux2014 --config=release_cpu_linux" +write_to_bazelrc "build:release_cpu_linux --config=manylinux2014" +write_to_bazelrc "build:manylinux2010 --crosstool_top=@ubuntu20.04-gcc9_manylinux2014-cuda11.2-cudnn8.1-tensorrt7.2_config_cuda//crosstool:toolchain" +write_to_bazelrc "build:manylinux2014 --crosstool_top=@ubuntu20.04-gcc9_manylinux2014-cuda11.2-cudnn8.1-tensorrt7.2_config_cuda//crosstool:toolchain" +write_to_bazelrc "build --spawn_strategy=standalone" +write_to_bazelrc "build --strategy=Genrule=standalone" +write_to_bazelrc "build -c opt" +write_to_bazelrc "build --define=framework_shared_object=true" +write_to_bazelrc "build --experimental_repo_remote_exec" +# By default, build in C++ 14 mode. +write_to_bazelrc "build --cxxopt=-std=c++14" +write_to_bazelrc "build --host_cxxopt=-std=c++14" + +# Config for Android build. +write_to_bazelrc "build:android --crosstool_top=//external:android/crosstool" +write_to_bazelrc "build:android --host_crosstool_top=@bazel_tools//tools/cpp:toolchain" +write_to_bazelrc "build:android --action_env TF_HEADER_DIR=\"\"" +write_to_bazelrc "build:android --action_env TF_SHARED_LIBRARY_DIR=\"\"" +write_to_bazelrc "build:android --action_env TF_SHARED_LIBRARY_NAME=\"\"" +write_to_bazelrc "build:android_arm --config=android" +write_to_bazelrc "build:android_arm --cpu=armeabi-v7a" +write_to_bazelrc "build:android_arm --fat_apk_cpu=armeabi-v7a" +write_to_bazelrc "build:android_arm64 --config=android" +write_to_bazelrc "build:android_arm64 --cpu=arm64-v8a" +write_to_bazelrc "build:android_arm64 --fat_apk_cpu=arm64-v8a" +write_to_bazelrc "build:android_x86 --config=android" +write_to_bazelrc "build:android_x86 --cpu=x86" +write_to_bazelrc "build:android_x86 --fat_apk_cpu=x86" +write_to_bazelrc "build:android_x86_64 --config=android" +write_to_bazelrc "build:android_x86_64 --cpu=x86_64" +write_to_bazelrc "build:android_x86_64 --fat_apk_cpu=x86_64" + +if is_windows; then + write_to_bazelrc "build --copt=/experimental:preprocessor" + write_to_bazelrc "build --host_copt=/experimental:preprocessor" +fi if (which python) | grep -q "python"; then installed_python="python"