Skip to content

Commit

Permalink
Transition to using TF's bazel configuration rather than maintaining …
Browse files Browse the repository at this point in the history
…our own.

PiperOrigin-RevId: 441320246
  • Loading branch information
broken authored and rtg0795 committed Apr 13, 2022
1 parent 78d1f0c commit 0bcb214
Showing 1 changed file with 35 additions and 5 deletions.
40 changes: 35 additions & 5 deletions oss_scripts/configure.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 0bcb214

Please sign in to comment.