Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 22 additions & 2 deletions BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,16 @@ licenses(["notice"]) # MIT
# Configuration Flags
# ==============================================================================

label_flag(
name = "std_module",
build_setting_default = ":empty_std_module",
)

config_setting(
name = "config_std_module_empty",
flag_values = {":std_module": ":empty_std_module"},
)

bool_flag(
name = "no_exceptions",
build_setting_default = False,
Expand Down Expand Up @@ -192,14 +202,21 @@ cc_library(
includes = ["include"],
)

cc_library(
name = "empty_std_module",
)

quill_module(
name = "quill_module",
copts = select({
"@rules_cc//cc/compiler:gcc": ["-Wno-gnu-zero-variadic-macro-arguments"],
"@rules_cc//cc/compiler:clang": ["-Wno-gnu-zero-variadic-macro-arguments"],
"//conditions:default": [],
}),
defines = ["QUILL_USE_MODULE="],
defines = ["QUILL_USE_MODULE="] + select({
":config_std_module_empty": [],
"//conditions:default": ["QUILL_IMPORT_STD"],
}),
# rules_cc 0.2.22 uses the same module metadata path for PIC and non-PIC outputs.
features = [
"cpp_modules",
Expand All @@ -208,5 +225,8 @@ quill_module(
module_interfaces = ["src/quill.cc"],
# Prevent users without --experimental_cpp_modules support from accidentally building this
tags = ["manual"],
deps = [":quill"],
deps = [":quill"] + select({
":config_std_module_empty": [],
"//conditions:default": [":std_module"],
}),
)
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,8 @@
Use `register_*_family()` when there is no initial metadata pointer to register.
- Added the opt-in `QUILL_IMPORT_STD` option for named module builds on toolchains supporting
`import std`; standard library headers remain the default.
- Added the `--@quill//:std_module` Bazel flag to configure the standard library module target
for `quill_module`, automatically enabling `QUILL_IMPORT_STD`.
- CMake and Bazel module targets now define `QUILL_USE_MODULE` automatically for consumers, while
retaining compatibility with an explicit `#define QUILL_USE_MODULE` in source code.
- Uncaught exceptions from `Frontend` logger creation and sink lookup or creation no longer leave
Expand Down
6 changes: 6 additions & 0 deletions docs/installing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,12 @@ whole build and pass ``--experimental_cpp_modules`` (for Clang, use
deps = ["@quill//:quill_module"],
)

To enable experimental ``import std`` support with Bazel, configure the ``--@quill//:std_module``
flag to point to your toolchain's standard library module target (for example, in ``.bazelrc`` via
``build --@quill//:std_module=@std_module``). When configured, Quill automatically defines
``QUILL_IMPORT_STD`` and adds the target as a dependency. If omitted, ``@quill//:std_module``
defaults to an empty target, falling back to standard library headers.

The selected Clang toolchain must also provide a matching ``clang-scan-deps`` beside the
compiler executable. On Ubuntu 24.04, install ``clang-18`` and ``clang-tools-18``, and set
``CC=/usr/lib/llvm-18/bin/clang`` and ``CXX=/usr/lib/llvm-18/bin/clang++``.
Expand Down
Loading