-
Notifications
You must be signed in to change notification settings - Fork 12
/
.bazelrc
162 lines (136 loc) · 5.54 KB
/
.bazelrc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
# MozoLM Bazel configuration file.
# --------------------------------
# Among other sources mostly based on TensorFlow options in:
# https://github.com/tensorflow/tensorflow/blob/master/.bazelrc
# ------------------------------
# General compiler options:
# ------------------------------
# Enable using platform specific build settings, except when cross-compiling for
# mobile platforms.
build --enable_platform_specific_config
build:android --noenable_platform_specific_config
build:ios --noenable_platform_specific_config
# Compiler options:
# c++17: Build with C++17 options (links with libc++)
# c++1z: Build with C++17 options (links with libc++)
# c++17_gcc: Build with C++17 options (links with stdlibc++)
# c++1z_gcc: Build with C++17 options (links with stdlibc++)
# Build with C++ 17 features.
build:c++17 --cxxopt=-std=c++1z
build:c++17 --cxxopt=-stdlib=libc++
build:c++1z --config=c++17
build:c++17_gcc --cxxopt=-std=c++1z
build:c++1z_gcc --config=c++17_gcc
# By default, build in C++ 17 mode.
build:android --cxxopt=-std=c++17
build:android --host_cxxopt=-std=c++17
build:android --copt=-w
build:ios --cxxopt=-std=c++17
build:ios --host_cxxopt=-std=c++17
build:linux --cxxopt=-std=c++17
build:linux --host_cxxopt=-std=c++17
build:linux --copt=-w
build:macos --cxxopt=-std=c++17
build:macos --host_cxxopt=-std=c++17
build:macos --copt=-w
build:windows --cxxopt=/std:c++17
build:windows --host_cxxopt=/std:c++17
build:windows --copt=/W0
build:windows --host_copt=/W0
# Generation of `runfiles` directories on Windows has to be explicitly enabled.
# See https://github.com/bazelbuild/bazel/issues/8843.
build:windows --enable_runfiles
test:windows --enable_runfiles
test:windows --test_output=errors
# Suppress C++ compiler warnings, otherwise build logs become 10s of MBs.
build:short_logs --output_filter=DONT_MATCH_ANYTHING
# Without this, bazel wraps each cc_library with "--whole-archive" flags for the
# linker when building the dynamic library, which leads to over-bloated libs.
build --incompatible_remove_legacy_whole_archive
# ------------------------------
# gRPC++ options:
# ------------------------------
build --define=use_fast_cpp_protos=true
# Asynchronous name resolver (c-ares) is not building on Android with current
# gRPC++.
build:android --define=grpc_no_ares=true
# The following options fix thread local storage-related linker failures on
# macOS.
build:macos --copt=-DGRPC_BAZEL_BUILD
build:macos --action_env=GRPC_BAZEL_RUNTIME=1
build:macos --features=-supports_dynamic_linker
# ------------------------------
# Windows configuration settings
# ------------------------------
# Make sure to include as little of windows.h as possible
build:windows --copt=-DWIN32_LEAN_AND_MEAN
build:windows --host_copt=-DWIN32_LEAN_AND_MEAN
build:windows --copt=-DNOGDI
build:windows --host_copt=-DNOGDI
# Verbose failure logs when something goes wrong
build:windows --verbose_failures
# On Windows, `__cplusplus` is wrongly defined without this switch
# See https://devblogs.microsoft.com/cppblog/msvc-now-correctly-reports-__cplusplus/
build:windows --copt=/Zc:__cplusplus
build:windows --host_copt=/Zc:__cplusplus
# Windows has a relatively short command line limit.
# See https://docs.bazel.build/versions/main/windows.html
build:windows --features=compiler_param_file
# MSVC (Windows): Standards-conformant preprocessor mode
# See https://docs.microsoft.com/en-us/cpp/preprocessor/preprocessor-experimental-overview
build:windows --copt=/Zc:preprocessor
build:windows --host_copt=/Zc:preprocessor
# ------------------------------
# Android configuration settings
# ------------------------------
# See https://github.com/tensorflow/tensorflow/blob/master/.bazelrc
# Following libraries seem to be required for NDK r21. Maybe consider building
# everything statically instead.
build:android --linkopt=-landroid
build:android --linkopt=-ldl
build:android --linkopt=-llog
build:android --linkopt=-lm
build:android --linkopt=-Wl,--gc-sections
# Options:
# android:
# android_arm:
# android_arm64:
# android_x86:
# android_x86_64:
#
# Bazel needs to have --cpu and --fat_apk_cpu both set to the target CPU to
# build the transient dependencies correctly. See
# https://docs.bazel.build/versions/master/user-manual.html#flag--fat_apk_cpu
build:android --crosstool_top=//external:android/crosstool
build:android --host_crosstool_top=@bazel_tools//tools/cpp:toolchain
build:android_arm --config=android
build:android_arm --cpu=armeabi-v7a
build:android_arm --fat_apk_cpu=armeabi-v7a
build:android_arm64 --config=android
build:android_arm64 --cpu=arm64-v8a
build:android_arm64 --fat_apk_cpu=arm64-v8a
build:android_x86 --config=android
build:android_x86 --cpu=x86
build:android_x86 --fat_apk_cpu=x86
build:android_x86_64 --config=android
build:android_x86_64 --cpu=x86_64
build:android_x86_64 --fat_apk_cpu=x86_64
# ------------------------------
# iOS Configuration Settings
# ------------------------------
# See:
# https://github.com/google/mediapipe/blob/master/.bazelrc
# https://github.com/tensorflow/tflite-support/blob/master/.bazelrc
build:ios --apple_platform_type=ios
build:ios --apple_bitcode=embedded --copt=-fembed-bitcode
build:ios --copt=-Wno-c++11-narrowing
build:ios_x86_64 --config=ios
build:ios_x86_64 --ios_multi_cpus=x86_64
build:ios_armv7 --config=ios
build:ios_armv7 --ios_multi_cpus=armv7
build:ios_arm64 --config=ios
build:ios_arm64 --ios_multi_cpus=arm64
build:ios_arm64e --config=ios
build:ios_arm64e --ios_multi_cpus=arm64e
build:ios_fat --config=ios
build:ios_fat --ios_multi_cpus=armv7,arm64