forked from cloudflare/workerd
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.bazelrc
89 lines (73 loc) · 4.36 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
common --enable_platform_specific_config
# Our dependencies (ICU, zlib, etc.) produce a lot of these warnings, so we disable them.
# TODO(cleanup): Can we disable warnings altogether from our dependencies, without disabling them
# for workerd?
build --cxxopt='-Wno-ambiguous-reversed-operator' --host_cxxopt='-Wno-ambiguous-reversed-operator'
# Speed up sandboxed compilation, particularly on I/O-constrained and non-Linux systems
# https://bazel.build/reference/command-line-reference#flag--reuse_sandbox_directories
build --reuse_sandbox_directories
# optimized LTO build. you'll need a fairly recent clang for this to work
build:thin-lto -c opt
build:thin-lto --cxxopt='-flto=thin'
build:thin-lto --linkopt='-flto=thin'
# Define a config mode which is fastbuild but with basic debug info.
#
# Switching to full debug mode for debugging doesn't really work because debug mode produces
# insanely large binaries.
build:fastdbg -c fastbuild
build:fastdbg --cxxopt='-gline-tables-only' --host_cxxopt='-gline-tables-only'
build:fastdbg --linkopt='-gline-tables-only' --host_linkopt='-gline-tables-only'
build:fastdbg --strip=never
# Additional Rust flags (see https://doc.rust-lang.org/rustc/codegen-options/index.html)
# Need to disable debug-assertions for fastdbg, should be off automatically for opt
build --@rules_rust//:extra_rustc_flags=-C,panic=abort,-C,debug-assertions=n
build:fastdbg --@rules_rust//:extra_rustc_flags=-C,panic=unwind,-C,debug-assertions=y,-C,debuginfo=1
# TODO(later): -C codegen-units=1 improves code size and quality, should be enabled in a future
# release configuration even if lto is off. Similarly, adding -C lto=thin would improve binary size
# a lot (~2.2MB on Linux) – disable it for now due to compile errors and wrong code generation when
# bazel and Rust use different LLVM versions. -C opt-level=s provides a comparatively small size
# improvement, ~35k or ~75k with LTO.
build:thin-lto --@rules_rust//:extra_rustc_flags=-C,panic=abort,-C,codegen-units=1
#
# Linux and macOS
#
build:unix --cxxopt='-std=c++20' --host_cxxopt='-std=c++20' --force_pic --verbose_failures
build:unix --cxxopt='-fcoroutines-ts' --host_cxxopt='-fcoroutines-ts'
build:unix --cxxopt='-stdlib=libc++' --host_cxxopt='-stdlib=libc++'
build:unix --linkopt='-stdlib=libc++' --host_linkopt='-stdlib=libc++'
build:unix --action_env=BAZEL_COMPILER=clang
build:unix --action_env=CC=clang
build:unix --action_env=CXX=clang++
# Warning options.
build:unix --cxxopt='-Wall' --host_cxxopt='-Wall'
build:unix --cxxopt='-Wextra' --host_cxxopt='-Wextra'
build:unix --cxxopt='-Wno-strict-aliasing' --host_cxxopt='-Wno-strict-aliasing'
build:unix --cxxopt='-Wno-sign-compare' --host_cxxopt='-Wno-sign-compare'
build:unix --cxxopt='-Wno-unused-parameter' --host_cxxopt='-Wno-unused-parameter'
build:unix --cxxopt='-Wno-missing-field-initializers' --host_cxxopt='-Wno-missing-field-initializers'
build:unix --cxxopt='-Wno-ignored-qualifiers' --host_cxxopt='-Wno-ignored-qualifiers'
build:unix --@capnp-cpp//src/kj:openssl=True --@capnp-cpp//src/kj:zlib=True --@capnp-cpp//src/kj:libdl=True
build:linux --config=unix
build:macos --config=unix
#
# Windows
#
# See https://bazel.build/configure/windows#symlink
startup --windows_enable_symlinks
build:windows --enable_runfiles
# We use LLVM's MSVC-compatible compiler driver to compile our code on Windows,
# as opposed to using MSVC directly. This enables us to use the "same" compiler
# frontend on Linux, macOS, and Windows, massively reducing the effort required
# to compile workerd on Windows. Notably, this provides proper support for
# `#pragma once` when using symlinked virtual includes, `__atomic_*` functions,
# a standards-compliant preprocessor, support for GNU statement expressions
# used by some KJ macros, and understands the `.c++` extension by default.
build:windows --compiler=clang-cl
build:windows --cxxopt='/std:c++20' --host_cxxopt='/std:c++20' --verbose_failures
build:windows --cxxopt='/await' --host_cxxopt='/await'
build:windows --cxxopt='/wo4503' --host_cxxopt='/wo4503'
build:windows --cxxopt='/DWINDOWS_LEAN_AND_MEAN' --host_cxxopt='/DWINDOWS_LEAN_AND_MEAN'
# The `/std:c++14` argument is unused during boringssl compilation and we don't
# want a warning when compiling each file.
build:windows --cxxopt='-Wno-unused-command-line-argument' --host_cxxopt='-Wno-unused-command-line-argument'
build:windows --@capnp-cpp//src/kj:openssl=True --@capnp-cpp//src/kj:zlib=True