| # Licensed to the Apache Software Foundation (ASF) under one |
| # or more contributor license agreements. See the NOTICE file |
| # distributed with this work for additional information |
| # regarding copyright ownership. The ASF licenses this file |
| # to you under the Apache License, Version 2.0 (the |
| # "License"); you may not use this file except in compliance |
| # with the License. You may obtain a copy of the License at |
| # |
| # http://www.apache.org/licenses/LICENSE-2.0 |
| # |
| # Unless required by applicable law or agreed to in writing, |
| # software distributed under the License is distributed on an |
| # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| # KIND, either express or implied. See the License for the |
| # specific language governing permissions and limitations |
| # under the License. |
| |
| # Must be first. Enables build:windows, build:linux, build:macos, build:freebsd, build:openbsd |
| build --enable_platform_specific_config |
| |
| # The maximum number of attempts to retry a download error. The default value is 5 |
| common --experimental_repository_downloader_retries=10 |
| # The maximum number of attempts for http downloads. The default value is 8. |
| common --http_connector_attempts=16 |
| # Scale all timeouts related to http downloads by the given factor. The default value is 1.0. |
| common --http_timeout_scaling=2.0 |
| |
| ############################################################################### |
| # On Windows, provide: BAZEL_SH, and BAZEL_LLVM (if using clang-cl) |
| # On all platforms, provide: PYTHON3_BIN_PATH=python |
| ############################################################################### |
| build --action_env=PATH |
| |
| # For --compilation_mode=dbg, consider enabling checks in the standard library as well (below). |
| build --compilation_mode=opt |
| |
| # This workaround is needed to prevent Bazel from compiling the same file twice (once PIC and once not). |
| build:linux --force_pic |
| build:macos --force_pic |
| |
| build:clang-cl --compiler=clang-cl |
| build:msvc --compiler=msvc-cl |
| build:windows --compiler=msvc-cl |
| |
| # test config |
| test --build_tests_only |
| test --cache_test_results=no |
| test --test_output=all |
| |
| # Fory C++ validation config. This is opt-in so downstream Bazel users do not |
| # inherit Fory's warning-as-error policy when they consume Fory as source. |
| test:fory_cpp_werror --per_file_copt=^cpp/fory/.*@-Werror |
| test:fory_cpp_werror_msvc --per_file_copt=^cpp/fory/.*@/WX |
| |
| # Platform-specific C++ options |
| build:linux --cxxopt="-std=c++17" --linkopt="-pthread" |
| build:macos --cxxopt="-std=c++17" --linkopt="-pthread" |
| build:clang-cl --cxxopt="-std=c++17" |
| build:windows --cxxopt="/std:c++17" --cxxopt="/Zc:preprocessor" --cxxopt="/utf-8" |
| build:msvc --cxxopt="/std:c++17" --cxxopt="/Zc:preprocessor" --cxxopt="/utf-8" |
| |
| # CPU-specific optimizations for x86_64 |
| build:x86_64 --copt=-mavx |
| build:x86_64 --copt=-mavx2 |
| build:x86_64 --copt=-mbmi |
| build:x86_64 --copt=-mbmi2 |
| |
| # ARM64-specific optimizations (if any needed in the future) |
| build:arm64 --copt=-march=armv8-a |
| |
| # AddressSanitizer |
| build:asan --strip=never |
| build:asan --copt=-fsanitize=address |
| build:asan --copt=-g |
| build:asan --copt=-fno-omit-frame-pointer |
| build:asan --linkopt=-fsanitize=address |
| |
| # UndefinedBehaviorSanitizer |
| build:ubsan --strip=never |
| build:ubsan --copt=-fsanitize=alignment,bool,bounds,bounds-strict,builtin,enum,integer-divide-by-zero,object-size,pointer-overflow,return,shift,signed-integer-overflow,unreachable,vla-bound,vptr |
| build:ubsan --copt=-g |
| build:ubsan --copt=-fno-omit-frame-pointer |
| build:ubsan --linkopt=-fsanitize=alignment,bool,bounds,bounds-strict,builtin,enum,integer-divide-by-zero,object-size,pointer-overflow,return,shift,signed-integer-overflow,unreachable,vla-bound,vptr |
| build:arm64 --copt=-march=armv8-a |