Skip to content

Global C++ version #152

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Global C++ version #152

wants to merge 1 commit into from

Conversation

RReichert
Copy link
Contributor

@RReichert RReichert commented May 7, 2025

Changes

I'm adding a new build flag which controls what C++ version it will use across the entire codebase, including third party libraries. By default Bazel uses C++14 (even in third party libraries), which normally won't be a problem if it wasn't for the fact that the newest protobuf library which we are introducing didn't have have a problem with this, specifically Abseil.

Repositories can now run:

$ bazel build --@rules_swiftnav//:global_cxx_standard=17 //...

Which compiles everything with the C++17 standard. Options for C++20 and C++23 have been added as well.

Testing

@RReichert RReichert requested a review from a team as a code owner May 7, 2025 04:21
@RReichert RReichert force-pushed the rodrigor/upgrade-grpc branch from 510ab70 to ffc960a Compare May 7, 2025 04:23
# The whole codebase should build with c++14
"-std=c++14",
]
cxx_flags = select({
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How does this compare to https://github.com/swift-nav/rules_swiftnav/blob/main/cc/defs.bzl#L62 ? I actually wasn't aware of the flag directly in the toolchain file.

Copy link
Contributor Author

@RReichert RReichert May 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

with what is highlighted here, if you use the bazel cc_library or cc_binary directly it will impose the "global cxx standard". in the code snippet that you posted, that only applies to swift_cc_library and swift_cc_binary targets and overrules the global setting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants